I’m going to teach you how to create a new username on an Ubuntu Server or on any other Debian system on AWS.
For all commands, replace demo with your preferred username
1. First, you’ll have to create a new user.
2. Give root privileges to the new user
#Adding sudo privileges
gpasswd -a demo sudo
3. Generate a new SSH key pair
#Generate Key Pair
mkdir -p .ssh
#Hit return to accept this file name and path (or enter to continue).
#Enter passphrase to encrypt the key.
4. Manually install the ssh key by entering the following commands.
sudo chmod 700 .ssh
mv id_rsa.pub id_rsa .ssh/
mv id_rsa.pub authorized_keys
sudo chmod 775 authorized_keys
5. Export id_rsa to your local computer.
sudo chmod 775 id_rsa
mv id_rsa demo.pem
mv demo.pem /home/ubuntu
Great! You’ve successfully created a new username on a Debian Server.