sshfs LocalForward without config file

tiMbeRdroP

I'm trying to add portforwarding to my sshfs-mount-scripts:

sshfs tim@devserver1:/ /home/tim/mnt/devserver1/ 
-o SSHOPT=LocalForward 127.0.0.5:3306 127.0.0.1:3306

So far I've failed using the correct syntax. Using brackets or commas instead of spaces did not work.

Stéphane Chazelas

Unfortunately, that is not possible with -o. The list of ssh options supported by sshfs can be found in the source code:

static const char *ssh_opts[] = {
        "AddressFamily",
        "BatchMode",
        "BindAddress",
        "ChallengeResponseAuthentication",
        "CheckHostIP",
        "Cipher",
        "Ciphers",
        "Compression",
        "CompressionLevel",
        "ConnectionAttempts",
        "ConnectTimeout",
        "ControlMaster",
        "ControlPath",
        "GlobalKnownHostsFile",
        "GSSAPIAuthentication",
        "GSSAPIDelegateCredentials",
        "HostbasedAuthentication",
        "HostKeyAlgorithms",
        "HostKeyAlias",
        "HostName",
        "IdentitiesOnly",
        "IdentityFile",
        "KbdInteractiveAuthentication",
        "KbdInteractiveDevices",
        "LocalCommand",
        "LogLevel",
        "MACs",
        "NoHostAuthenticationForLocalhost",
        "NumberOfPasswordPrompts",
        "PasswordAuthentication",
        "Port",
        "PreferredAuthentications",
        "ProxyCommand",
        "PubkeyAuthentication",
        "RekeyLimit",
        "RhostsRSAAuthentication",
        "RSAAuthentication",
        "ServerAliveCountMax",
        "ServerAliveInterval",
        "SmartcardDevice",
        "StrictHostKeyChecking",
        "TCPKeepAlive",
        "UsePrivilegedPort",
        "UserKnownHostsFile",
        "VerifyHostKeyDNS",
        NULL,
};

If it were supported, the syntax would be sshfs -o 'LocalForward=....'

In addition, sshfs passes the -oClearAllForwardings=yes option, so even the forwarding defined in ~/.ssh/config are not honoured.

Since sshfs supports passing a ssh_command, and allows additional arguments there, what you can do instead is:

CODE='
  for i do
    [ "$i" = -oClearAllForwardings=yes ] &&
      i="-oLocalForward=127.0.0.5:3306 127.0.0.1:3306"
    set -- "$@" "$i"
    shift
  done
  exec ssh "$@"
' sshfs -o ssh_command='/bin/sh -c eval\\ "$CODE" sh' user@host:/path mnt

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to parameterize the LocalForward option in ssh_config?

From Dev

Can not connect through sshfs because a wrong configuration at ~/.ssh/config file

From Dev

Release build without config file

From Dev

sshfs - No such file or directory

From Dev

sshfs 'no such file' error

From Dev

open remote (ssh) file locally via comand line (without installing sshfs)

From Dev

sshfs mount without compression or encryption

From Dev

TraceSource - set autoflush to true without config file?

From Dev

Entity framework 6 without config file?

From Dev

Host WCF service without config file

From Dev

TraceSource - set autoflush to true without config file?

From Dev

Using Config::Simple to read MySQL config file with keys without values

From Dev

sshfs will not use ~/.ssh/config (on Linux Mint 15)

From Dev

sshfs will not use ~/.ssh/config (on Linux Mint 15)

From Dev

Mount with sshfs and write file permissions

From Dev

take changes in file sshd_config file without server reboot

From Dev

Update the sys.config file without restarting node

From Dev

How to config "CommonsMultipartResolver" in spring4 without xml to upload file

From Dev

Reading secret config file on Heroku without using env vars

From Dev

Entity Framework 6 SQL Server Compact 3.5 without Config file

From Dev

What does 'without password' mean in sshd_config file?

From Dev

Reading secret config file on Heroku without using env vars

From Dev

Reload nginx RTMP config file without restarting nginx

From Dev

Ansible: Add a stanza to .ssh/config without overwriting the file

From Dev

How do I specify the key file for sshfs?

From Dev

How to access /proc/ file (procfs) via SSHFS

From Dev

Mount a file instead of directory using sshfs?

From Dev

How to use oslo_config to load config file only without register_opts?

From Dev

How to use oslo_config to load config file only without register_opts?

Related Related

  1. 1

    How to parameterize the LocalForward option in ssh_config?

  2. 2

    Can not connect through sshfs because a wrong configuration at ~/.ssh/config file

  3. 3

    Release build without config file

  4. 4

    sshfs - No such file or directory

  5. 5

    sshfs 'no such file' error

  6. 6

    open remote (ssh) file locally via comand line (without installing sshfs)

  7. 7

    sshfs mount without compression or encryption

  8. 8

    TraceSource - set autoflush to true without config file?

  9. 9

    Entity framework 6 without config file?

  10. 10

    Host WCF service without config file

  11. 11

    TraceSource - set autoflush to true without config file?

  12. 12

    Using Config::Simple to read MySQL config file with keys without values

  13. 13

    sshfs will not use ~/.ssh/config (on Linux Mint 15)

  14. 14

    sshfs will not use ~/.ssh/config (on Linux Mint 15)

  15. 15

    Mount with sshfs and write file permissions

  16. 16

    take changes in file sshd_config file without server reboot

  17. 17

    Update the sys.config file without restarting node

  18. 18

    How to config "CommonsMultipartResolver" in spring4 without xml to upload file

  19. 19

    Reading secret config file on Heroku without using env vars

  20. 20

    Entity Framework 6 SQL Server Compact 3.5 without Config file

  21. 21

    What does 'without password' mean in sshd_config file?

  22. 22

    Reading secret config file on Heroku without using env vars

  23. 23

    Reload nginx RTMP config file without restarting nginx

  24. 24

    Ansible: Add a stanza to .ssh/config without overwriting the file

  25. 25

    How do I specify the key file for sshfs?

  26. 26

    How to access /proc/ file (procfs) via SSHFS

  27. 27

    Mount a file instead of directory using sshfs?

  28. 28

    How to use oslo_config to load config file only without register_opts?

  29. 29

    How to use oslo_config to load config file only without register_opts?

HotTag

Archive