Managing Users and Groups Flashcards

1
Q

Add user

A

useradd -m [home dir] -c[comment] “Adam Vance” -u [uid] 1002 -g[gid] 25 -G wheel -s [shell] /bin/tcsh avance

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

Set password to a user

Set a password for yourself

A

passwd avance

passwd without any params

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

Force expiration of password and make a user to set up a new password after the login

A

passwd -e avance

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

Remove user’s account keeping home folder

The same and remove user’s home folder

A

userdel avance

userdel -r avance

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

Create system account

A

useradd -r my_service -s /sbin/nologin

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

Check groups current user belongs to

Check groups a user belongs to

A

groups

groups avance

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

Create new group

Delete a group

A

groupadd [-g[gid] 501] my_group

groupdel my_group

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

Content of /etc/passwd

A

user_name:password:uid:gid:comment:full_path_to_home_dir:/shell
root:x:0:0:root:/root:/bin/bash

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

Content of /etc/shadow

A
user_name:encr_passd:days password_changed_since_01.01.1970:min_days_between_passwd_changes:max_days_passwd_valid:warning_days_expiration_of_passwd:days_to_lock_account_when_passwd_is_expired:date_days_since_01.01.01_account_will_expire
root:$1$***$...:17618:0:99999:7::
dbus:!!:17618::::::
$1$=MD5
$2$,$2y$=Blowfish
$5$=sha-256
$6$=sha-512
$***-salt
$...-hashed passed
!-account is locked
*-account is locked and passed was never set
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Conf file with default settings set by useradd command

A
/etc/default/useradd
common settings:
GROUP=100
HOME=/home
SHELL=/bin/bash
SKEL=
EXPIRE=date the account will expire
INACTIVE=-1 (account will not be disabled when password is expired) if =0- disable account when passwd expired
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Query db content of specified group id

A

getent group 100

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

Conf file that changes the behaviour of /etc/default/useradd file
and should be used by admins to set up vars

A
/etc/login.defs
GID_MIN=1000
this will override min value of GROUP var
UID_MIN=1000-this will setup starting uid
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Modify a user account

A

usermod
usermod -a -G- append user to suppl group
usermod -d /opt/projectx my_project -change home dir from /home/my_project
usermod -e 1 - accoutn will expire in 1 day
usermod -l -change user_login name from to new
usermod -p -passwd
usermod -u -uid
usermod -L- lock user’s password
usermod -U - unlock account

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

Change aging params of a user’s account

A

k=date -d+'15 days' +%Y-%d-%d
chage -E $k avance
chage -E 2020-01-01 avance -set expiration date of account
chage -l user -list account aging info
chage -E -1 avance -set no expiration to account
chage -W 15 avance- change warning period
chage -M 15 avance -change password expiration date from now
chage -d 0 avance - force password to be changed for avance
chage -I 5 avance -account will be inactive after 5 days when the password is expired

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

Modify a group

A

groupmod
groupmod -g 1002 engineering
groupmod -n Engineers engineering

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

File to create for displaying a message, when a user has /sbin/nologin as shell

A

/etc/nologin