Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Configuration
- First things first. Fix the keyboard and other configuration.
- ```
- sudo raspi-config
- ```
- #### keyboard
- ```
- ->Localisation Options
- ->Change Keyboard Layout
- ->Generic 105-key (Intl) PC
- ->Other
- ->English (US)
- ->English (US)
- ```
- Then choose the rest of the options as you desire.
- #### hostname
- ```
- ->Hostname
- ```
- Then type in your desired `hostame`
- #### Peripherals
- ```
- ->Interfacing Options
- ->SSH
- ->Yes
- ->Interfacing Options
- ->SPI
- ->Yes
- ->Interfacing Options
- ->I2C
- ->Yes
- ```
- ## Change the Default User
- #### Change the username
- In order to change the username 'pi' we will have to log in a the root user since it's not possible to rename an account while your logged into it. To log in as root user first we have to enable it, to do so type the following command whilst logged in as the default pi user:
- ```
- sudo passwd root
- ```
- Choose a secure password for the root user. You can disable the root account later if you wish.
- Now logout of the user pi using the command:
- ```
- logout
- ```
- And then logout back in as the user 'root' using the password you just created. Now we can rename the the default pi user name. The following method renames the user 'pi' to 'newname', replace this with whatever you want. Type the command:
- ```
- usermod -l newname pi
- ```
- Now the user name has been changed the user's home directory name should also be changed to reflect the new login name:
- ```
- usermod -m -d /home/newname newname
- ```
- Now logout and login back in as newname. You can change the default password from raspberry to something more secure by typing following command and entering a new password when prompted:
- ```
- passwd
- ```
- If you wish you can disable the root user account again but first double check newname still has 'sudo' privileges. Check the following update command works:
- ```
- sudo apt-get update
- ```
- If it works then you can disable the root account by locking the password:
- ```
- sudo passwd -l root
- ```
- #### Re-enable auto-login
- Manually modify the raspi-config script as follows. Let's presume we're using the username "bob".
- ```
- sudo nano /usr/bin/raspi-config
- ```
- then search for
- ```
- do_boot_behaviour() {...}
- ```
- Under that, there's a line where we will replace the `-u pi` with `-u bob`, leaving the rest of the line unchanged:
- ```
- if id -u pi > /dev/null 2>&1; then
- ```
- Next edit the line:
- ```
- sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"
- ```
- By changing `autologin-user=pi` to be `autologin-user=bob`
- If you want a pretty menu and also error when it occurs, edit these lines:
- ```
- whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2
- "Desktop" "Log in as user 'pi' at the graphical desktop" \
- ```
- Again, replacing `pi` with `bob`, or your username of choice.
- Now the only thing left is enter raspi-config:
- ```
- sudo raspi-config
- ```
- Select the third option:
- ```
- 3 Enable Boot to Desktop/Scratch
- ```
- And then select the second:
- ```
- Desktop Log in as user 'bob' at the graphical desktop
- ```
- This way the configuration files are written (crucial) and you are ready to automatically boot into the GUI
- ## Useful tools
- Install some of the basics:
- ```
- sudo apt update
- sudo apt install network-manager vim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement