Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would to like to restrict a user to certain directory(ies) but also allow to use SFTP for transfer.

I looked at the answers provided to similar questions at:

How do I setup SFTP for sites without giving shell access?

SFTP access akin to jailed shell

Unfortunately, the accepted answers only work on more current OpenSSH versions while my system is Centos 5.8,

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

I set up vsftpd using the following Rackspace guide: which works great by restricting user to their directories BUT only using ftp, it does not allow SSH (turned off shell using usermod)

I enabled sftp using the following guide:

Unfortunately, sftp was not allowed until I re-enabled bash shell for the user. Now sftp works, but they can leave their home directory and browse system files at will.

It is getting pretty close to shaving yaks now, so I wonder whether I should try to upgrade OpenSSH or is there another solution?

share|improve this question

You either need to upgrade your OpenSSH install to a version >= 4.9p1, as this will offer native chroot support.

Alternatively install one of the following restricted shells, and change the users shell to match the installed package.

There are a few more alternatives suggested on the scponly wiki.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.