Difference between revisions of "Autossh"

From Gentoo Wiki
Jump to: navigation, search
m (use command formatting)
m (Removing "-C" since it duplicates compression=yes)
Line 43: Line 43:
 
'''3) Use autossh with sshfs'''
 
'''3) Use autossh with sshfs'''
  
sshfs -o reconnect,compression=yes,transform_symlinks,ServerAliveInterval=45,ServerAliveCountMax=2,ssh_command='autossh -M 0' -C username@server:/ /mnt/remote"
+
sshfs -o reconnect,compression=yes,transform_symlinks,ServerAliveInterval=45,ServerAliveCountMax=2,ssh_command='autossh -M 0' username@server:/ /mnt/remote"

Revision as of 05:12, 1 May 2012

Benefits

Detects when SSH connections drop and auto-reconnects.


Install...

root # emerge -av net-misc/autossh

(there are no USE flags for this package)


Basic Instructions

These are available at the autossh website and its README file:


Important Tips

The "-M" option is required, even if you don't want to use the monitoring option (in which case, use "-M 0").

When using "-M"...

  • Connections are tunnelled. No firewall changes needed for autossh's monitoring feature.
  • Ports need to be above 1024 if you are not logging in as root.
  • If you use a password prompt, then autossh will wait for your password when it reconnects, and it won't be fully connected until you give that password. So, it's helpful to use a key (instead of password) and ssh-agent.


Examples

1) Simple login example:

user $ autossh -M 0 username@myserver


2) More Complex Example. SSH on port 222. Setup a SOCKS proxy on port 9999. Using "ServerAliveInterval" and "ServerAliveCountMax" as recommended in the autossh README file.

user $ autossh -M 0 -p 222 -N -D 9999 -o "ServerAliveInterval 45" -o "ServerAliveCountMax 2" username@myserver


3) Use autossh with sshfs

sshfs -o reconnect,compression=yes,transform_symlinks,ServerAliveInterval=45,ServerAliveCountMax=2,ssh_command='autossh -M 0' username@server:/ /mnt/remote"

Personal tools
Namespaces

Variants
Actions
Gentoo Websites logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Navigation
Toolbox
Categories