Add jail shelled FTP/SSH user on CentOS / Plesk

By April 22, 2010Interest, Linux

The process of adding a new FTP user with SSH access to a Plesk / CentOS server is more difficult than it needs to be.  Plesk will only allow you to add WebUsers to your domains which have FTP accounts, not full SSH accounts.  Here is the quick and dirty. We want our new user to be in chroot jail and to inherit the same permissions as another user on the system.  The user will be restricted to the top level directory you define (for example httpdocs in this case).

Login as Root:

1.  cat /etc/passwd/ | grep 'anyusername'

This will return:

[cci]anyusername:x:10009:2524::/var/www/vhosts/anydomain.com:/bin/bash[/cci]

The first set of numbers after “:x:” is the UID or User Identifier.  We will use this in the next command to copy the same permissions.

2.useradd -u 10009 -o -d /var/www/vhosts/anydomain.com/httpdocs/ -g psaserv -s /usr/local/psa/bin/chrootsh newusername

Replace “anydomain.com” with your domain, and “newusername” with the new user you would like to add.

3.passwd newusername

Gives the user a password.

4. usermod -s /bin/bash newusername

Boom! Done.

Extras:
For an in-depth discussion on working with rssh, chroot, and users – see UnixCraft

4
Leave a Reply

avatar
4 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
PrashantSahoo Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
PrashantSahoo
Guest
PrashantSahoo

hi

PrashantSahoo
Guest
PrashantSahoo

Shaktiprasad Swain hello r u sleeping

PrashantSahoo
Guest
PrashantSahoo

@Preeti Pattanayak

PrashantSahoo
Guest
PrashantSahoo

cat /etc/passwd/ | grep ‘preeti pattanayak