Annotated edit history of
AdduserNotes version 4 showing authors affecting page license.
View with all changes included.
Rev |
Author |
# |
Line |
1 |
BenStaz |
1 |
!1) Sometimes you want to add a user that does not have it's own home directory. |
|
|
2 |
For example : I may want an xbox account that will only ever be used for accessing samba shares. |
|
|
3 |
|
|
|
4 |
There is a nice switch when using the 'adduser' command to avoid creating a home directory. |
|
|
5 |
|
|
|
6 |
*--no-create-home |
|
|
7 |
|
|
|
8 |
So in my xbox example I would do: |
|
|
9 |
|
|
|
10 |
*sudo adduser --no-create-home xbox |
2 |
BenStaz |
11 |
|
|
|
12 |
If instead you use the 'useradd' command simply leave out the '-d' switch. |
|
|
13 |
|
|
|
14 |
!2) What if when we add a user we want to say what groups it belongs to? |
|
|
15 |
|
|
|
16 |
We use the -G switch and after this we can list (separated by commas) the groups to which we want the user to belong. |
|
|
17 |
|
|
|
18 |
*sudo useradd -G leech,blackthings,hugethings xbox |
|
|
19 |
|
|
|
20 |
!BUGGER but I have already added the user. |
|
|
21 |
|
|
|
22 |
Not to worry. Use the 'usermod' command instead. For example: |
|
|
23 |
|
|
|
24 |
*sudo usermod -G leech,blackthings,hugethings xbox |
3 |
BenStaz |
25 |
|
|
|
26 |
Note: If the user you modify is part of a few groups and you forget to list one or more of them then the user will be removed from those groups. To avoid this happening use the -a switch so we append, and not overwrite. |
4 |
CraigBox |
27 |
|
|
|
28 |
--- |
|
|
29 |
CategoryNotes |