Your downloads folder opens in the browser with the HTTP login of your service: Download Your Finished Files in the Browser. To let someone else download from one folder only, give that folder its own login. The other person never gets your password and sees only this folder.
You need two small files: a password file with the logins, and a file named .htaccess in the folder. Connect over SSH first: SSH how to get connected.
1. Create the Folder
Make a folder inside downloads, for example share, and copy or move the files there:
mkdir -p ~/downloads/share
Its address in the browser is your downloads address with the folder name added:
https://ds12345.seedhost.eu/username/downloads/share/
2. Create the Login
Create the password file with the first login, here guest1:
htpasswd -c ~/.config/share-users guest1
Enter the password for this login twice; it stays invisible while you type. Keep the file in ~/.config, outside downloads, so that nobody can download it.
3. Protect the Folder
Find the full path of your home folder:
echo $HOME
The answer looks like /home2/username. Open the new file .htaccess in the folder:
nano ~/downloads/share/.htaccess
Paste these lines and replace /home2/username with your answer:
AuthName 'Private' AuthType Basic AuthBasicProvider file AuthUserFile '/home2/username/.config/share-users' Require valid-user
Save with Ctrl+O and Enter and close with Ctrl+X.
4. Check It
Open the address of the folder in a private window of your browser. The browser asks for a user name and password: enter guest1 and its password. You see the files of share and its subfolders. With this login, downloads itself and your other folders stay closed (the browser keeps asking for a login).
The folder now accepts only the logins of its password file; your HTTP login of the service gets the login window again. To open the folder yourself, add a login for you to the same file, as in step 5.
Give the other person the address, the login and its password. The login is sent encrypted, because the address starts with https://.
5. Add or Remove Logins
Add another login to the same file, without -c:
htpasswd ~/.config/share-users guest2
-c creates a new, empty file. Used on an existing file, it deletes all logins already in it.
Remove a login; from now on it is refused:
htpasswd -D ~/.config/share-users guest2
A new password for a login: run the command of adding it again; htpasswd replaces the old password.
6. Stop Sharing
Delete the file .htaccess of the folder:
rm ~/downloads/share/.htaccess
The logins of the password file stop working there at once, and the folder opens again with your own HTTP login.
Good to Know
- Different people for different folders: create one password file per folder, for example
~/.config/share-familyand~/.config/share-friends, and name the right file in the.htaccessof each folder. - Everyone with a login can download every file of the folder and of its subfolders. Put only what you want to share there.
- The file
.htaccessitself cannot be opened in the browser. - The other person can also download with curl or a download manager, as described in Download Your Finished Files in the Browser.
- Other ways to share: FTP Accounts: Give Other People Access to One Folder (FTP and SFTP programs) and Fileshare: Share a File With a Download Link (one file).