Headless Raspberry Pi Setup SSH

Download Raspbian Image the Lite version will do or you can get Raspbian with desktop if you like even the desktop and recommended software Raspbian is ok what ever you want. Depending on what operating system you are running to put Raspbian image on your microSD card follow this link to do so because I’m not going to explain how to do it three different times especially when I only run Linux. After you have successfully written the image to your microSD card.  Add a file called SSH in the boot partition of the MicroSD card it will look like so you may have to unplug and plug in your microSD card from your computer after writing the image to the MicroSD card. One more file to create add a file called wpa_supplicant.conf in the boot partition of the MicroSD card paste the following into it adjusting for the name of your country code, network name (SSID) and network password (Wifi Password)

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="NETWORK-NAME"
    psk="NETWORK-PASSWORD"
} 

Jump to you login to your router look for connected devices to find the IP address of your Raspberry Pi by default the device name of your Raspberry Pi is believe It or not it is raspberrypi. 🙂

Once you found your IP address let’s say it is 192. 168. 1. 10 You can either use PuTTY or your terminal if you’re in Linux and CMD in Windows by Typing $ ssh pi@your-IP-address Example $ssh pi@192.168.1.10

Tips for SSH

The default username is (pi) and login is (raspberry) You probably want to change the default password for your Raspberry Pi That command is $passwd You can find all the Information to do this in great detail on the Raspberry Pi website.

Once you’re in SSH you’re in Linux world to exit SSH type $exit

I recommend configuring your Raspberry Pi with the command $sudo raspi-config

Last but not least that I think is very important is keeping your pi up-to-date with the commands $sudo apt-get update$sudo apt-get upgrade

Optional I do this after rebooting to make sure everything’s working I clean up unnecessary files that are not used no more with the command $sudo apt-get clean

Thank you for checking out my tutorial I hope you enjoyed it.

Bruce

Raspberry Pi 3 Model B+

The new Raspberry Pi 3 B + I couldn’t help myself even though I have two other Raspberry Pi 3 B. By the way just so you know if you buy a case make sure it says it’s compatible with Raspberry Pi B + if not you have to do some altering I ordered a case with a fan that said it was compatible with the B+ but wasn’t so be sure to read reviews beforehand there’s a new set of pins and one of the chips is slightly in a different place but I managed to get it to work. The reason I got a new Pi was the faster transfer rates and yes a little bit faster CPU it is for my OSMC The really cool thing is you can just swap out micro SD cards for OSMC and it just works which is also stated in OSMC’s blog post. I did it change the wireless network to the 5G no problems but I did a fresh image install. I had some other stuff on the old sd card that I didn’t want like Webmin. Was hoping to see an Improvement in processor speed there may be but I don’t notice one but I do notice the transfer rate speed increase which makes me very happy all in all I’m glad I got it. In return, it gave me another Raspberry Pi to play with which you can see here.

 

 

motionEyeos

If you’re looking for a project for your Raspberry Pi 3 motionEyeos is a fun project. The interface is very user-friendly had it up and running in no time. I have a 500 gig external hard drive connected to the Raspberry Pi 3 where it stores the videos and images and bought a cheap webcam Amazon.

 

One of the cool features motionEye has is time-lapse for pictures.

OpenVPN setup for private internet access (PIA VPN) Raspberry Pi 3 OSMC

Updated July 18 2018

I recently started using OSMC on my Raspberry Pi. I also have an account with private internet access which is, by the way, the best VPN service you can get hands down in my opinion. This tutorial will show you how to setup OpenVPN to connect to private internet access at boot up of your OSMC / Debian-based Linux.

  • Things to do
  1. Enable SSH on OSMC /Debian-based Linux, update, upgrade, install network-manager-openvpn, and install openvpn.

If you do not know what SSH is Google is your friend. Secure Shell. I’m going to leave out some stuff because I assume you already know the basics
and I don’t want to turn this tutorial into a book such as how to find your IP address on your OSMC box how to SSH and etcetera. However, if you have questions leave comments and I would be more than happy to help you there are no dumb questions. A helpful link  Accessing the command line on OSMC,

Okay SSH into your OSMC/Debian-based Linux If this is the first time SSHing into your OSMC I HIGHLY recommend changing the default password of the OSMC. The default Login and Password is osmc. To do so Type in your SSH Client:

passwd osmc

  • now we start It’s always a good idea to have your OSMC up-to-date and we are going to install OpenVPN:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install network-manager-openvpn NetworkManager conflicts with ConnMan which is the network manager that comes with osmc.
sudo apt-get install openvpn (Note there shouldn’t be any need to install openvpn anymore, should be there by default.)

  • I did all the work inside /etc/openvpn You don’t have to but this is how the tutorial is written:

cd /etc/openvpn

  • Download private internet access VPN zip and unzip:

sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip

sudo unzip openvpn.zip

  • Now try and connect to the VPN of your choice ending in ovpn. For me, I’m going to be using Sweden.ovpn (note If you choose one of the files that has spaces in it like example UK London.ovpn rename it to Something that has no spaces in it for example UK London.ovpn to UK_London.ovpn. To do that #sudo mv UK\ London.ovpn /etc/openvpn/UK_London.ovpn):

sudo openvpn ./Sweden.ovpn

  • It’ll ask you for your username and password. Enter these and hopefully, you get ‘Initialization Sequence Completed’. you need to press CTRL -c to cancel the sequence and take control again. After this, you need to change the config to keep your User and Password in it:

sudo nano /etc/openvpn/login.conf

Add 2 lines for login and password line one is going to be your private internet access login and line two is going to be your password. To save and exit Nano press CTRL -x it will ask you to save it type Y

 

  • Set the proper permissions for the conf file:

sudo chmod 400 /etc/openvpn/login.conf

  • Create a new config file with the Sweden information from the Sweden.ovpn And we’re going to name the new config file  pia_sweden.conf:

sudo cp Sweden.ovpn /etc/openvpn/pia_sweden.conf

  • By adding the new line OpenVPN automatically knows where to grab the password:

sudo nano /etc/openvpn/pia_sweden.conf

  • At the line auth-user-pass add login.conf so it looks exactly like auth-user-pass login.conf

  • Now let’s see if all our work paid off. Your username and password are automatically accepted:

sudo openvpn pia_sweden.conf

  • You should get the ‘Initialization Sequence Completed’ again and no interaction. press CTRL -c to stop it.
  • To make it work on start up we need to change the startup file for openvpn. and add a line to it AUTOSTART=pia_sweden:

sudo nano /etc/default/openvpn

  • Now reboot your OSMC:

sudo reboot

  • Then to make sure it’s working and to find your external IP. log back in via SSH:

wget http://ipecho.net/plain -O – -q ; echo

  • or

curl ipinfo.io/ip

  • Now it automatically connects to your VPN on boot up of your system. I hope you find this tutorial helpful

 

  • I would like to thank Tom Doyle for getting me up to speed on some of the changes so there won’t be conflicting issues shutting up your VPN. He also gave us a solution for DNS leaks thank you, Tom for the help!

 

  • preventing dns-leaks, this can be done as follows:

sudo apt-get install openresolv

  • Add the following to the bottom of pia_sweden.conf:

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

Bruce