如何為某些使用者設定使用 s3fs 掛載的通用 SFTP 目錄?

如何為某些使用者設定使用 s3fs 掛載的通用 SFTP 目錄?

我希望建立一個可由特定使用者群組透過 SFTP 寫入的公共目錄。這組使用者應該只能存取此目錄,並且只能透過 SFTP 存取。

我已經使用以下 sshd 配置成功設定了此設定:

Subsystem sftp internal-sftp

Match Group sftponly
        ChrootDirectory /mnt/filebucket
        ForceCommand internal-sftp
        AllowTcpForwarding no
        PermitTunnel no
        X11Forwarding no
        PasswordAuthentication yes   # temporary for testing

我的使用者是該群組的一部分sftponly,他們可以登入並成功 chroot 到該目錄中。

但問題是我想在此 /mnt/filebucket 目錄中安裝 S3 儲存桶(使用 s3fs)。一旦我掛載它,目錄的權限就會從drwxr-xr-x 2 root root(sshd 批准 chroot)更改為drwxrwxrwx 1 root root(sshd 確實)不是批准)。

我安裝此目錄的方式是否導致此問題?

答案1

如果我將 ChrootDirectory 設定為 /mnt,一切都會按預期工作,但使用者在登入後需要(cd|點擊)進入額外的 filebucket 目錄。

是的,您可以使用-d切換到internal-sftp,這將為使用者指定起始目錄。

相關內容