Putty
Having you raspi all set up, working like a charm, hidden somewhere under TV set. But every modification or correction means plugging keyboard, occupying tv and writting all commands by yourself. But hey! there is something you might be interested in. Putty.
PuTTY is a free and open source terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console client. The name “PuTTY” has no definitive meaning,[1] though “tty” is the name for a terminal in the Unix tradition, usually held to be short for Teletype.Source:Wikipedia
Every major distribution come with SSH enabled, so using Putty is a very convenient way of access to the terminal. Basically all you need is raspi and and a PC connected to same local network.
For now for security reasons I won’t show you how to setup to get a SSH connection from outside of local network as I didn’t test it yet. There are some plans to use this feature in future but let’s keep it between us ;)
When raspi is connected to your router it have its own IP address, if you don’t know it you can use Advanced IP Scanner. However, this IP address can change on next Raspberry Pi or router restart. There are many ways to solve this problem, I’ll cover these below:
- Setup Raspberry Pi to have static IP
- Create hostname on router for Raspberry Pi
- Scan the network every time
For now, please use network scan. Options to setup static IP or hostname will be explained after connecting to console as this is required.
You can download Advanced IP Scanner from this link. It’s very simple and straightforward application to check IP addresses in your network. After installation just click Scan and wait for scan to complete. You should get something similar as on below screenshot.
Advanced IP Scanner
Raspberry Pis address will be defined either by your wifi card manufacturer or ‘Raspberry Pi Foundation’ identifier when connected through lan.
Now, very topic of this tutorial – Putty. Download putty from Putty website. Run Putty and you will see below window. Use IP adress you found earlier. I recommend you to change Lines of scrollback under Window section to something bigger than 200, like 2000000- it comes in handy. You can save session details, but remember that you IP address can change if you don’t make it static somehow.
Putty Configuration
Click Open and if this is the first time you have connected to the Raspberry Pi you will see a warning with servers key fingerprint, this is Putty making sure you trust server you are connecting to. Click on Yes and the settings will be saved for next time. After connection you will be prompted to login with your credentials . Default username is pi with password raspberry for distros like Raspbian, RaspBMC or other based on Rasbian. It’s good to change this default password for security reasons. And, that’s all – you are connected to terminal.
Putty terminal
Password change in unix system is done by passwd command. You will be prompted to type your current password and new password twice.
pi@raspbmc:~$ passwd Changing password for pi. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
And now, off to setup of static IP for raspi.
Static IP
We need to edit file located in /etc/network/ folder.
cd /etc/network sudo nano interfaces |
And change line :
iface eth0 inet dhcp |
or similar, e.g. I use wifi card and instead of eth0 interface I have wlan0. We need to edit dhcp which defines that raspi will request dynamic IP assign from router to static as below:
iface eth0 inet static address 192.168.1.169 netmask 255.255.255.0 gateway 192.168.1.1 |
where:
- address – static IP you wan to set for raspi
- netmask – network mask, you can easily find currently used network mask by sudo ifconfig command, it will be after Mask: tag.
- gateway – your default gateway, this probably will be your router IP, you can make sure by running route – n command.
Save file with ctrl+o and quit with ctrl+x. Reboot your system to check configuration using sudo reboot.
Hostname
This is way i prefer is to setup a hostname on router. This is much more flexible as you don’t have to change raspi configuration every time you switch system or re install it. Unfortunately not every router allow you to set hostname, but If you have a open source OS (like OpenWRT, Tomato or DD-WRT) installed on your router then it should present no problem. I have OpenWRT installed on Netgear WNDR3700, but steps should be similar on any distribution and router.
Log in to your router and in menu under Networks find Hostnames section, there you can assign desired hostname (e.g. raspberrypi) to hardware address of your raspi. You can find raspi’s hardware adress by typing sudo ifconfig command, it will be after HWaddr tag. Click on Save and apply button and then you can use hostname instead of IP adress in virtually any place :)
Continue reading here: Squeezeslave
Was this article helpful?
Readers' Questions
-
Neave1 month ago
- Reply