Ssh – set up a chrooted SFTP login with OpenSSH

chrootjailsftpssh

How might I create an SFTP login for an untrusted user in which he can only access the files in his own home directory and not run any commands?

The online tutorial OpenSSH SFTP chroot() with ChrootDirectory is almost exactly what I need, except I'd like for the user to see his home directory as /home/user, rather than simply /.

Any help would be much appreciated.

Best Answer

scponly is a hack. The built-in sftp-server with chroot was meant to address this need properly.

Ben, why do you want them to see their home as /home/user? Doesn't that kind of defeat the purpose of a chroot? Is it just pwd output that you're looking for to reflect their location?

Or is it so they can use full paths in a script? I think you could symlink /home/user/home/user to /home/user for those purposes.