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).

⚠ Your own login no longer opens this folder

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
ℹ Use -c only once

-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

Was this answer helpful? 133 Users Found This Useful (206 Votes)