Managing Users and Changing Hostname on Raspberry Pi Raspbian

CanaKit Raspberry Pi 4 (4GB) Starter Kit (Amazon Affiliate)
US: https://amzn.to/3azJgrW
UK: https://amzn.to/2JdMq9o
CA: https://amzn.to/3bwiRvY
ES: https://amzn.to/2T06LnM (similar)
FR: https://amzn.to/3cvIZrs (similaire)
IT: https://amzn.to/2Ar74Sj (simile)
DE: https://amzn.to/2AqfWHQ (ähnlich)
IN: https://amzn.to/3ey6fWj
AU: https://amzn.to/2VTUt1C
NL: https://amzn.to/3f5NdsD (vergelijkbaar)

Raspberry Pi Playlist: https://www.youtube.com/playlist?list=PLErU2HjQZ_ZPvIdR5BEqDgO7DsGAla_AZ

Enter Global skel Directory
cd /etc/skel
View skel Files
ls -al

Files and scripts added to this directory will show up on all newly created user account.

Return to Home Directory
cd
See Which Account You are Logged in Under
whoami
Switch to root User
sudo su
Add User
sudo adduser rick
Give User sudo Privileges
sudo adduser rick sudo
Switch Users
su rick
Move to the sudoers.d Directory
cd /etc/sudoers.d/
Copy nopasswd File
sudo cp 010_pi-nopasswd 010_rick_nopasswd
Edit nopasswd File
sudo nano 010_rick_nopasswd
Change:
pi ALL=(ALL) NOPASSWD: ALL
To:
rick ALL=(ALL) NOPASSWD: ALL
View Current Hostname
hostnamectl
Change Hostname
sudo hostnamectl set-hostname rickpi
Change hosts File
sudo nano /etc/hosts
Change:
127.0.1.1 raspberrypi
To:
127.0.1.1 rickpi
Restart avahi-daemon
sudo systemctl restart avahi-daemon

Ping New Hostname

ping rickpi.local
Delete User Account
sudo userdel -r pi

If the user is currently being used by a process, remove them from autologin.

sudo raspi-config

Boot Options > Desktop / CLI

Choose a choice without auto log in.

Reboot System
sudo reboot
Repeat Delete User account
sudo userdel -r pi
View passwd File
cat /etc/passwd 

Leave a comment

Your email address will not be published. Required fields are marked *