mardi 12 octobre 2010

SSH use for distant office

Make things automatic

When I am at home, I usually need remote access to my servers at work, to check some documents or to fill some data on our CRM. We are using openssh access to do remote maintenance of our products so I decide to provide that for remote access from home.

The idea is to make most of the configuration automatic so I have wrote a configuration file for that (~/.ssh/config).

Host job
User jeanpul
Port 999
LocalForward *:8080
ControlMaster yes

With this configuration file, using the following command

ssh job 

open a SSH connection to on port 999 and then gives access to the Web server of the distant machine on the local port 8080.

Browse your Intranet without URL redirection problems

So, then I reach the office Intranet network using the http://localhost:8080/ but all the absolute URL cannot be reached. So URL's like :

<a href="/PHPMyAdmin/index.html">PHPMyAdmin</a>

works because it's leads to http://localhost:8080/PHPMyAdmin/index.html but

<a href="">PHPMyAdmin</a>

failed because have no meaning locally.

The solution I used was to install and configure a Web proxy. I used privoxy with the following configuration part

forward    localhost:8080
 forward localhost:8080

Then I configure my browsers to use this proxy and URLs such as

are correctly managed.

Removing password input

I have configured my SSH server to support remote connexion using private/public key so I never enter the user password anymore.

To do so, I have generated a private/public key :

ssh-keygen -t rsa

Then, I have copied the public part to the SSH user on the remote access :

ssh-copy-id -i ~/.ssh/

Aucun commentaire:

Enregistrer un commentaire