Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SSH Tips and Tricks

Some handy SSH tips:


Tunnel your remote machine's POP port to your local machine so you can pop your mail without passing your username/password in the clear:


ssh -f 'sleep 30 &'


This will make a tunnel from machine's port 110 to your local machine's port 9000. Point your mail client or fetchmail to localhost port 9000 and pop away. The connection will close and go away when your pop session ends so this setup is a one time thing. The "sleep 30 &" will keep the connection open for 30 seconds to give you a chance to start your pop session.


To setup a tunnel for nntp (usenet) that will stay up until you kill it:


ssh -N -f


This will create a tunnel from your machine to and from there, open a non-encrypted connection to your news server ( The -N and -f options start a non-terminal connection and puts the process in the background. I use this connection because my isp only allows connections to the news server from the isp's network. In the above example, would be a machine on my isp's network that is allowed to connect to the news server. The example above only allows access from the local machine's loopback address. (ie., localhost). If you want other machines to also be able to use the tunnel, you can add the "-g" option to the command and they will be able to direct a connection to port 9000 on your local machine to access the news server.




Assume you have a machine inside a firewall with no access from the external network and you want to be able to ssh into this machine from your home machine to finish the job you are working on. The following example shows one way to accomplish this.


ssh -N -f


on the remote machine, start a ssh connection like this:


ssh -p 9000 localhost


and you will initiate a session back to the internal machine.



Some good SSH links:


AUUG Winter 2002

SSH tips, tricks and protocol tutorial



Secure Shell - Tips & Tricks

* X11 Forwarding

* Seamless Authentication

* TCP Port Forwarding


SSH Tips

* X11 Forwarding

* Authentication


SSH Tips and Tricks

* Security

* tcp forwarding

* X-Windows

* Config File Problems

* SSH over SMB





Have fun.




Forum Jump:

Users browsing this thread: 1 Guest(s)