category:

Creation of additional FTP users for Plesk Linux

Plesk is a great Control Panel in  the shared hosting environment, but there are a few things that are not available in the Control Panel. For example, you cannot create additional FTP user in Plesk Control panel for Linux (this support is enabled in Plesk for windows).  But some time it is required to have multiple FTP accounts to upload/download data. You need to have shell access since the Plesk control panel won’t allow it in the GUI.

Assuming you already have an existing domain (example.com) with the primary FTP user (jack) with password (schmidt) with home directory (/var/www/vhosts/example.com), and you wish to create additional ftp users (jill and bob) with the same access privileges as jack:

Procedure:

Login to server via SSH as root. Issue the shell command:
#cat /etc/passwd |grep ‘jack’
This will show you a line similar to the following:
jack:x:10041:10001::/var/www/vhosts/example.com:/bin/false

The first number (after the 2nd colon : ) is 10041, so this is the UID of user jack. You will need this in the ‘useradd’ lines since useradd wants a number for the UID.

The second number (after the 3rd colon : ) is 10001, this is the GID (psacln), we won’t need that right now. Then run the following shell commands to create the users and passwords:
#useradd -u 10041 -o -d /var/www/vhosts/example.com -g psacln -s /bin/false jill #useradd -u 10041 -o -d /var/www/vhosts/example.com -g psacln -s /bin/false bob #passwd jill (enter the new password and confirm it, does not have to be the same as jack’s) #passwd bob (enter the new password and confirm it, does not have to be the same as jack’s)
You should now be able to use an FTP client to login with that user’s name and password.

User jill and bob should be able to see the example.com docroot just as user jack can. You should NOT be able to browse above the example.com docroot directory. All 3 users should have the same access to the files since they belong to the same group, so no matter which of the users created or edited the file(s), all should be able to access/edit/whatever the same files.

(NOTES: Since these are users defined at the OS level, when connecting with an FTP client, they would login with username ‘jill’, ‘bob’, or ‘jack’. They would NOT use ‘jill@nullexample.com’. This also means that USERNAMES MUST BE UNIQUE.)

Subdomain FTP users:

If you wanted to change their default directory and limit them to a Plesk created subdomain docroot, in the useradd line above, you would change “/var/www/vhosts/example.com” to “/var/www/vhosts/example.com/subdomains/subname”. So if you wanted to create the same users, but for a subdomain called ‘admin’:

Then do the following shell commands to create the users and passwords:
#useradd -u 10041 -o -d /var/www/vhosts/example.com/subdomains/admin -g psacln -s /bin/false jill #useradd -u 10041 -o -d /var/www/vhosts/example.com/subdomains/admin -g psacln -s /bin/false bob #passwd jill (enter the new password and confirm it, does not have to be the same as jack’s) #passwd bob (enter the new password and confirm it, does not have to be the same as jack’s)
Deleting an FTP user:
#userdel jill
(Note: this will not delete any files unless you use the -r option which you probably don’t want to do if they are sharing files!) [ratings]
Share
Comments (22)

22 responses to “Creation of additional FTP users for Plesk Linux”

  1. Ragnard says:

    Thanks! Works like a charm.

  2. Blaine says:

    This is great – thanks! BUT can I restrict “jill” from uploading or deleting or changing file names in this shared folder? THAT would be truly awesome. Using proftp, btw.

    • ankur says:

      Thanks for your comment. But you can’t restrict “jill” from uploading or deleting or changing file names in this shared folder, because the other FTP user “jill

  3. Blaine says:

    Thank you so much for the quick reply, but IS there a way to have jill just be able to read?

  4. Blaine says:

    I figured it out. I made the UID and GID unique, then assigned the appropriate rights to the folder. This post was very helpful. Thank you.

  5. Daz says:

    Blaine – could you elaborate on how you changed UID/GID to restrict access to folders. What I’m trying to do is not only create multiple accounts on a subdomain (success) but restrict those accounts to specific directories within that doman, so that user Bob can only access his Bob directory that I set up under httpdocs.

    • ankur says:

      Hi Daz, Thank you for your comment, you can run the command as below:

      useradd -d /var/www/vhosts/example.com/subdomains/subdomain-name/bob -s /bin/false bob

      It will set the UID and GID unique, and then set the other users read permission only on the folder bob. This will make the other user (bob) can only read the files/folders. And as the user shell set to /bin/false, which will restrict the account to specific directory within that domain.

  6. Tony Bianco says:

    This is great, because I’m using Media Temple’s DV plan and they use Plesk. I’m needing to create multiple FTP accounts for the same domain but I need to restrict their access to a particular folder.

    Also, I need that folder to not be in an area of the webroot where the public can access that folder.

    How would I accomplish this?

  7. Tony Bianco says:

    Ankur,

    Just so I’m understanding this correctly, because I’m new to this.

    I would I issue the following commands to add a new FTP user that would be able to access a folder via FTP:

    useradd -d /var/someFTPFolder -s /bin/false myUserName myPassword

    Is that correct?

    And is there way to assign that user to a general folder and then a user specific folder?

    • ankur says:

      Tony,

      “useradd -d /var/someFTPFolder -s /bin/false myUserName” is correct.

      Change the user home directory path as per your choice (general folder or user specific folder), e.g. “/var/some-other-FTPFolder”.

      Regards,
      Ankur

  8. Tony Bianco says:

    Thank you very much! If I ever want to change a user’s password how would I do that?

  9. Mirka says:

    I found another solution more explained
    see this post http://updel.com/additional-ftp-plesk/

  10. touhey says:

    There is a typo in the initial shell command:
    #cat /etc/passwd |grep ‘jack’

    The “|” before “grep” should be a backslash “/grep”.

  11. Michael says:

    There is no typo, the “|” is a pipe and it means to pipe the result of “cat /etc/passwd” to “grep `jack`”

  12. Rich says:

    It is possible to view all the users you have created? Thank you!

  13. Rich, running “vi /etc/passwd” or “nano /etc/passwd” should return a list of all the users associated with your server. HTH.

  14. […] guessed, however you can just add normal UNIX accounts on the command using useradd, passwd etc. This article also suggests matching the UID with the -u option of […]

Leave a Reply

Your email address will not be published. Required fields are marked *

34 + = 38

Related:

Stay Updated

Please enter your details below to get
A Free Trial
x + x* =