Choose language

Portal Home > Knowledgebase > How-to > Hosting > HTTP > Additional web users


Additional web users




This article describes how to add additional web users, for whom you can give web access to your files. To start, log in to your SSH.
Firstly you need to create a password file, you need to do this with the command below:

htpasswd -c ~/.config/passfile username

Where the username is the user for whom you want to grant an access. Type in the user password twice, the password won't be visible and if everything is OK you will see info that the password has been updated.

Now you need to create a .htaccess file in the destination folder where the user created will have an access. You can use nano for such purpose and the command below will create .htaccess file in downloads:

nano ~/downloads/.htaccess

Put there the content given below:

AuthName 'Private'
AuthType Basic
AuthBasicProvider file
AuthUserFile '/path/to/password/file'
Require valid-user


In the 4th line you need to provide an absolute path to your passfile created before, for example it should be:

AuthUserFile '/home5/myuser/.config/passfile

Now the user should have access to the folder where you created the .htaccess file.

If you want to add more users with the same access to ~/downloads, you need to use the command below:

htpasswd ~/.config/passfile username

Where the username is another user who will have an access to your ~/downloads.

NOTE: to add another user(s) you need to use the htpasswd command without -c switch because it will create a new file and delete all users created before.

You can grant access to different folders to different users. You just need to create another password file with htpasswd. For example a user will get an access to ~/downloads/share folder:

htpasswd -c ~/.config/passfile2 myanotheruser


nano ~/downloads/share/.htaccess

.htaccess file with content:

AuthName 'Private'
AuthType Basic
AuthBasicProvider file
AuthUserFile '/home5/myanotheruser/.config/passfile2'
Require valid-user


That's all and myanotheruser will have access to ~/downloads/share folder.

If you want to delete any user from your passfile, you need to use the htpasswd command with -D switch:

htpasswd -D username /path/to/pass/file

for example you want to remove user2 from passfile2

htpasswd -D ~/.config/passfile2 user2


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
WebDAV (Views: 7716)

Powered by WHMCompleteSolution