How to create a new user with password less sudo configuration in Centos 9?

How to create a new user with password less sudo configuration in Centos 9?

Creating new user in Centos/Fedora/RHEL,

# useradd test-user

Setting password for new user created,

# passwd test-user

Once entered above command, prompt user password and confirmation like below,

Changing password for user test-user.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

Setting sudo permission without password for new user ‘test-user’,

# echo "test-user ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/test-user

creates entry in ’/etc/sudoers.d/test-user’ file

test-user ALL=(root) NOPASSWD:ALL

update file permission mode,

# chmod 0440 /etc/sudoers.d/test-user

switch to test-user,

# su - test-user

Setting password less sudo configuration to test-user,

[test-user@localhost]$ echo -e "\n$USER ALL=(ALL) NOPASSWD: ALL\n" | sudo tee -a /etc/sudoers

SUSER is replaced with current user,

$ test-user ALL=(ALL) NOPASSWD: ALL




Python installation

Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^