My users are shared across a number of machines via LDAP.
For one of those machines (let's call it 'fileserf'), I would like to restrict some users in what they can do (actually: prevent them from logging into an interactive session via ssh). On the other machines, these users should be able to use ssh normally.
So my initial idea was to use the internal-sftp subsystem, along the lines of:
Match group sftponly
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
This works ok as it restricts only the members of the (local) group sftponly on a single host fileserf, but unfortunately the internal-sftp subsystem only allows sftp and not scp (or rsync).
So I did some more research and found rssh, which seems to allow me to do exactly what I want to do (permission-wise).
Now the problem is that I cannot set the login-shell of those users to /usr/bin/rssh in my LDAP, because that would mean that they would be restricted on all machines, not just on fileserf.
So my idea is to override the login shell via some configuration in fileserf's sshd_config:
Match group sftponly
X11Forwarding no
AllowTcpForwarding no
ForceCommand /usr/bin/rssh
Unfortunately this doesn't seem to work, since now the users get a Connection closed whenever they try to sftp into the machine:
$ ssh user@fileserf
This account is restricted by rssh.
Allowed commands: scp sftp
If you believe this is in error, please contact your system administrator.
Connection to fileserf closed.
$ sftp user@fileserf
Connection closed
$
How can I make ForceCommand work with rssh?
Alternatively, How can I configure sshd to override the login-shell for a group of users?