Difference between revisions of "SSH"

From DiLab
Jump to: navigation, search
(Tunneling between any two ports)
Line 4: Line 4:


In short:
In short:
$ssh -D 9999 username@ip-address-of-ssh-server
ssh -D 9999 username@ip-address-of-ssh-server
Then set in Firefox to use a SOCKS proxy: “localhost", port 9999
# Then set in Firefox to use a SOCKS proxy: “localhost", port 9999




Line 12: Line 12:
Say, you want to read a remote server web page, but there is only ssh port open on the server. If you have a valid user account to the server, then you can create a tunnel, like this:
Say, you want to read a remote server web page, but there is only ssh port open on the server. If you have a valid user account to the server, then you can create a tunnel, like this:


$ ssh -f user@server.com -L 8080:server.com:80 -N
ssh -f user@server.com -L 8080:server.com:80 -N


Now you can enter the following in your browser: http://server.com:8080
Now you can enter the following in your browser: http://server.com:8080
Line 18: Line 18:
Or in general, -f means sit in background and -N menas do not execute any command:
Or in general, -f means sit in background and -N menas do not execute any command:


$ ssh -f user@server.com -L my-local-port:server.com:server-port -N
ssh -f user@server.com -L my-local-port:server.com:server-port -N


== Removing a key from the known hosts file ==

Note, you may run this for the hostname of the "old" computer and for the IP address.

ssh-keygen -R hostname

Revision as of 22:12, 27 April 2012

Tunneling to socks proxy

From here: ssh-tunnel-socks-proxy

In short:

ssh -D 9999 username@ip-address-of-ssh-server
# Then set in Firefox to use a SOCKS proxy: “localhost", port 9999


Tunneling between any two ports

Say, you want to read a remote server web page, but there is only ssh port open on the server. If you have a valid user account to the server, then you can create a tunnel, like this:

ssh -f user@server.com -L 8080:server.com:80 -N

Now you can enter the following in your browser: http://server.com:8080

Or in general, -f means sit in background and -N menas do not execute any command:

ssh -f user@server.com -L my-local-port:server.com:server-port -N


Removing a key from the known hosts file

Note, you may run this for the hostname of the "old" computer and for the IP address.

ssh-keygen -R hostname