16 Jul 2016
Script to create a user if it does not already exist in Linux
Script to create a user if it does not already exist in Linux.
The gist below does the following:
- Check for SuperUser Privileges. If not present, It adds sudo before executing the commands that needs root/su privileges.
- Checks if the user already exists or not.
- Creates a new user with the given USER_NAME and PASSWORD.
Note: package ‘whois’ is reqiured for mkpasswd to work
sudo apt-get install whois