Being new to Linux administration, I'm a little confused about the following commands:
useradd
usermod
groupadd
groupmod
I've just finished reading the user administration book in the Linux/Unix Administrator's handbook, but some things are still a little hazy.
Basically useradd seems straight forward enough:
useradd -c "David Hilbert" -d /home/math/hilbert -g faculty -G famous -m -s /bin/sh hilbert
I can add "David Hilbert" with username hilbert , setting his default directory, shell, and groups. And I think that -g is his primary/default group and -G are his other groups.
So these are my next questions:
- Would this command still work if the groups
facultyandfamousdid not exist? Would it just create them? - If not, what command do I use to create new groups?
- If I remove the user
hilbertand there are no other users in those groups, will they still exist? Should I remove them? - After I run the
useraddcommand above, how do I remove David from thefamousgroup, and reassign his primary group tohilbertwhich does not yet exist?