users and groups

how to add new user

useradd -m -d /home/peurapi -c "Pirjo Peura" peurapi
usermod -aG wheel peurapi
usermod -aG sshallowed peurapi
passwd peurapi

oneliner

useradd -m -d /home/testuser/ -s /bin/bash -G sudo testuser

-m creates the home directory if it does not exist.

-d overrides the default home directory location. -s sets the login shell for the user.

-G expects a comma-separated list of groups that the user should belong to.


# add user oneliner

read -p "What is your desired username? " new_user && read -p "Write some comment? " new_comment &&  useradd -G wheel,sshallowed -c "$new_comment" $new_user && passwd $new_user

useradd -G wheel,sshallowed -c "Comment" username && passwd username