我正在尝试使用 Amazon EC2 服务器作为我的 SFTP 服务器,我可以在其中创建经过身份验证的用户以 sftp 进入我的服务器。对于使用 s3fs 的每个用户,我已将 s3 存储桶安装到位于 /mnt/buckets/{username} 位置的服务器上。读取和写入 /mnt/buckets/{username} 目录可以按预期使用 s3。
我的 sshd_config 有以下内容。
ChrootDirectory /mnt/buckets/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
当 SFTP-ing 我得到以下响应
...
debug1: Authentication succeeded (publickey).
Authenticated to ec2-54-173-113-164.compute-1.amazonaws.com ([54.173.113.164]:22).
debug2: fd 5 setting O_NONBLOCK
debug3: fd 6 is O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
Write failed: Broken pipe
Connection closed
挂载的存储桶具有这些权限。
/home/ubuntu# ls -l /mnt/buckets/
total 1
drwxrwxrwx 1 root root 0 Jan 1 1970 sftptester
当我将 Chroot 目录更改为 /mnt/buckets 时,我能够登录到 sftp 服务器以及读取和写入 s3 挂载的存储桶
我可以将用户 chroot 到已安装的 s3 存储桶中吗?
(另外,如果有任何工具已经具有此功能,我也会有兴趣了解它们)