Difference between revisions of "Enable SSH"

From SingletonMillerWiki
Jump to: navigation, search
(Created page with " In the debian build enabling SSH is easy, simply <pre> sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc sudo service ssh start </pre> == Access the RPI via SSH == Having secure r...")
 
(Forwarding the X terminal)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
[[Category: RaspberryPi]]
 
In the debian build enabling SSH is easy, simply
 
In the debian build enabling SSH is easy, simply
 
<pre>
 
<pre>
Line 9: Line 9:
 
Having secure remote access to your RPi means you can access it for any computer on your network or if you configure your router properly from any computer via the internet.
 
Having secure remote access to your RPi means you can access it for any computer on your network or if you configure your router properly from any computer via the internet.
  
If you do want to access the RPi via the internet, make sure you at least [[Setup:RPI#Change_Default_Password]] and ideally [[AddingUsers:RPi]].
+
If you do want to access the RPi via the internet, make sure you at least [[Setup:RPI#Change_Default_Password]] and ideally [[AddingUsers:RPi]] in order to prevent unauthorised access.
 +
 
 +
=== Connect via SSH on a Local network ===
 +
This is best done via another linux box (assumed here). or you can use [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Putty under Windows]].
 +
 
 +
From a Linux terminal code
 +
<pre>
 +
ssh jack@192.168.0.20
 +
</pre>
 +
remember to change the username and IP address of to match those of our RPi!
 +
 
 +
The first time you do this you'll probably be presented with something like this.
 +
<pre>
 +
The authenticity of host '192.168.0.20 (192.168.0.20)' can't be established.
 +
RSA key fingerprint is 26:a4:a1:aa:c2:ff:50:99:d7:e1:49:6a:f2:90:fb:90.
 +
</pre>
 +
 
 +
type <code> yes</code> and press return to authorise the ssh key as valid and save it for the future.
 +
 
 +
You should be presented with a password prompt like
 +
 +
<pre>
 +
jack@192.168.0.20's password:
 +
</pre>
 +
 +
Enter the password and, you're in!
 +
 
 +
=== Forwarding the X terminal ===
 +
you may need to check that the following line is in your <code>/etc/ssh/sshd_config</code> file:
 +
<pre>AllowX11Forwarding              yes</pre>
 +
 
 +
then simply start the ssh session with the <code>-X</code> option.
 +
<pre>
 +
ssh –X user@192.168.0.20 &
 +
</pre>
 +
 
 +
=== Trouble shooting SSH ===
 +
 
 +
If you get messages saying "No route to host", then check the ip address is valid using
 +
<pre>
 +
ping 192.168.0.20
 +
</pre>
 +
 
 +
if the address isn't found then your local PC can't find the RPi.
 +
Things to check
 +
# IP address on the RPi, login locally and type <code> hostname -I </code>. This should give you the IP address of the RPi.
 +
# Check the IP and netmask of your PC, make sure they are on the same subnet see [http://en.wikipedia.org/wiki/Subnetwork] for more information.
 +
# Consider setting up a static IP address for your RPi [[Static_IP_Config]]

Latest revision as of 04:22, 1 July 2012

In the debian build enabling SSH is easy, simply

sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc
sudo service ssh start

Access the RPI via SSH

Having secure remote access to your RPi means you can access it for any computer on your network or if you configure your router properly from any computer via the internet.

If you do want to access the RPi via the internet, make sure you at least Setup:RPI#Change_Default_Password and ideally AddingUsers:RPi in order to prevent unauthorised access.

Connect via SSH on a Local network

This is best done via another linux box (assumed here). or you can use [Putty under Windows].

From a Linux terminal code

ssh jack@192.168.0.20

remember to change the username and IP address of to match those of our RPi!

The first time you do this you'll probably be presented with something like this.

The authenticity of host '192.168.0.20 (192.168.0.20)' can't be established.
RSA key fingerprint is 26:a4:a1:aa:c2:ff:50:99:d7:e1:49:6a:f2:90:fb:90.

type yes and press return to authorise the ssh key as valid and save it for the future.

You should be presented with a password prompt like

jack@192.168.0.20's password:

Enter the password and, you're in!

Forwarding the X terminal

you may need to check that the following line is in your /etc/ssh/sshd_config file:

AllowX11Forwarding              yes

then simply start the ssh session with the -X option.

ssh –X user@192.168.0.20 &

Trouble shooting SSH

If you get messages saying "No route to host", then check the ip address is valid using

ping 192.168.0.20

if the address isn't found then your local PC can't find the RPi. Things to check

  1. IP address on the RPi, login locally and type hostname -I . This should give you the IP address of the RPi.
  2. Check the IP and netmask of your PC, make sure they are on the same subnet see [1] for more information.
  3. Consider setting up a static IP address for your RPi Static_IP_Config