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.

#Creating user
adduser demo

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

cd /home/demo
mkdir -p .ssh
ssh-keygen

#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/
su demo
cd /home/demo/.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

Next, you’ll have to FTP into your server using WinSCP or FileZilla to transfer demo.pem to your local computer.

Great! You’ve successfully created a new username on a Debian Server.

You can SSH into the server using demo.pem as an identity key or use PuTTYgen to convert it into a .ppk file to be used in PuTTY.

3nz

3nz

Certified IT Professional with over 10 years of experience specializing in General IT Management, Web Development, Networking, Software Engineering.

Leave a Reply