No need for an extra keyboard or HDMI cable to set up your Raspberry Pi, Below I will show you how to do a headless Raspian install, which I have to credit www.jamesfmackenzie.com for the original post.
Download the Rasbian image
Head over to www.raspberrypi.org and download their latest Image. For this tutorial, I will be using the LITE Version but this will work with either image.
Write the image to your SD Card
Use Win32 Disk Imager to write the Raspbian Image to your SD Card.
Add SSH File to SD Card
Enable SSH by placing a file named “ssh” (without any extension) onto the boot partition of the SD card.
Boot the Pi
Slot your prepared SD card into your Pi and add power and your network cable.
Find your Pis IP Address
Now you need to find what Ip Address has been given to the Pi by DHCP. If your router does your DHCP for your network you can log in to your router and check the DHCP lease allocation table.
Alternatively, if you don’t have access to router / DHCP server you can scan your network with something like Nmap. Check out my Nmap 101 tutorial here.
SSH into your Pi
You should now be able to SSH into your Pi using your favourite SSH client. As I am doing this from a windows box I Prefer using the Windows Bash Shell, but will work just the same with Putty or any other client.
The default credentials are:
Username: pi Password: raspberry
Configure your Pi
Boom, you can now configure your Pi with this command.
Create a New Sudo User
After configuring your Pi its a good security measure to set up a new sudo user and delete the Pi user
Use the addusr command to add a new user to your Pi. Be Sure to replace username with the user that you want to create.
# addusr username
Set and confirm the new user’s password at the prompt. A strong password is highly recommended!
Set password prompts: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Set the new user’s information. just hit enter and accept the defaults, leaving all the information blank.
User information prompts: Changing the user information for username Enter the new value, or press ENTER for the default Full Name : Room Number : Work Phone : Home Phone : Other : Is the information correct? [Y/n]
Use the usermod command to add the user to the sudo group
# usermod -aG sudo username
Test sudo access on the new user account, use the su command to switch to the new account
As the new user, verify that you can use sudo and run with superuser privilege. The command below lists the contents of the root directory which is normally only accessible to the root.
username$ sudo ls -la /root
To delete the old Pi user I had to reboot the pi then login with the new user you have just created.
username$ sudo reboot
Then delete the Pi user. if you want to keep the pi home directory leave the –remove-home off of the command.
username$ sudo deluser --remove-home pi
Once you have finished configuring your Pi and you have set up a new sudo user, it is a good idea to secure the SSH port with an asymmetric key and turn off password authentication.
If you want to secure the SSH port, everything you need to know is in my Tutorial on Secure Shell (SSH) here
Please comment below and let me know how you liked this tutorial or what you want to see more of, all none spam comments are welcome, I read them all.