Professional Documents
Culture Documents
Adding and Removing Users
Adding and Removing Users
Adding a new user is done with useradd and removing an existing user is done with
userdel. In the simplest form, an account for the new user bjmoose would be done
with:
Note that for openSUSE, useradd is not in the normal user's PATH, so the command
should be:
which, by default, sets the home directory to /home/bjmoose, populates it with some
basic les (copied from /etc/skel) and adds a line to /etc/passwd such as:
bjmoose:x:1002:1002::/home/bjmoose:/bin/bash
and sets the default shell to /bin/bash. Removing a user account is as easy as typing
userdel bjmoose. However, this will leave the /home/bjmoose directory intact. This
might be useful if it is a temporary inactivation. To remove the home directory while
removing the account one needs to use the -r option to userdel.
$ id
uid=1002(bjmoose) gid=1002(bjmoose) groups=106(fuse),1002(bjmoose)
https://courses.edx.org/courses/course-v1:LinuxFoundationX+LFS101x+3T2018/courseware/17e43829df2840b997fa26e1bc5602af/37d91de7048… 1/2
30/3/2019 Adding and Removing Users | Accounts, Users and Groups | Material del curso LFS101x | edX
If given the name of another user as an argument, id will report information about
that other user.
https://courses.edx.org/courses/course-v1:LinuxFoundationX+LFS101x+3T2018/courseware/17e43829df2840b997fa26e1bc5602af/37d91de7048… 2/2