osxfuse / sshfs

File system based on the SSH File Transfer Protocol
http://fuse.sourceforge.net
GNU General Public License v2.0
1.16k stars 131 forks source link

Minor fixes to support AWS Transfer (sftp access to S3)? #55

Open PenelopeFudd opened 4 years ago

PenelopeFudd commented 4 years ago

Hi;

I'm attempting to mount an S3 bucket on my MacOS 10.15.4 (Catalina), and so far s3fs and yas3fs have failed in various ways. Sshfs almost works, but dies with the following error:

$ sshfs -d ucat: ucat-folder/ -o idmap=user,nomap=ignore,workaround=nofstat,sshfs_debug

SSHFS version 2.10
FUSE library version: 2.9.7
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-2> <ucat> <-s> <sftp>
Server version: 3
unique: 2, opcode: INIT (26), nodeid: 0, insize: 56, pid: 5935
INIT: 7.19
flags=0xf8000008
max_readahead=0x00100000
failed to detect remote user ID
   INIT: 7.19
   flags=0x00000010
   max_readahead=0x00100000
   max_write=0x02000000
   max_background=0
   congestion_threshold=0
   unique: 2, success, outsize: 40
unique: 2, opcode: STATFS (17), nodeid: 1, insize: 40, pid: 0
statfs /
Floating point exception: 8

As this is AWS, they're a bit like Apple, in that they "Think Different". Here's what I see when using sftp manually:

$ sftp ucat
Connected to ucat.
sftp> dir
foobar
sftp> ls -la
drwxr--r--   1        -        -        0 Jan  1  1970 foobar
sftp> df
Server does not support statvfs@openssh.com extension
sftp>

Perhaps the problem is in the sshfs_statfs function?

For testing, these commands will set up an AWS Transfer server and user:

 aws transfer create-server --output=text

 aws transfer create-user \
  --role arn:aws:iam::0000000000:role/cross-account/Account-ReadOnly \
  --server-id s-00000000000 \
  --user-name your_username \
  --home-directory '/your-s3-bucketname/your-folder-well-prefix-actually/'

 aws transfer import-ssh-public-key \
  --server-id s-000000000 \
  --user-name your_username \
  --ssh-public-key-body "$(cat ~/.ssh/id_rsa.pub)"

cat <<'EOF' >> ~/.ssh/config
Host ucat
  User your_username
  Hostname s-0000000000000.server.transfer.us-west-2.amazonaws.com
  IdentityFile ~/.ssh/id_rsa
EOF

sftp ucat
Connected to ucat.
sftp>

Thanks!

PenelopeFudd commented 4 years ago

Here's the full debug log from:

sshfs -d ucat: ucat-folder/ -o idmap=user,nomap=ignore,workaround=nofstat,sshfs_debug,loglevel=debug,debug

Note, I also tried with just sshfs_debug,loglevel=debug,debug, same results.

a.txt