Created
March 20, 2018 06:04
-
-
Save codarrenvelvindron/a313b1c53b9411c8fda9f40acd2c5403 to your computer and use it in GitHub Desktop.
Create sudo account and automatically switch to it through a shell script. Must be run as root. Works on Ubuntu, Fedora and should work on other linux distros as well.
This file contains 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
#!/usr/bin/env bash | |
#Add sudo user | |
echo "Enter account name to make sudo" | |
read account | |
adduser $account | |
echo "Done.." | |
#Adding username to sudo group | |
echo "Adding $account to sudo" | |
usermod -aG sudo $account | |
echo "Done.." | |
#Switching to sudo user | |
su - $account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment