Difference between revisions of "RPi A Method for ssh blind login"

From eLinux.org
Jump to: navigation, search
m (The Router/Hub address)
m (The Router/Hub address)
Line 17: Line 17:
 
The primary computer will probably use 2 giving it the address of 192.168.0.2 and the then the later ones will follow in sequence.   
 
The primary computer will probably use 2 giving it the address of 192.168.0.2 and the then the later ones will follow in sequence.   
  
For example I happen to know that a "Zoom X6 ADSL Router" uses an address of 10.0.0.2 so a Warning here if the method using 192.168.0.x does not work and your router/hub is not Virginmedia or Netgear or some other re-badged Netgear then its likely that your router IP addresses lie in some other range.  You may have to resort to reading the manual (shock horror)for your router/hub.
+
For example I happen to know that a "Zoom X6 ADSL Router" uses an address of 10.0.0.2 so a Warning here if the method using 192.168.0.x does not work and your router/hub is not Virginmedia or Netgear or some other re-badged Netgear then its likely that your router IP addresses lie in some other range.   
 +
 
 +
You may have to resort to reading the manual (shock horror)for your router/hub.
  
 
Using a wrong address is highly unlikely to damage your hardware, this is mor akin to dialing a non existent number on your telephone (you just will not get an answer).   
 
Using a wrong address is highly unlikely to damage your hardware, this is mor akin to dialing a non existent number on your telephone (you just will not get an answer).   

Revision as of 02:58, 27 June 2012

Method for blind ssh login

This wiki page describes a method for logging into a fresh out of the packet RaspberryPi when the user has a Networked computer but no suitable monitor for the RPi

This example uses and recommends Putty as the client software this is by no means the only available ssh client. It is however freely available on line for a wide range of operating systems, is open source and happens to be the one I have used.  :)

In the example quoted the student was using a "Virginmedia Super Hub model number VMDG-480"

The Router/Hub address

It appears that this Virginmedia Hub is a re-badged Netgear so like most (note not all) Netgear routers/hubs the DHCP embedded in the router/hub software should issue IP addresses that follow this pattern.

192.168.0.x

If this is the case the hub probably uses 1 in place of the x as it's own address. Making the hub address 192.168.0.1

The primary computer will probably use 2 giving it the address of 192.168.0.2 and the then the later ones will follow in sequence.

For example I happen to know that a "Zoom X6 ADSL Router" uses an address of 10.0.0.2 so a Warning here if the method using 192.168.0.x does not work and your router/hub is not Virginmedia or Netgear or some other re-badged Netgear then its likely that your router IP addresses lie in some other range.

You may have to resort to reading the manual (shock horror)for your router/hub.

Using a wrong address is highly unlikely to damage your hardware, this is mor akin to dialing a non existent number on your telephone (you just will not get an answer).

Given a choice of operating systems for hosting the Putty client I prefer Windows XP and Ubuntu followsd by almost any other Linux distro before resorting to Vista or Windows7 purely on grounds of ease of instalation.

If you have putty installed on a Windows7/Vista machine go ahead and use it (my concerns only relate to getting it installed and running)

Get Putty ready

This is a screen shot of a Windows XP Putty login screen but the Ubuntu and other versions are not that different.

Putty.png

Hardware connections.

You will need to your RPi connected to your router/hub with a 10baseT (ethernet) patch lead.

If you want to connect using a wi-fi connection for the RaspberryPi thats a whole other ball game and will require it's own Wiki page.

You will need your Wheezy imaged SD card inserted and then power up the RPi.

On your RPi next to the usb sockets there's a set of tiny led's wait till you have at least a steady yellow two greens and a red this may not be essential but I'm sure it's good practice.

Ready to start.

Ok go to your putty screen as shown above and type in 192.168.0.3 leave the port address of 22 as it is. It may be worth mentioning if you have managed to connect other devices to your router/hub for example smart phones the last digit will probably be 2 more than the number of existing devices. Be prepared to try other values.

Make sure the radio button SSH is selected

In saved Sessions type in RaspberryPi (you can type anything you like here but RaspberryPi seems sensible) Also select the radio button for "Only on clean exit" (not essential but again a reasonable choice)

Click the save button that will just give you a shortcut to those settings your putty should look like the image.

Click Open

If you get a terminal window and the following warning screen that means you have the connection if you click "yes" it will be the last time you see this warning unless you re-image the SD card.

Putty security Alert.png

If you do not see the warning and the connection times out try other values for the last digit don't go wild it's unlikely a home user will have a lot of wi-fi connections.

Ok if you have this right the line Login: will appear in the terminal window. enter pi and wit till it asks for a password then type raspberry

If your screen then looks like this (numbers and codes will probably differ) you have been sucessfull

Logged in.png

Like I say you may need to experiment with changing the last digit in the sequence 192.168.0.x if you only have an Ubuntu computer and a Windows7 PC connected then 4 is the most likely but if you have smart phones picking up wi-fi from your Hub look at it being two more than the number of devices connected (remember the hub itself is number 1) Timed out connections probably mean you have the wrong address and obviously you are looking for the next free number. Don't forget the RPi may even be using 0,1 or 2 if you get a windows style pop up window and pi as a login and raspberry as a password do not work you may actually be trying to log into the router.

make a note of the following commands

sudo su
shutdown -h -H now


These are the two commands you want to use to do a safe shut down and you will not want these till you have a login as shown on the previous screen shot.

Try not to kill the power at the RPi end as you will be wearing out the socket.

I use a USB connection lead for a phone and I connect to either the PC or one of those cute plugtops with a USB socket so if I am powering down I unplug at the USB end not the MicroUSB end.

If you have run the shutdown command give it a minute before you kill power as it looses the ssh connection before it has acctually shut down.

I have found that with a HDMI connection this is about 12 seconds give it at least 20 seconds (Engineering estimate ref- Montgomery Scott, StarTrek)

Once you have the third screen shown above ignore the startx command it does start the X window but the output only goes to the composite or HDMI port whichever is connected.

You will not see it on your ssh screen it will lock up because you cannot see the screen to shut it down.

Note you do not need a Mouse or a Keyboard connected to the RPi

Enter the command raspi-config


You will get the menu that I talk about in the wiki (DO NOT TOGGLE ssh It will cut you off) use the up and down arrows to highlight the menu entries and enter to select when you are finished

<Exit>

will drop you back to the command prompt

and

<Ok > 

will reboot

Have fun