Created
December 14, 2020 11:27
-
-
Save bernard-ng/552b448a50e9f95cf327f9657c0e910e to your computer and use it in GitHub Desktop.
create user and grant sudo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cut -d: -f1 /etc/passwd # list users on the server | |
sudo useradd --create-home username # create user and home directory | |
sudo passwd username # set password for user | |
usermod -aG sudo username # add user to sudo group | |
echo "username ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/username # create a sudoer file | |
userdel -f username # delete user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment