Code snippets, tech tricks and other bits and bobs

« Back to blog

Multiple FTP users in Plesk 9

By now, Plesk is supposed to have built in support for creating multiple FTP users through the web interface, but it doesn’t seem to have materialised. So for the mean time, SSH is still the way forward:

Create ftp user with their own home directory:

# /usr/sbin/useradd -d $HTTPD_VHOSTS_D/your_domain/some/location -s /bin/false USER_NAME

Set the ftp user’s password:

# passwd USER_NAME

Add user to group psacln:

# /usr/sbin/usermod -G psacln USER_NAME

Change folder permissions for home directory:

# chmod 755 $HTTPD_VHOSTS_D/your_domain/some/location

Change ownership to user and group:

# chown USER_NAME:psacln $HTTPD_VHOSTS_D/your_domain/some/location

Set execute permission on the httpdocs folder for the domain:

# chmod 751 $HTTPD_VHOSTS_D/your_domain/httpdocs

At this point you have a valid FTP user who can connect. But only to their own folder. Now I want users with FTP write access to httpdocs so I can give 3rd party support access on occasion and later revoke it without having to change my master password. Also, all their actions will be logged as their user, so we have a data trail in case of things going pear shaped. This is as far as Parallels' guide goes, so we have to do a couple more steps:

Set the user’s home directory to the webroot:

# /usr/sbin/usermod -d $HTTPD_VHOSTS_D/your_domain/httpdocs/ USER_NAME

Grant write permissions to the group on the webroot:

# chmod g+w $HTTPD_VHOSTS_D/your_domain/httpdocs/

And we are done!

Where $HTTPD_VHOSTS_D is your vhosts path (typically /var/www/vhosts on the CentOS 5 boxes I’ve used) and USER_NAME is your chosen… errr, wossitcalled…

‘/some/location’ should be a non public access directory, e.g. /var/www/vhosts/your_domain/web_users/USER_NAME

These intstructions are tested on CentOS 5 / Plesk 9. They should work for other *nix flavours, but as with everything on t'net, excercise caution, and on your own head be it.

http://kb.parallels.com/en/415

Posted June 14, 2010