Penguin

1) Sometimes you want to add a user that does not have it's own home directory.

For example : I may want an xbox account that will only ever be used for accessing samba shares.

There is a nice switch when using the 'adduser' command to avoid creating a home directory.

  • --no-create-home

So in my xbox example I would do:

  • sudo adduser --no-create-home xbox

If instead you use the 'useradd' command simply leave out the '-d' switch.

2) What if when we add a user we want to say what groups it belongs to?

We use the -G switch and after this we can list (separated by commas) the groups to which we want the user to belong.

  • sudo useradd -G leech,blackthings,hugethings xbox

BUGGER but I have already added the user.

Not to worry. Use the 'usermod' command instead. For example:

  • sudo usermod -G leech,blackthings,hugethings xbox

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.

--- CategoryNotes