linux sftp to user own home folder only

Edit /etc/ssh/sshd_config

add/change those line

# add -u 0000 for rwxwrxrwx on files/directories creation. (not secure)
Subsystem sftp internal-sftp -u 0000

# no more delay on password
UseDNS no

Match group filetransfer
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

save and exit and reload sshd.

#adduser kambing
#usermod -a -G kambingGroup kambing
#usermod -a -G filetransfer kambing
#cd /home
#chown root:root kambing
#cd kambing
#chown kambing:kambing public_html/

— to share directory where kambingGroupShareDir located outside current user’s home directory.

#mount –bind /home/kambingGroup/public_html kambingGroupShareDir

before that, make sure the ssh server setup using this configuration:

add/edit line in /etc/ssh/sshd_config

Subsystem sftp internal-sftp -u 0000 -f AUTH -l INFO

UseDNS no

Match group filetransfer
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

Advertisements

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