對這文章發表回應
發表限制: 非會員 可以發表
發表者: 冷日 發表時間: 2012/6/21 10:08:44
自RHEL 6/CentOS 6開始,套件包含OpenSSH 5.3版本,可以不用重新編譯程式只要透過設定就可以限制SSH/SFTP連入的帳號存取的目錄。
1.建立sftponly群組
2.新建帳號test
3.修改/etc/ssh/sshd_config設定(檔案尾端)
4.重啟SSHd服務
5.測試
使用FileZila Client連進去看看,確認可以登入,上傳/下載檔案。
參考資料:
http://www.thisisnotsupported.com/sftp-chrootjail-on-centos6/
原文出處:在CentOS 6上設定SFTP Chroot Jail
1.建立sftponly群組
groupadd sftponly
2.新建帳號test
useradd -s /bin/false -G sftponly test
passwd test
chown root /home/test
3.修改/etc/ssh/sshd_config設定(檔案尾端)
# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server
Match Group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTCPForwarding no
ForceCommand internal-sftp
4.重啟SSHd服務
service sshd restart
5.測試
使用FileZila Client連進去看看,確認可以登入,上傳/下載檔案。
參考資料:
http://www.thisisnotsupported.com/sftp-chrootjail-on-centos6/
原文出處:在CentOS 6上設定SFTP Chroot Jail