| SSH Tips and Tricks |
|
|
|
| How To - SSH | |
| Written by Christian Foronda | |
| Saturday, 09 April 2011 05:13 | |
|
Create and transfer SSH public key then login to remote machine in one step: $ ssh-keygen; ssh-copy-id user@remotehost; ssh user@remotehost
Copy ssh keys to remote host to enable password-less ssh logins: $ ssh-copy-id user@remotehost
Start a tunnel from remote machine’s port 80 to your local port 8888: $ ssh -N -L8888:localhost:80 remotemachine
Compare a remote file with a local file: $ ssh user@remotehost cat /path/to/remotefile | diff /path/to/localfile -
SSH connection through host in the middle: $ ssh -t reachable_host ssh unreachable_host
Copy from host1 to host2, through your host: $ ssh root@host1 "cd /somedir/tocopy/ && tar -cf - ." | ssh root@host2 "cd /samedir/tocopyto/ && tar -xf -"
Run any GUI program remotely: $ ssh -fX <user>@<remotehost> <program> X11Forwarding should be set to "yes".
Attach screen over ssh: $ ssh -t remote_host screen -r
Have an ssh session open forever: $ autossh -M50000 -t remotehost 'screen -raAd mysession'
Similar articles
|


