Bash script to log in to a Linux server and set up a new user
This is a devops tool to create accounts with sane defaults on remote servers. It's useful for people who need to manage a lot of servers, eg. AWS, and need to grant access to other people.
This script does several things in a row:
- Create a new user account on a target machine
- Add a public ssh key to the new account
- Add a private ssh key too (so you can ssh from the new machine to additional machines, eg. rsync between environments)
- Add the new user to
sudo
andwww-user
groups - useful for sysadmins on a web server
For best results, you'll need the following:
- Bash terminal emulator (eg. "Terminal" on Mac OS X)
- Existing super user credentials for your target server
- Optional: SSH key for your new user. You can upload both a public key and a private key if you want.
Follow these simple steps:
- Gather all the necessary information (see "What do I need?" above)
- Run the script:
sh createNewSSHUser.sh
- The wizard will ask you a few questions. Then you can sit back and watch the magic happen!
Are you wishing for more? Feel free to contribute with a pull request!