
我很難讓 SFTP(選定的)使用者限制在 FreeNAS 9.10.1-U4 上的主目錄
預設 sshd 配置看起來像
Subsystem sftp /usr/libexec/sftp-server -l ERROR -f AUTH
Protocol 2
UseDNS no
ChallengeResponseAuthentication no
ClientAliveCountMax 3
ClientAliveInterval 15
Port 22
PermitRootLogin yes
AllowTcpForwarding no
Compression no
PasswordAuthentication yes
PubkeyAuthentication yes
然後我在下面添加了幾行來將選定的 SFTP 用戶(透過所屬群組)鎖定到他們的預設主目錄
Match Group dirtyUsers
ChrootDirectory /mnt/Backups/tmp
ForceCommand /usr/libexec/sftp-server
但新增這些行後,所屬的任何使用者都dirtyUsers
無法使用 SFTP 登入。
SFTP存取錯誤日誌:
Mar 2 18:42:16 backups sshd[69549]: Accepted password for dirtyUser from xxx.xxx.xxx.125 port 57495 ssh2
Mar 2 18:42:16 backups sshd[69551]: fatal: bad ownership or modes for chroot directory "/mnt/Backups/tmp"
在哪裡
drwxr-xr-x 5 dirtyUser dirtyUsers 5 Mar 10 2016 /mnt/Backups/tmp/
我也做了下面的步驟
chown root:wheel /mnt/Backups/tmp
chmod 755 /mnt/Backups/tmp
chown dirtyUser:dirtyUsers /mnt/Backups/tmp/*
chmod 775 -R /mnt/Backups/tmp/*
但它允許登錄,然後從 SFTP 註銷(沒有錯誤日誌)。
有什麼建議嗎?