After seeing how easy it was to connect remotely to my Rasberry Pi I thought the process should be quite similar for any linux machine.
SSH: (Secure Shell)
All I had do do was install an SSH server:
    sudo apt-get install ssh
I could then get the internal ip using:
    ifconfig

 

 

in my case the ip was 10.13.37.99
I could then go to my other linux machine and ssh into it:
    ssh felix@10.13.37.99

 

 

You can now execute commands as if you were on the remote computer. Maybe you want to create a binary file using nano or a folder using mkdir.
I found I could also run my pygame remotely albeit with ascii graphics:

 

 

SCP: (Secure Copy)
Something I thought would be quite useful would be to copy files over from the remote computer. To do this I found the scp (secure copy) command.
You use it in a similar way to cp, but you can reference files on a remote computer. for example if I wanted to copy a file from a remote computer I could use:
    scp felix@10.13.37.50:~/Pictures/ssh.png ssh_cp.png
Note the colon after the ip address followed by the directory of the file on the remote computer.
If I wanted to copy an entire directory I need to use the recursive parameter:
    scp -r felix@10.13.37.50:~/Desctop/name\ with\ space/ ssh_cp.png
also note the inverted commas that are required around a directory with spaces.

 

 

VNC: (Virtual Network Computing)
This will allow us to ‘remote desktop’ into the computer, providing us with a more friendly gui.
We need to start by installing a vnc server on the target mahine. You can install the TightVNC desctop client using the following command:
    sudo apt-get install tightvncserver
You well then need to create the server by running TightVNC using the following command:
    tightvncserver
You will need to create a password. I didn’t bother with enabling view-only.

 

 

On the computer you want to connect from you will need to install a vnc viewer:
    sudo apt-get install xtightvncviewer
You can now vnc to the remote computer:
    xtightviewer 189.234.53:1
Remember to add the colon followed by the desktop/display number.

 

 

The only real downside with what we have done is that we have to restart the server on the target machine each time the computer starts up. Fortunately we can start the server automatically. To do this we will need to create a configuration file on the target:
    sudo nano /etc/init.d/tightvnc
Or, perhaps use gedit allowing you to copy-paste.

Enter the following (stolen from here):

span { font-family: ‘Courier New’; font-size: 10pt; color: #000000; } .sc0 { } .sc2 { color: #008000; } .sc3 { color: #FF0000; } .sc4 { font-weight: bold; color: #0000FF; } .sc7 { font-weight: bold; color: #804000; } .sc8 { } .sc9 { font-weight: bold; color: #FF8040; background: #FFFFD9; }

#!/bin/sh ### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start vnc server # Description: ### END INIT INFO case$1″ in start) su felix -cvncserver :1 geometry 1600x900 depth 16 pixelformat rgb565:’ echoVNC Started;; stop) pkill Xtightvnc echoVNC Terminated;; *) echoUsage: /etc/init.d/tightvnc {start|stop}” exit 1 ;; esac

 

Edit the file as necessary and then save (NOTE: you will probably need to fix all the quotation marks. The ‘x’ in the resolution was also incorrect when I copied from elsewhere). You will then need to change the permissions of the file so that it is executable:
    sudo chmod +x /etc/init.d/tightvnc
Now that the initialisation file is executable we can test it out. Try:
    sudo /etc/init.d/tightvnc stop     (to stop the server)
and,
    sudo /etc/init.d/tightvnc start    (to start the server)
The last thing we need to do is update the rc.d file (“which tracks which initialisation scripts are in the /init.d/ folder”):
    sudo update-rc.d tightvnc defaults
That’s it! The vnc server should now start automatically when linux starts. You can test it out by restarting the target. Note that you can do this other computer by restarting with the vnc or ssh’ing in and use:
    sudo reboot
Note:
To use theses methods over the internet probably requires the router to be configured for port forwarding (default port is 22). I haven’t actually done this.
Advertisements