Posts

Showing posts from June, 2019

Accessing a NAS drive from your Raspberry Pi

Image
Often enough, you will need much more storage space than is available on your Raspberry's SD Card. With a few setup files in the Raspbian OS, writing to and reading from a NAS drive in your home network is possible. The following works for Raspbian Stretch. It is a bit finnicky to set up, and very parameter dependent, so it may or may not work for other Raspbian versions. When finished, you will have a new folder (here, named as 'WDMyCloud') in your Raspberry's directory structure. It will behave like a local folder on the Raspi's SD card, but it is actually a folder on the NAS drive. Step 1: Create a folder on the Pi that you will later mount the NAS share in. That folder needs to be somewhere in the home/pi structure. I have put that folder in the /home/pi/ directory and simply named it after my NAS which, you guessed it, is a WDMyCloud device. In a Raspberry terminal window, create that folder with the following commands: cd /home/pi  sudo mkdir DRIVE...

Change the name of your Raspberry Pi Zero W

Image
By default, all new and fresh Raspbian installations come with the name and hostname of "raspberrypi'. If you have only one Pi, that's good enough. More than one on the network however, and you will want to have an individual name for each one. Two files need to be edited for that purposes. Step one: SSH into your Pi and enter sudo nano /etc/hosts Amend the last line from 127.0.1.1 raspberrypi with the name that you want to give the Pi. Hit ^X and Enter to commit the change. Step two: enter sudo nano /etc/hostname Change the entry from raspberrypi to the name that you want to give your Pi. Hit ^X and Enter to commit the changes: Reboot the Pi. SSH into your Pi again and you should see the terminal prompt with the new name of your Pi: Done! Your Pi now has an individualized name.

Static IP address for your Raspberry Pis, and disable IPv6

Image
Actually, I do not like the idea and work of assigning static IP addresses to the gadgets in my home network. I would prefer to keep everything flexible and have my clever router and networked gadgetry figure the details out by themselves, behind the curtain. I've tried a fair number of things to have my network recognize my Raspis by their hostname rather than their IP address. Nothing seemed to work. When addressing the Pis by their hostname, the Pis refused to see each other, and I could not access the Pis from my Windows 10 computer either. So I gave up on that route. The remaining option is to address the Pis by their IP address. By default, they come with their IP address set to 'dynamic'. The router is fine with that. The effect is that whenever you reboot the Pi or reboot the router, your Pis will probably be assigned a new random IP address. That's a pain in the neck because you will first need to find out what that new IP address is with an IP scanner tool...

Securing your Raspberry: protect the SSH remote access by SSH port change

Image
By default, the remote access to computers via SSH works via communication on port 22, and that's the port where any intrusion attempt will start from . To prevent that, you should change that port to another number. Almost any other port between 1 and 65535 will work, but some of the lower ones (under 1000) might get used by the system for other purposes. So, pick any number above 1000. Let's say we'll pick port number 27732. First, let's change that port number in the Raspi. SSH into your Pi and modify the SSH settings file with 27732 in the line that reads "#Port22": Hit ^X and Enter to commit the changes, reboot. The SSH connection will drop, and to restart the connection you will need to modify the session settings in MobaXTerm with that same port number 27732: Hit OK. Your terminal window should come up again, now connected to the Raspi via that new port number 27732. Done. Your Raspi is now slightly more hardened against the simple intrusion at...

Remotely control your Raspberry Pi Zero W from your Windows computer with SSH

Image
So you've got your Raspberry Pi Zero W all set up, with Raspbian Stretch installed and working, and you've got a keyboard plugged into it. And you can see and operate the Raspi's GUI via the screen that you have plugged into the Raspi's HDMI port. Good! I like to remove screens, cables and stuff from my desk as much as possible. And I want to put the Raspi into a little box anyway, for some home automation purposes, and that box will be meters away from my office desk. Luckily, the Raspberry Pis allow to be completely remote control with a Windows computer via 'SSH' networking. The following is my recipe to set up SSH remote control on your Raspberry and your Windows computer. Step 1: by default, SSH is disabled on a brand new Raspi. We need to enable SSH. From the GUI, select Preferences-Raspberry Pi Configuration: In the Configuration window, enable 'SSH': Reboot the Raspi to start the SSH functionality. Done. The Raspi is now ready to be ...