You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
5.0 KiB

import { addBanner, addArticle, addTitle, addHeader, addParagraph, addClassParagraph, addSubHeader, addSmallHeader, addOrderedList, addUnorderedList, addBlockquote, addInset, addInsetList, addInsetCodeListing, addInsetBulletList, addImageWithCaption, addButtonGroup, addSidebar, addSyntax, menu, global_menu } from '/scripts/import.js';
const heading = document.querySelector(".heading");
const global = document.querySelector(".global_menu");
const local = document.querySelector(".local_menu");
const sidebar = document.querySelector(".sidebar");
const main = document.querySelector(".main_content");
heading.append(addTitle("Raspberry Pi Setup"));
heading.append(addParagraph("Getting Started"));
main.append(addSubHeader("Making the Raspberry Pi Accessible from a PC"));
main.append(addSubHeader("Setting Up ssh"));
main.append(addParagraph("Most of the time when working with my Raspberry Pi, I will be accessing it from a PC. Most of the initial setup will be done via ssh so we will start by setting this up."));
main.append(addParagraph("Enabling ssh on the Raspberry Pi can be done from the GUI configuration. You will need to log in to your Raspberry Pi directly to do this. Once there, we want to click on the Raspberry Logo in the top left corner, select Preferences and then Raspberry Pi Configuration. From the configuration GUI, click on the Interfaces tab and enable ssh. If you want more info on enabling ssh on your Pi, there is a fairly comprehensive tutorial by Goran Jetvic ob phoenixapp.com entitled <a href=\"https://phoenixnap.com/kb/enable-ssh-raspberry-pi\">How to Enable SSH on Raspberry Pi {Linux, Mac OS, Windows}</a>."));
main.append(addParagraph("Once done, we can go ahead and ssh over to the raspberry pi using putty or kitty."));
main.append(addParagraph("The first thing I want to do after ssh'ing over to the Pi is to change the root password which is raspberry by default and I will change it to the same password I used for the default user with 64 added on the end."));
main.append(addParagraph("I want to change the port number that the Pi will listen for ssh on and this can be done by editing the sshd_config file which is in the /etc/ssh folder. This is very basic ssh security but there are additional steps you can take to secure your Raspberry Pi but we will come back to that later. Again, phoenixapp.com has a pretty comprehensive tutorial which is also written by Goran and is called <a href=\"https://phoenixnap.com/kb/linux-ssh-security\">5 Linux SSH Security Best Practices to Secure Your Systems</a>."));
main.append(addSubHeader("RDP"));
main.append(addParagraph("The next thing I want to do is to setup RDP so that I can access the Linux Desktop if necessary. This is done with a utility called xrdp but this will not work with Raspbian’s native VNC software so we need to get rid of it first with the command"));
main.append(addSyntax("sudo apt-get purge realvnc-vnc-server"));
main.append(addParagraph("We can then install xrdp with the command"));
main.append(addSyntax("sudo apt install xrdp"));
main.append(addParagraph("I also want to disable the automatic login for the default Raspberry Pi user and this can also be done via the Raspberry Pi Configuration. This time, we need to make sure that the System tab is selected (which is the default) amd deselect or disable tyhe Auto Login option. The main reason for doing this is that is generally advisable, for security reasons, to remove the default user. If we disable the auto login, this prevents the system from automatically logging in the default user and allows us to delete the user."));
main.append(addParagraph("In order to delete a user, we need to make sure that there are no logins for that user. That done, we can then delete the user with the command"));
main.append(addSyntax("sudo deluser --remove-home pi"));
main.append(addParagraph("It's worth noting that this also deletes the users home folder so if you have stored files in the pi home folder, you nay want to consider copying this (the hone folder) over to another users home folder with the command"));
main.append(addSyntax("sudo cp -R /home/pi/. /home/$USER"));
main.append(addParagraph("The files in the pi home folder are owned by the pi user, so you can also change the user for these files with the command"));
main.append(addSyntax("sudo cp -R /home/pi/. /home/$USER"));
main.append(addParagraph("By default, the pi user doesn't need to enter a password when using sudo. This isn't important if you have deleted the pi user, but it might be worth looking at that here to ensure no other users are able to access sudo privileges without a password. The file"));
main.append(addSyntax("etc/sudoers.d/010_pi-nopasswd"));
main.append(addParagraph("contains the entries for this and it currently has one line which is"));
main.append(addSyntax("philip ALL=(ALL) NOPASSWD: ALL"));
main.append(addParagraph("So this means that when I sign into my Raspberry Pi Web Server with username philip, I can use sudo without a password"));
addSidebar("raspberrypi");