8

I had originally asked this as a follow-up question here. Unfortunately, there haven't been any replies so I am posting it as its own question.

According to the documentation, you are supposed to be able to use ssh options with sshfs. How do you do this? I have tried something like -o User=joe but then fuse gives me an error saying that "User" is not a recognized option.

Also, help with this question would also be appreciated.


Edit:

I am specifically referring to the following from the manpage for sshfs.

SSHFS options:

  -p PORT
         equivalent to '-o port=PORT'

  -C     equivalent to '-o compression=yes'

  ⋮

  -o password_stdin
         read password from stdin (only for pam_mount!)

  -o SSHOPT=VAL
         ssh options (see man ssh_config)

I am trying to specify the remote username separate from the host (in other words, not user@host:dir). The reason is that particular format is not friendly with some institutionally assigned usernames. For example, if the institution assigns the user name [email protected], programs such as sshfs and curlftpfs will not correctly interpret [email protected]@host:dir. Instead, they will try to login as First.Last to the host institution.edu@host.

Could you explain a bit more about idmap? I am not literate enough to understand what the manpage is saying.


Edit:

If I use idmap, I am going to have to create hardcoded files. I was hoping to avoid that so that the user can just use a single command without needing to know how it works in the background. Eventually, other people might be using it even after I leave. Even so, the documentation says the file format is username:uid. Which is the local and which is remote?

9
  • That is how you specify options, I don't think user=joe is a valid option. My guess is you want -o idmap=user . See the man page for valid mount options linux.die.net/man/1/sshfs or update your question as I am not sure what your problem is other than an invalid option or if you need to manually map users
    – Panther
    Nov 12, 2017 at 21:57
  • @Panther Updated. Nov 12, 2017 at 22:22
  • Take a look at the arch sshfs page I don't have time to write a long answer right now
    – Panther
    Nov 12, 2017 at 22:30
  • wiki.archlinux.org/index.php/SSHFS#Secure_user_access
    – Panther
    Nov 13, 2017 at 1:54
  • idmap only takes none, user, or file explicitly as options, you can't give it a userid. Nov 13, 2017 at 2:09

3 Answers 3

8

To pass SSH options to SSHFS, you can use ssh_command.

For example, to pass -c aes128-cbc to SSH, use:

sshfs -o ssh_command='ssh -c aes128-cbc' ...
1

There are a couple of options you can pass right away: -p PORT (to change the ssh port from the default 22) -C (to specify you want compression)

1
0

TL/DR: For options requiring a path, use absolute paths.

This bit of sshfs' man page suggest that it should just work fine with -o:

  -o SSHOPT=VAL
         ssh options (see man ssh_config)

However, I had troubles passing in a certificate file with -o CertificateFile=path/to/cert. It turns out that it only works with an absolute path to the certificate file, while plain ssh happily accepts a relative path.

2
  • Would the downvoter care to explain?
    – jlh
    Jul 29, 2021 at 12:16
  • Apparently that was me, and I don't remember doing it. If you make a bogus edit the site will let me withdraw the downvote.
    – Wilmer
    Aug 28, 2021 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .