Cal*_*oon 7 sftp amazon-s3 amazon-ec2 amazon-web-services s3fs
我正在尝试使用 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
Run Code Online (Sandbox Code Playgroud)
当 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
Run Code Online (Sandbox Code Playgroud)
挂载的存储桶具有这些权限。
/home/ubuntu# ls -l /mnt/buckets/
total 1
drwxrwxrwx 1 root root 0 Jan 1 1970 sftptester
Run Code Online (Sandbox Code Playgroud)
当我将 Chroot 目录更改为 /mnt/buckets 时,我可以登录到 sftp 服务器以及读取和写入 s3 安装的存储桶
我可以将用户 chroot 到已安装的 s3 存储桶中吗?
(此外,如果有任何工具已经具有此功能,我也有兴趣了解它们)
问题可能是在装载文件夹中显示为用户目录的 S3“存储桶文件夹”没有 SFTP 用户读取它们的正确权限。
尝试将其添加到您的 S3FS 执行中-o umask=022。这将为您的 SFTP 用户文件夹添加以下权限:drwxr-xr-x
示例: sudo s3fs 存储桶名称 /mount/folder/ -o iam_role=role_name -o allow_other -o stat_cache_expire=10 -o enable_noobj_cache -o enable_content_md5 -o umask=022
-o allow_other并且-o umask=022我都需要让这个工作。| 归档时间: |
|
| 查看次数: |
1638 次 |
| 最近记录: |