SSH Command

To ssh via pem file

ssh -i /path/to/file.pem user@example.com

To connect on an non-standard port:

ssh -p 2222 user@example.com

To connect and forward the authentication agent

ssh -A user@example.com

To execute a command on a remote server:

ssh -t user@example.com 'the-remote-command'

To tunnel an x session over SSH:

ssh -X user@example.com
  • Redirect traffic with a tunnel between local host (port 8080) and a remote
  • host (remote.example.com:5000) through a proxy (personal.server.com):
ssh -f -L 8080:remote.example.com:5000 user@personal.server.com -N

To launch a specific x application over SSH:

ssh -X -t user@example.com 'chromium-browser'

To create a SOCKS proxy on localhost and port 9999

ssh -D 9999 user@example.com

-X use an xsession, -C compress data, “-c blowfish” use the encryption blowfish

ssh user@example.com -C -c blowfish -X

Copy files and folders through ssh from remote host to pwd with tar.gz compression. when there is no rsync command available

ssh user@example.com "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf -
Ce site web utilise des cookies. En utilisant le site Web, vous acceptez le stockage de cookies sur votre ordinateur. Vous reconnaissez également que vous avez lu et compris notre politique de confidentialité. Si vous n'êtes pas d'accord, quittez le site.En savoir plus