茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1730374 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_00111.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2012/6/21 10:08:44
自RHEL 6/CentOS 6開始,套件包含OpenSSH 5.3版本,可以不用重新編譯程式只要透過設定就可以限制SSH/SFTP連入的帳號存取的目錄。

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
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|