shellspells beta

ssh

ssh      [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D  [bind_address:]port]
         [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-L
         [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd]
         [-o option] [-p port] [-R  [bind_address:]port:host:hostport] [-S ctl_path]
         [-W host:port] [-w local_tun[:remote_tun]] [user@]hostname [command]

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.

Where do we start with ssh? To the uninitiated it may seem like just a secure version of telnet or rlogin, but it is so much more than that. It's probably the most powerful tool in any hackers arsenal. As well as making logging into and using remote machines secure it also allows port forwarding through those machines. It can bypass firewalls, act as a proxy, provide secure tunnels and much, much more.

Examples

Connect to a remote machine

$ ssh garry@nostramo

Use a different port

$ ssh -p9999 garry@nostramo

Log in without a password. This can be done by generating a public/private key pair and copying the public key to the remote machine.

# Generate the key pair. These can be used to log into multiple machines.
$ ssh-keygen -t rsa

# Copy to remote server
scp ~/.ssh/id_rsa.pub loki:

# On remote server
$ mkdir .ssh
$ chmod 700 .ssh
$ cat id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 0600 ~/.ssh/authorized_keys
$ rm id_rsa.pub

# On Client
$ ssh loki

Change an SSH key passphrase

$ ssh-keygen -f id_rsa -p

Use netcat to hop through one box to another

# In your .ssh/config file
# connect to box2 via box1
Host box2
  ProxyCommand ssh box1 nc box2 22