-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers
93 lines (60 loc) · 1.57 KB
/
users
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
83
84
85
86
87
88
89
90
Modify user and groups
user* {{{1
useradd, usermod, userdel, groupdel
low level, more control
useradd [-G group] name
Create new user + home dir
--btrfs-subvolume-home [-i basedir] [-m to create dir needed on Debian?]
create user home dir as a btrfs subvolum
basedir defaults to /home
gpasswd
may be safer alt to usermod because can change only one group at a time
-a <username> <groupname>
-a sammy wheel
getend password
show user passwd file entry
groups {{{1
usermod -aG <comma sep groupnames> user
append group to existing
groupadd, groupmod
getent group
show groups and members
shell {{{1
usermod -s <shell path>
change shell
lchsh $USER
Other utils {{{1
adduser
high level tool, depends on perl
package shadow-utils
Ubuntu: installed by default
Fedora: adduser is symlink to useradd
adduser -g wheel -m andmalc
adduser <username> <groupname>
add user to group <groupname>
addgroup
Display & Change Groups (old) {{{1
id [user] - see info page
id -nG = print user's groups with names (no ids) - same as groups cmd.
newgrp, sg
change effect group ID. Should be member of group to change to.
See man pages for differences
PAM
read Debian docs in libpam-doc package
Usergroup writable directories
add users to group
set group-id permission on dir
users have umask 002
Umask
subtracts permissions
set in /etc/login.defs
e.g.
files
umask 022 on files:
default file rw-rw-rw- (666)
umask (----w--w-) (022)
renders rw-r--r-- (644)
dirs
default directory permissions 777
umask 022
777-022=755 rwxr-xr-x