Tuesday, March 3, 2015

Remotely Access RPi with Linux via SSH


I'll be using Ubuntu as my Linux distro, and to remotely access our RPi, we'll be using a utility called Putty. Keep in mind your computer and the RPi have to be connected to same network. Open up your terminal using CTRL+ALT+T and type the following in:

sudo apt-get update && sudo apt-get upgrade

If you're running this for the first time, then this will take a while. Grab a cuppa while this runs. Next we'll install Putty, our SSH client.

sudo apt-get install putty

Now let's get our RPi running. Put your SD card into the slot below, and plug in your ethernet cable, and the power cable. Wait for your RPi to boot up. This should take a minute, tops. All your on-board LED lights should be active now.


Now what we're going to do is assign a static IP to your RPi, so that we don't have to manually check each time we connect or reboot out RPi. Navigate to your router's config page. For me, it's 192.168.0.1. If you have a doubt about what the router config IP is for your router, Google your router model.


Enter the login credentials, and go to Network -> LAN -> DHCP Client. Look at the list of devices currently connected to your router, and you should see your RPi.


Look at the hostnames of all devices, and your RPi should be raspberrypi in the list. Copy the MAC Address and IP address of your RPi, and go to DHCP Reservation.



 Paste down the MAC Address, and paste the IP that your RPi was assigned in the DHCP Client page, and name it whatever you want. Click add, and you're good to go. Congratulations, your RPi is now a permanent addition to your network team!


Next open up Putty, and type in the IP that you assigned to it in the DHCP Reservation page.



A terminal window should pop up, and the default username is "pi", and the default password is "raspberry" (without the quotes) .



You now have access to your RPi.


Keep in mind, most (if not all) commands have to be performed as superuser, i.e, using sudo.Now, type the following in.


sudo raspi-config

This opens up the configuration tool. You can change the user password now if you want to. I'd recommend choosing something short, for ease of typing. Navigate using your keyboard. Now, select Expand Filesystem. Hit enter once its done.




Now, back at the main config page, hit the right arrow key, and select Finish. The tool asks you to reboot, select Yes hit enter. You will now lose connectivity with your RPi. 


Now, open up Putty again and enter the RPi IP once again, and enter the login credentials. Now type the following code in to get your RPi up to date. This should take a while to complete.

sudo apt-get update && sudo apt-get upgrade

Congratulations! You now have successfully set up your RPi and you're free to tinker with it.

No comments:

Post a Comment