Linux create user

In this tutorial, I will guide use useradd create user in linux. The memo complete linux create user and how to user run sudo command with no password.

Create user with useradd command

Create User test with option:
Specific user ID: -u 1234
Specific Group ID: -g 1002
Specific a Group IT and vboxusers: -G IT,vboxusers
Specific bash shell: -s /bin/bash
Specific the directory: -d /home/test
Specific password: Whoami12345678

Running useradd command as below:
sudo useradd test -d /home/test -s /bin/bash -u 1234 -g 1002 -G IT,vboxusers  ; echo -e "Whoami12345678\nWhoami12345678\n" | sudo passwd test

Use id command verify
[huupv@huupv ~]$ id test
uid=1234(test) gid=1002(IT) groups=1002(IT),981(vboxusers)

User run sudo command with no password
[huupv@huupv ~]$ echo "test ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers

To check
[huupv@huupv ~]$ sudo visudo -c

Verify, you can run sudo without a password
[huupv@huupv ~]$ sudo cat /etc/hosts

The result, Linux create user

Linux create user


Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6