In this QuickTip I’ll show you how to connect your database client directly on server, without open doors. This trick is nice because you can open a ssh tunnel between your machine and any server, connect on localhost and see the remote data, this is useful specially if you don’t want to use terminal. If you execute this script, a tunnel will be closed between your machine and the other one “change <USER ON SERVER> <SERVER IP>” after that, you just need to connect on localhost:3333
if test $1 <> null
ssh -L $var:localhost:27017 -l <USER ON SERVER> <SERVER IP>
In this gif, I’m connection on localhost:3333 but accessing a database on a remote server. If you want to see better, just click over the image. Just it, you have the same benefit of leaving the door open, but safely.