-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUsers_and_Groups.txt
97 lines (69 loc) · 2.91 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
83
84
85
86
87
88
89
90
91
92
93
94
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2016-10-22T18:02:37+02:00
====== Users and Groups ======
Created lørdag 22 oktober 2016
**#** **List files owned by a user or group **
$ find / -group <//GROUP_NAME>//
$ find / -user <USER_NAME//>//
**# Who is logged in**
$ w
**# Who are you logged in as**
$ whoami
==== User Directories ====
**# To create the typical directories - Desktop, Document, Download etc.**
**#** **This can easily be done with **//xdg-user-dirs//
$ pacman -S xdg-user-dirs
**# Then create the directories**
$ xdg-user-dirs-update
**# To change the default directories, you can edit **//~/.config/user-dirs.dirs//
==== User management ====
**#** **To see all users : **sudo passwd -Sa
**#** **Getting UID's : **id -u //<USER_NAME>//
== Adding a user ==
**# Adding users can be done with** //useradd //**- set password after creating the user.**
-G **= add user to additional groups**
-m **= create a /home folder for the user**
-s **= path to default login shell**
**# Creating the user and setting the password**
$ useradd -m -G wheel -s /bin/bash //<USER_NAME>//
$ passwd //<USER_NAME>//
== Delete user ==
**#** //-r// **removes the home directory for the user**
$ userdel -r //<USER_NAME>//
== Change login name ==
$ usermod -l //<NEW_NAME> <OLD_NAME>//
== Change home directory ==
**#** -m **creates the required folders and move the content there**
$ usermod -d ///my/new/home// -m //<USER_NAME>//
== Add user to a group ==
$ usermod -aG //<ADDITIONAL_GROUPS> <USER_NAME>//
# **Or **
$ gpasswd --add //<USER_NAME> <GROUP_NAME>//
== Remove user from a group ==
**# If the user is logged in, changes will take affect after logout**
$ gpasswd -d //<USER_NAME> <GROUP_NAME>//
== Expire password requiring them to create a new on first login ==
$ chage -d 0 //<USER_NAME>//
==== Group management ====
**#** **List groups that a user is member of **
$ groups //<USER_NAME>//
**#** **List all groups on the system **
$ cat /etc/group
**#** **Create a new group **
$ groupadd //<GROUP_NAME>//
**#** **Delete group **
$ groupdel //<GROUP_NAME>//
== User groups ==
**# Below is a list of general user groups.**
**# users can, and sometimes have to, be added to these groups without worries.**
adm **# admin group, similar to wheel**
ftp **# access to file-server by ftp-servers**
games **# access to some game software**
http **# access to files served by the HTTP server**
log **# access to logs in **///var/log///
rfkill **# access to control wireless power (TX-power)**
sys **# access to administrate printers**
users **# standard user group**
uucp **# RS-232 ports and their connected devices (old keyboard, printer, mouses etc)**
wheel **# administration group commonly used to give access to **//sudo/su//** none is set by default**