Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Raspberry Pi

You're reading from   Learning Raspberry Pi Unlock your creative programming potential by creating web technologies, image processing, electronics- and robotics-based projects using the Raspberry Pi

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781783982820
Length 258 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Serge Schneider Serge Schneider
Author Profile Icon Serge Schneider
Serge Schneider
Samarth Shah Samarth Shah
Author Profile Icon Samarth Shah
Samarth Shah
Arrow right icon
View More author details
Toc

User management

Once you have Raspbian installed, it is advisable to set up a user account. The Raspberry Pi Foundation's version of Raspbian already has a user pi, with the password raspberry. A system running with the default password is not secure as the password is widely known. To avoid this problem, the password needs to be changed. The default install does not have a root password set and the user is expected to use sudo to run commands as root. As a result, many beginners never learn the difference between a root and a user account. This leads to misuse of sudo and other issues later on. A root password is set in order to allow administrative tasks to be carried out in a standard root shell and an extra user account is added to standardize the install using the following steps:

  1. First, log in as pi.
  2. Then, change the default user password by running the following command:
    # passwd
    
  3. Next, enter a root shell by typing this:
    # sudo -i
    
  4. Again, run passwd to change the password. As you are in a root shell, this will change the root password this time.
  5. Add a new user with a name of your choice by entering the following command:
    # adduser steve
    
  6. The user will not be able to carry out certain tasks without being a member of the relevant groups. The following command will add the user into the major groups:
    # usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev, input,spi,gpio steve
    

Note

Please note that raspi-config is coded with the assumption that pi is the main user. As a result, some options (Enable Boot to Desktop/Scratch), will not work as expected.

If you would like to boot the desktop automatically as the new user, this can be easily accomplished without raspi-config:

  1. First, enable the LightDM service by running this:
    # update-rc.d lightdmd enable 2
    
  2. Set the autologin-user variable in /etc/lightdm/lightdm.conf as required. You should note that leaving it commented out with a # will present you with a login window every time you boot up, which is slightly more secure and is especially recommended if you have multiple users.

The reverse can be accomplished simply by disabling the LightDM service.

Once you installed the operating system, you can use the keyboard, mouse, and HDMI screen to get started with the development. However, many of you might not have a USB keyboard, USB mouse, and HDMI screen. In such cases, you need to access Raspberry Pi remotely.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image