diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-01-19 21:14:51 +0100 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-01-19 21:14:51 +0100 |
commit | 9642cd7ae24f0ba79ce5647c709b35ae8f06a285 (patch) | |
tree | ae25c3b0db7ae4c23186b294c6d000073f085c2d /3 Resources/Linux/Users.md | |
parent | 969b96c2531fb986f6c7f21fd544391b439defd7 (diff) |
vault backup: 2025-01-19 21:14:51
Diffstat (limited to '3 Resources/Linux/Users.md')
-rw-r--r-- | 3 Resources/Linux/Users.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/3 Resources/Linux/Users.md b/3 Resources/Linux/Users.md new file mode 100644 index 0000000..885a7cc --- /dev/null +++ b/3 Resources/Linux/Users.md @@ -0,0 +1,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/ |