Users & SUDO Flashcards

1
Q

How to add a GROUP in LINUX

A

If you don’t add groups to LINUX any user created will automatically be placed in a group carrying the same name as the username.

So to create custom groups start by the command as root :

> groupadd name_of_group

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

How to add a user ?

A

Command line as root :

> useradd -g parents Leila

If the -g and the group name is not mentioned e.g.

> useradd Leila

Then a group Leila will be created in which Leila will be placed.

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

How does the creation of users affect the LINUX arborescence ?

A

[root@bigboy tmp]# ll /home
drwxr-xr-x 2 root root 12288 Jul 24 20:04 lost+found
drwx—— 2 accounts soho 1024 Jul 24 20:33 accounts
drwx—— 2 alice children 1024 Jul 24 20:33 alice
drwx—— 2 derek children 1024 Jul 24 20:33 derek
drwx—— 2 jane parents 1024 Jul 24 20:33 jane
drwx—— 2 paul parents 1024 Jul 24 20:33 paul
drwx—— 2 sales soho 1024 Jul 24 20:33 sales
[root@bigboy tmp]#

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

Managing passwords

A

User root changing password for user paul:

[root@bigboy root]# passwd paul
Changing password for user paul.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@bigboy root]#

User paul changing his own password:

[paul@bigboy paul]$ passwd
Changing password for paul
Old password: your current password
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
New password: your new password
Re-enter new password: your new password
Password changed.
[paul@bigboy paul]$

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

Deleting passwords and subtelties

A

Always as root.

The userdel command is used to remove the user’s record from the /etc/passwd and /etc/shadow used in the login process. The command has a single argument, the username.

[root@bigboy tmp]# userdel paul

The optional -r switch additionally removes all the contents of the user’s home directory. Use this option with care. The data in a user’s directory can often be important even after the person has left your company.

[root@bigboy tmp]# userdel -r paul

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

What group is user in?

Changing file ownership

A

before

Always as root:

[root@bigboy root]# groups paul
paul : parents
[root@bigboy root]#

Ownership change:

[root@bigboy tmp]# ll test.txt
-rw-r–r– 1 root root 0 Nov 17 22:14 test.txt

[root@bigboy tmp]# chown testuser:users test.txt
[root@bigboy tmp]# ll test.txt
-rw-r–r– 1 testuser users 0 Nov 17 22:14 test.txt
[root@bigboy tmp]#

You can also use the chown command with the -r switch for recursive searches down into directories to change permissions

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

concept behind SUDO

A

The sudo utility allows users defined in the /etc/sudoers configuration file to have temporary access to run commands they would not normally be able to due to file permission restrictions. The commands can be run as user “root” or as any other user defined in the /etc/sudoers configuration file.

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