Personal tools
You are here: Home Howtos Security SSH Restrict user account to scp, sftp, rsync only with Fedora
« September 2010 »
September
MonTueWedThuFriSatSun
12345
6789101112
13141516171819
20212223242526
27282930
 

Restrict user account to scp, sftp, rsync only with Fedora

This howto will show you how to restrict any account to cvs, scp, sftp and rsync only.

Applicable to Fedora Versions:

  • Fedora: All versions

Requirements

Explanation of requirements.
  1. Root or appropriate sudo access to the system
  2. Internet access

Doing the Work

Basic description of what will be done and what is expected.

  1. Install rssh:
  2. yum install rssh
  3. Edit /etc/rssh.conf and /etc/passwd and replace /bin/bash with /usr/bin/rssh:
  4. uncomment these lines from the top of /etc/rssh.conf:
    allowscp
    allowsftp
    allowcvs
    allowrsync

    vi /etc/passwd (hit "i" for insert and esc :wq for write/quit)
    user:x:501:501::/home/user:/usr/bin/rssh
  5. Restart sshd and attempt to connect from a remote system using sftp and ssh:
  6. sftp user@1.2.3.4
    user@1.2.3.4's password:
    sftp>

    ssh user@1.2.3.4
    Enter passphrase for key '/home/user/.ssh/id_dsa':
    user@1.2.3.4's password:

    This account is restricted by rssh.
    Allowed commands: scp sftp cvs rsync

    If you believe this is in error, please contact your system administrator.

    Connection to 1.2.3.4 closed.

Troubleshooting

How to test

Explanation troubleshooting basics and expectations.
  1. Make sure your firewall or denyhosts has not banned or blocked your ip:
  2. service iptables status
    tail -f /etc/hosts.deny
  3. Restart sshd, make sure your password is correct for user:
  4. service sshd restart
    sudo passwd user

Common problems and fixes

Describe common problems here, include links to known common problems if on another site

More Information

Any additional information or notes.

Disclaimer

We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #centos on irc.freenode.net

Added Reading

Document Actions
  • Send this
  • Print this
  • Bookmarks