Thursday, November 5, 2009

ssh cheat sheat

Allot of stuff i do involves ssh, in fact if i had to choose it would be 'ssh > vpn' .. so awhile ago when i was still learning i wrote this up to help me remember it all.

ssh uname@hostorip.com -p 22
will get you connected to your sshd box

ssh uname@hostorip.com ls
will run the command "ls" once you login on your sshd box

ssh -L 8080:google.com:80 uname@hostorip.com
will tunnel port 8080 on YOUR pc to port 80 at google.com through your remote box running sshd

ssh -R 8080:localhost:80 uname@hostorip.com
will redirect port 8080 on your sshd box to port 80 on your sshd box "great if you want to host a site and mask it with your remote"

ssh -D 2000 uname@hostorip.com
will create a socks5 proxy on your local box and tunnel all traffic through your sshd box "its a great web proxy"

ssh -D 192.168.1.100:2000 uname@hostorip.com
will bind the socks5 to whatever address you give it rather than the default local host, this is nice so you can access it from other comps in your internal net "also the -R and -L flags work the same way"

scp /root/textfile.txt uname@hostorip.com:/root/newtextfile.txt
this will transfer textfile to your sshd box

scp -r /root/directory uname@hostorip.com:/root/newnewdir
this will transfer a whole directory

scp uname@hostorip.com:/root/testfile.txt /root/newtext.txt
this will transfer testfile from the sshd box to yourself

ssh -X uname@hostorip.com
will forward any X window over ssh, once your in just do "startx"

And with that i should probably start writing my ssh guide that ive been meaning to do.

No comments:

Post a Comment