-
Notifications
You must be signed in to change notification settings - Fork 144
/
Users and Groups.txt
82 lines (63 loc) · 2.74 KB
/
Users and Groups.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Created by Krzysztof Gajewski
https://www.linkedin.com/in/krzysztof-gajewski-537683b9/
1. COMMANDS
- useradd (create user)
- usermod (modify user)
- userdel (remove user)
- passwd (change password)
- groupadd (add group)
- groupmod (modify group)
- groupdel (remove group)
2. ADDING A NEW USER LINUX
- useradd [OPCJE] LOGIN
- useradd -D (it will display default option configuration)
- useradd -D
Group=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/sh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
All data are stored in: /etc/default/useradd. The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory.
- $ useradd -D -e "YYYY-MM-DD" - time when account will expired
- $ useradd -D -s /bin/bash - changing defualt shell
- $ useradd -G cdrom,plugdev -m -e 2011-04-21 -s /bin/bash -c "Mark Doe" mark - (-G = grupa, -m = creates home directory, -c additional information about user)
After creating usser account we will find new registry in /etc/passwd example below:
new_user:x:1004:1005:new_user:/new_user/john:/bin/bash
- new_user – user name
- x – it means that password is soted in /etc/shadow
- 1004 – user number in system
- 1005 – group number
- n new_user – fullname os user or other comments
- /home/new_user – user home directory
- /bin/bash – shell assigned to user, by default it is sh
Password for user account is stored in /etc/shadow:
new_user:n324onuif09j23fononwoinj:14518:0:99999:7:5:14618:
- new_user – user name
- n324onuif09j23fononwoinj- password hash
- 14518 – days from 1 January 1970 indicates whne password was chnage las ttime
- 0 – day's number when password can be change
- 99999 – day's number when password have to be change
- 7 – day's number, when user will recive message that the password will expire
- 5 – day;s number, after this time if user will not chnage password account will be blocked
- 14618 – days from 1 January 1970 indicates that account is valid, when vaule will exceed this number account will be blocked
- empty filed is reserved
3. DELLETING USER LINUX
- userdel (remove account)
- userdel -f (remove account even if user is log in)
- userdel -r (remove user home directory)
Information about group is stored /etc/group
group_name:group_password:group_ID:users_list
- group_name – group name
- group_password – group password
- group_ID – ID generated by system
- users_list – lists of users which belongs to the group
4. ADDING GROUP
- groupadd group_name
5. GROUP MODIFICATON
-groupmod -g GID (change GID on new)
-groupmod -a new_group_name (change group name on new one)
-groupmod -o (allow to se GID on existing one)
6. GROUP DELLETING
- groupdel group_name