Confine SSH user to home directory with rbash


2012-09-19

You can use rbash to limit a user to their own home directory (they cannot cd to other directories, or write to them). To do this, you will want to edit /etc/passwd and change the user's shell:

test:x:1001:1001:,,,:/home/test:/bin/bash

should change to

test:x:1001:1001:,,,:/home/test:/bin/rbash

I did this on Ubuntu 12.04, so if your system varies from that then you might have additional steps.