adventures with microcomputers prototyping with raspberry pi

7. Make a New User

  1. Issue the following command in the terminal: sudo useradd -m -G pi,sudo,gpio,audio,video [NEWNAME]

    using -m with useradd checks to see if there is already a home directory for user [NEWNAME] and creates one if there isn't one.

    -G specifies which groups the new user will be added to by default. If you want to be able to install things (sudo), access the general-purpose input/output (gpio), or use audio or video, you have to add your user to each of the relevant groups to do so.

  2. Next change the password of your new user by issuing the following command sudo passwd [NEWNAME]

  3. When you are done restart your raspberry pi with the following command sudo shutdown –r now and login to confirm that your new user exists.

change hostname

  1. issue the following command in the terminal: sudo nano /etc/hosts
  2. leave everything the same in this file except the last line, changing 127.0.0.1 raspberrypi to 127.0.0.1 [your new hostname]
  3. save your changes, exit the file
  4. issue this command next: sudo nano /etc/hostname
  5. replace raspberrypi with whatever hostname you used in /etc/hosts
  6. reboot: sudo reboot now
  7. login again to confirm that your hostname has changed