WK3 Add and Delete users Flashcards

1
Q

Root user (Super user)

A

A user with elevated privileges to modify the system

Root users can create, modify, or delete any file and run any program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is running commands as a root user potentially problematic?

A

The first problem with logging in as root is the security risks. Malicious actors will try to breach the root account. Since it’s the most powerful account, to stay safe, the root account should have logins disabled. Another problem is that it’s very easy to make irreversible mistakes.

It’s very easy to type the wrong command in the CLI, and if you’re running as the root user, you run a higher risk of making an irreversible mistake, such as permanently deleting a directory.

Finally, there’s the concern of accountability. In a multi-user environment like Linux, there are many users. If a user is running as root, there is no way to track who exactly ran a command. One solution to help solve this problem is sudo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Sudo User

A

sudo comes from super-user-do

Sudo is a command that temporarily grants elevated permissions to specific users. This provides more of a controlled approach compared to root, which runs every command with root privileges. sudo solves lots of problems associated with running as root.

Not all users on a system can become a superuser. Users must be granted sudo access through a configuration file called the sudoers file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

User add

A

This command is useradd. useradd adds a user to the system. Only root or users with sudo privileges can use a useradd command. Let’s look at a specific example in which we need to add a user. We’ll imagine a new representative is joining the sales department and will be given the username of salesrep7. We’re tasked with adding them to the system.

Let’s try adding the new user. First, we need to use the sudo command, followed by the useradd command, and then last, the username we want to add, in this case, salesrep7. This command doesn’t display anything on the screen. But since we get a new Bash cursor and not an error message, we can feel confident that the command worked successfully. If it didn’t, an error message would have appeared. Sometimes an error has to do with something simple like misspelling useradd. Or, it might be because we didn’t have sudo privileges.

e.g
sudo user add salesrep7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Userdel

A

e.g sudo userdel salesrep7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly