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 

Auto Run an Application on Raspberry Pi Raspbian Desktop

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

Find the Full Path of an Executable
which chromium-browser
Show the Path of your Home Directory
pwd

Setup autostart for a All Users

Open Global autostart Config for Editing*
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

* You can alternatively use mousepad editor instead of nano

Add Application to autostart File
@/usr/bin/chromium-browser https://www.rickmakes.com

Control-o to save, Control-x to exit

Logout and login to test your configuration. You can alternatively reboot the Raspberry Pi.

Setup autostart for a Specific User

Create Config Directory
mkdir -p .config/lxsession/LXDE-pi
Copy autostart Global Config File
cp /etc/xdg/lxsession/LXDE-pi/autostart .config/lxsession/LXDE-pi/
Open User autostart Config for Editing
nano .config/lxsession/LXDE-pi/autostart
Add Application to autostart File
@/usr/bin/chromium-browser https://www.rickmakes.com

Logout and login to test your configuration. You can alternatively reboot the Raspberry Pi.