Managing Users and Groups Flashcards

1
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
2
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
3
Q

Add user

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
Q

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

A

passwd -e avance

chage -d 0 avance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
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
9
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
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 finance avance -append avance to suppl group finance
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

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
15
Q

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

A

/etc/nologin

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

Change aging params of a user’s account

Set expiration date of account

A

chage
k=date -d+'15 days' +%Y-%d-%d
chage -E $k avance
chage -E 2020-01-01 avance -set expiration date of account

17
Q

Set no expiration to account

A

chage -E -1 avance

chage -l user -list account aging info

18
Q

Change warning period before password expires

A

chage -W 15 avance

19
Q

Change password expiration date 15 days from now

A

chage -M 15 avance

20
Q

Lock the account that will be inactive after 5 days when the password is expired

A

chage -I 5 avance

21
Q

Log in into new group

A

newgrp
newgrp finance - (use the dash to initiate entering a user to finance suppl group)
so when creating new files and dirs, group ownship would be finance and not user’s primary group