Restricted shell account (SSH and Subversion)

While trying to set up a restricted shared shell account for SVN access I read about an interesting feature of OpenSSH. From this section of the SVN manual I learned that svn supports the following syntax in $HOME/.ssh/authorized_keys

  command="program" TYPE KEY COMMENT

Program is a command that will be executed instead of a shell when connected and it also supports different configuration options. For example, if you want the account to be really restricted you may want to pass the following options no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty. In my case, I used the following line in the configuration file:

command="/usr/bin/svnserve -t --tunnel-user=tadekp -r /var/lib/svn/svncommon",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss AAAAB3N.... tadekp@server

Just a few points to remember:

  • many commands can execute shell internally, watch out for these
  • the command can modify authorized_keys file, the best way to prevent it is to make it read only on the filesystem level

One Response to “Restricted shell account (SSH and Subversion)”

  1. Shell Account Says:

    This helped me out a lot. Thanks!

Leave a Reply