summaryrefslogtreecommitdiff
path: root/3 resources/linux/Users.md
blob: 885a7cc92eba71695ad319aa90b3d05fb63a8a2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#linux #user-management 

Change uid/gid of user
`usermod -u newnumber user`
`groupmod -g newnumber user`

File permissions in homedir will be automatically updated; file perms outside home dir will not be automatically updated.

Finding files of a specific user, and printing their uid/gid;
`sudo find / -user 4109 -printf '%p %u(%U) %g(%G)\n'`

To change only the group: `chgrp`.

Or using find to chmod/chgrp:
`sudo find / -user 4109 -group 4109 -exec chmod 998:998 {} \;`
`sudo find / -group 4109 -exec chgrp 998 {} \;`

Dirty way to find "system users" (uid < 999) - note that this is not fool-proof, it also lists groups
`getent passwd | grep -oP '\b[0-9]{3}\b' | uniq | sort`

---
https://www.cyberciti.biz/faq/linux-change-user-group-uid-gid-for-all-owned-files/