Configuring a Restriced Shell using rssh
Posted by admin on 04 May 2009 at 09:23 pm | Tagged as: Centos 5.x, IT Stuff, Linux
These notes refer to building rssh on Centos 5.3. I do not cover chrooting the user within their restricted shell because I could not get it working satisfactorily. Nor do I cover the reasons why you might want to use a restricted shell.
The steps I followed were:
Get the code
(1) download the source rpm (2.3.2 at time of writing)
(2) install the gpg key
rpm --import http://www.pizzashack,org/ddmkey.txt
(3) build the source package
rpmbuild -v --rebuild rssh-2.3.2-1.src.rpm
(4) install the newly built rpm
rpm -ivh /usr/src/redhat/RPMS/i386/rssh-2.3.2-1.i386.rpm
Configuring rssh (no chroot)
(1) edit the /etc/rssh.conf file and uncomment the #allowsftp line (and/or #allowscp and/or #allowrsync etc) to allow sftp access (and/or scp and/or rsync etc)
(2) create your user (eg for a user John Citizen)
useradd -m -d /home/jcitizen -s /usr/bin/rssh jcitizen
passwd jcitizen
(3) test the login for jcitizen from another machine
(a) connect using ssh
ssh jcitizen@rsshserver.mydomain.com
you should see output something like:
Last login: Sat Apr 25 11:00:11 2009 from 192.168.0.10
This account is restricted by rssh.
Allowed commands: scp sftp rsync
If you believe this is in error, please contact your system administrator.
Connection to rsshserver.mydomain.com closed.
(b) connect using sftp
sftp jcitizen@rsshserver.mydomain.com
You should now see some output something like:
Connecting to rsshserver.mydomain.com...
jcitizen@rsshserver.mydomain.com's password:
sftp>
(4) Important - note that this type of configuration will apply to all users with the rssh shell. It is also possible to configure rssh on a per user basis.
Leave a reply
You must be logged in to post a comment.