Created
February 17, 2025 21:38
-
-
Save Vaneeza-7/7cc6a0628b66be71baa680fb60b5bf74 to your computer and use it in GitHub Desktop.
Create new sudo user on Ubuntu
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
#!/bin/bash | |
clear | |
createUser(){ | |
sudo adduser newUserName --force-badname | |
} | |
giveAdminRights(){ | |
sudo usermod -aG sudo newUserName | |
} | |
checkRights(){ | |
groups newUserName #to check if admin rights have been granted | |
} | |
switchUser(){ | |
sudo su - newUserName | |
} | |
createUser | |
giveAdminRights | |
checkRights | |
switchUser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment