»

How can chroot sftp-only SSH users into their homes?

Log — Tags: , , — Posted by Starck on June 8, 2014

Here is a guide for setting up SFTP users who’s access is restricted to their home directory.

/etc/ssh/sshd_config

Notes: (Important!)

If you got the login failed message:

Write failed: Broken pipe

Change the user and access permission:

Using start-stop-daemon on CentOS

Log — Tags: , — Posted by Starck on January 19, 2014

Download source

Done!

How to recursively give directories or files access permissions?

Log — Tags: , , , — Posted by Starck on October 8, 2013


To recursively give directories read & execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +

To recursively give files read privileges:

find /path/to/base/dir -type f -exec chmod 644 {} +


Or, if there are many objects to process:

chmod 755 $(find /path/to/base/dir -type d)

chmod 644 $(find /path/to/base/dir -type f)


Or, to reduce chmod spawning:

find /path/to/base/dir -type d -print0 | xargs -0 chmod 755

find /path/to/base/dir -type f -print0 | xargs -0 chmod 644

(c) 2024 Starck Lin | powered by WordPress