Visualizzazione post con etichetta Remote Desktop. Mostra tutti i post
Visualizzazione post con etichetta Remote Desktop. Mostra tutti i post

mercoledì 13 gennaio 2010

Creating a hostname that points to your IP address

If our computer has a dynamic IP, we can create a hostname that points to our IP address. A hostname is very useful because it allows us to use a static name (ie. myname.host.org) instead of a dynamic IP. For example, we can think to use a hostname to contact a remote computer with a dynamic IP address.
There's a very simple way to do that: we can use a free service provided by DynDNS.com:

Redirect your browser here and create an account.
As you can see, "Dynamic DNS Free (DDNS) allows you to create a hostname that points to your home or office IP address, providing an easy-to-remember URL for quick access. We also provide an update mechanism which makes the hostname work with your dynamic IP address. We continue to offer this service free to the Internet community as we have done so for nearly 10 years."
The service is free so click on "Get Started".

Insert a name  and choose a domain from the combobox. Leave "Host with IP address" selected. Insert the remote IP or "use auto detect IP address". Leave "Mail Routing" unchecked.
Now we have to choose the services we would like to use with our hostname: in my case I selected Remote Desktop and SSH.
Click on "Add to cart" and don't worry: the service is free.

As you can see, our cart now contains free services only. We can activate our hostname.
Click on "Next >>" and then on "Activate Services".








Now we have to find a method to inform DynDNS' servers when our remote computer changes the IP address. Fortunately DynDNS allows us to download an update client: "The update client periodically checks your network's IP address; if it sees that your IP address has changed, it sends (updates) the new IP address to your hostname in your DynDNS.com account".

Cool! Redirect you browser here and download the client for your OS.

In my case, i will use the Linux/Unix client. If you have Ubuntu you can follow next steps:

unpack ddclient, run a terminal and type:

 stefano@SERVER:~$ sudo cp ddclient /usr/sbin/
 stefano@SERVER:~$ sudo mkdir /etc/ddclient
 stefano@SERVER:~$ sudo cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
 stefano@SERVER:~$ sudo gedit /etc/ddclient/ddclient.conf

uncomment and use following parameters:

 protocol=dyndns2
 use=web, web=checkip.dyndns.com, web-skip='IP Address'
 server=members.dyndns.org
 login= your_username_at_DynDNS
 password=your_password_at_DynDNS
 your.hostname.org

Now we can run ddclient as a daemon at boot time. Run a terminal and type:

 stefano@SERVER:~$ sudo cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient
 stefano@SERVER:~$ sudo update-rc.d ddclient defaults
 stefano@SERVER:~$ sudo /etc/init.d/ddclient start

Done!
Best regards.

giovedì 7 gennaio 2010

Remote Desktop via Openssh and Putty


I often need to remote control my Ubuntu server with a Windows client. Even if I do very simple operations via Remote Desktop, I prefer to forward my traffic through SSH Secure Shell. The steps to tunneling an insecure connection are very simple.

 SERVER SIDE

Install Openssh Server and ssh. Run a terminal and type:

 stefano@SERVER:~$ sudo apt-get install ssh openssh-server

Generate a pair of public and private keys executing the following commands:

 stefano@SERVER:~$ mkdir ~/.ssh
 stefano@SERVER:~$ chmod 700 ~/.ssh
 stefano@SERVER:~$ ssh-keygen -t rsa -b 2048
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 stefano@SERVER:~$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
 stefano@SERVER:~$ chmod 600 ~/.ssh/authorized_keys

Edit your sshd_config:

 stefano@SERVER:~$ sudo gedit /etc/ssh/sshd_config

Usually I use these settings:

 Port 22
 PermitRootLogin no
 RSAAuthentication yes
 AuthorizedKeysFile %h/.ssh/authorized_keys
 PasswordAuthentication no
 AllowUsers names_of_allowed_users

Copy ~/.ssh/id_rsa to your Windows client.
Enable Remote Desktop clicking on System --> Preferences --> Remote Desktop:


Now let's configure the router. We need to setup port forwarding on your router. To do that, your pc has to have a static IP. For example, you could use 192.168.1.2. Now redirect your browser here, choose your router, then select SSH and follow all steps. At the end you should have something like this:



WINDOWS CLIENT

Download PuTTy and PuTTYgen
PuTTYgen can import the private key generated on the server and save it in a format PuTTy-readable. Run PuTTYgen, then click Conversions --> Import Key:


Now click "Save private key"
Run PuTTy and follow next steps:



HINT: You have to enter 192.168.1.1 if you're in your home/office lan. If you wanna control a remote pc outside your lan, you have to enter an internet IP address. If your remote computer has a dynamic IP, you can evaluate the possibility to create a hostname that points to your IP address.



Now go back to "Session" and save this setup, then click "Open". Log in with your username and enter the password you have chosen for your private key.

Last thing to do: you need to download a VNC viewer to controll your remote desktop. I really like TightVNC.  Download Viewer executable only and run it:


Insert 127.0.0.1 as VNC Server and click "Connect"

 Enter the password you have choosen for your Remote Desktop

 

Voilà! You can control your remote computer. You can save the connection info not to repeat the last steps.


Click Yes, choose a path to store the informations and create a link on your desktop.

That's all!