@
you're reading...
Linux Tips and Tricks

Setup chrooted SFTP

Environment: CentOS 6 64bit. Users will be under the group sftpusers with no shell. They will have a directory inside chrooted directory named incoming. Chrooted directory will be /sftp/%u.

Main requirement: For this to work, ensure that the chrooted directory is owned by root and is not writable by group or any other user.

1. First off, edit /etc/ssh/sshd_config like the image below then restart sshd service.
sshd_config

2. I have created a tiny shell script to automate the addition process:
add_sftp_user-script

Testing: Add the users using the script @ step 2. My test users are ironman and spiderman.
addusers

Logging in using WinSCP:
login-ironman
home-ironman

login-spiderman
home-spiderman

That’s it!

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s