0% found this document useful (0 votes)
9 views2 pages

Users and Groups

The course 'Managing Files Using Bash and Z Shell' by Mateo Prigl covers user and group management in Linux systems. It explains how to check user accounts, create new users with the useradd command, and manage user permissions using sudo and groups. Additionally, it provides commands for modifying user settings and accessing user accounts through the terminal.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Users and Groups

The course 'Managing Files Using Bash and Z Shell' by Mateo Prigl covers user and group management in Linux systems. It explains how to check user accounts, create new users with the useradd command, and manage user permissions using sudo and groups. Additionally, it provides commands for modifying user settings and accessing user accounts through the terminal.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

"Managing Files Using Bash and Z Shell" course by Mateo Prigl at Pluralsight

Users and Groups


Every file has a file owner. This is just another user account on the system.
Use whoami to check which account did you log into.

$ whoami
mateo

The root user is the main user account on the system with all of the
permissions (like an administrator account). Since this account has unlimited
capabilities, it is often recommended not to use it directly, so that we don't do
something irreversible to the system. Instead, you can use the sudo command.
When you prepend a command with sudo that means that you want to execute
it as the root user. However, the requirement for using it is that your user
account is a part of the sudo group.
groups command will list you all of the groups that you are a part of. All of the
possible groups on the system can be seen in the /etc/group file.
To see the user ID and all of the user groups, you can also use the id command.
To create a new user we can use the useradd command. There is also a
adduser command on most of the Linux systems, which is more beginner
friendly. It will ask you for the finger information (information about the user).
However in this course we will use the good old useradd option, which always
and definitely works.

$ sudo useradd john -m -d /home/john -s /usr/bin/zsh

m options gives this user a home directory. d option will define where that
directory will be created and its name.
s option defines the default login shell. If you don't know where the shell is

1/2 © Copyright 2020 by Pluralsight


"Managing Files Using Bash and Z Shell" course by Mateo Prigl at Pluralsight

installed, use the which command followed by the name of the shell command.
You can also edit the user configuration later with the usermod command.
Set a login password on a user john with the sudo passwd john command.
You can set a password exparation time with the chage command.
All of the users passwords are stored in the hashed format, inside of the
/etc/shadow file.
We can create groups with the addgroup and delete them with the delgroup
command.

$ sudo usermod -aG sudo john

The command above will add the user john to the sudo group. You can add
users to the group with the usermod command that has the aG options.
To login as another user, use the su command.

$ su - john

This will log you into the john user account. To logout you can use the exit
command.
On macOs you can add users from the graphical interface. Go to the System
Preferences > Users & Groups and from there you can add new users.

2/2 © Copyright 2020 by Pluralsight

You might also like