Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services SFTP Chroot用户至安装的S3铲斗_Amazon Web Services_Amazon S3_Amazon Ec2_Sftp_S3fs - Fatal编程技术网

Amazon web services SFTP Chroot用户至安装的S3铲斗

Amazon web services SFTP Chroot用户至安装的S3铲斗,amazon-web-services,amazon-s3,amazon-ec2,sftp,s3fs,Amazon Web Services,Amazon S3,Amazon Ec2,Sftp,S3fs,我正在尝试使用AmazonEC2服务器作为我的SFTP服务器,在这里我可以创建经过身份验证的用户将SFTP导入我的服务器。我已经为使用s3fs的每个用户在位置/mnt/bucket/{username}将s3 bucket安装到服务器上。读取和写入/mnt/bucket/{username}目录可以像预期的那样使用s3 我的sshd_配置有以下内容 ChrootDirectory /mnt/buckets/%u X11Forwarding no AllowTcpForwarding no For

我正在尝试使用AmazonEC2服务器作为我的SFTP服务器,在这里我可以创建经过身份验证的用户将SFTP导入我的服务器。我已经为使用s3fs的每个用户在位置/mnt/bucket/{username}将s3 bucket安装到服务器上。读取和写入/mnt/bucket/{username}目录可以像预期的那样使用s3

我的sshd_配置有以下内容

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/bucket时,我能够登录到sftp服务器,并读取和写入安装在s3上的bucket

我可以将用户引导到已安装的s3存储桶中吗


(如果有任何工具已经具有此功能,我也有兴趣了解它们)

问题可能是,在装载文件夹中显示为用户目录的S3“bucket文件夹”没有正确的权限让SFTP用户读取它们

尝试将其添加到S3FS执行中
-o umask=022
。这将向您的SFTP用户文件夹添加以下权限:
drwxr-xr-x

示例: sudo s3fs bucket name/mount/folder/-o iam\u role=role\u name-o allow\u other-o stat\u cache\u expire=10-o enable\u noobj\u cache-o enable\u content\u md5-o umask=022

  • -o allow_other
    -o umask=022
    都是我工作所必需的

我不知道使用openssh内置的sftp有多简单,但它在proftpd+s3fs中的工作与预期一样。你解决过这个问题吗?