I am creating a new user for a Linux Debian distribution.
I did use the command to create a new user via terminal, while I was logged in as root; tehn assigned the user to the sudo group, so I can install and run commands as superuser when needed (without swap with su).
Is there a sequence of commands to perform, to create a user, create the home folder, assign it to sudo group and such?
This is the sequence of commands that I performed:
<login as root>
useradd myuser
passwd myuser
adduser myuser sudo
usermod myuser -s /bin/bash
<logout and login as myuser>
At this point, I had no home folder set up; created one via sudo but obviously it has Root as owner, so I can't do anything inside it.
I had to use chown to change the home permission, although this doesn't seems right.
What else do I need to do, to have a proper user created?
adduser
anyway. Why not just runadduser myuser
, and skip thepasswd
andusermod
commands?adduser
has a--shell <SHELL>
option, but/bin/bash
would be the default. It doesn't have an option for extra groups, unlikeuseradd
, yes.