Index

SSH

SSH connections keep alive:
sudo vi /etc/ssh/ssh_config
ServerAliveInterval 60
connect to remote server
ssh [user]@example.com
connect on a different port
ssh -p 62775 [user]@example.com
invoke a local script on the remote server
ssh user@server '/tmp/script.sh'
execute remote command
ssh -t user@example.com "sudo /opt/scripts/doSomething.sh magic"
use ssh connection as a socks proxy
ssh -D [local_port] [user]@[host]
use ssh connection as a socks proxy no shell
ssh -N -D [local_port] [user]@[host]
forward local port to specified remote port on host
sudo ssh -L [local_port]:localhost:[remote_port] [user]@[host]
forward local port to specified remote port on host no shell
sudo ssh -N -L [local_port]:localhost:[remote_port] [user]@[host]

secure copy (scp)

copy file to remote
scp /tmp/file.zip yourdomain.com:/path/to/file.zip
copy remote directory
scp -r [user]@example.com:/data/upload /data/
connect to a different port
scp -P 62775 [from] [to]

running ssh commands on multiple hosts at once (untested & needs arguments)

parallel-ssh

mounting remote filesystems

mounting a remote directory onto the local filesystem
sshfs [user]@[host]:[remote_path] [mountpoint]
unmounting the remote directory
umount [mountpoint]