@chinelo-obitube ・ Nov 24,2021 ・ 1 min read ・ 526 views ・ Originally posted on chineloobitube.medium.com
This is a simple beginner's tutorial where I will demonstrate how to ssh into an Ubuntu server with a new local user.
Why this tutorial; it is to show how different users can ssh into an Ubuntu/Linux server hosted on the Cloud (AWS, GCP, Azure), etc.
Steps to follow
3. Create a new user (chinel) and the goal is to ssh as chinel user instead of Ubuntu user.
Note: While creating the new user, remember to use
sudo adduser command.
4. Change from the ubuntu user to the new user I created which is chinel using the
5. Use the Linux command
ls -al to check for .ssh folder which will show you all the files in the directory including hidden files. We will see that there is no .ssh folder in our new user’s list of directories. To fix this, we need to add the public key that exists in the Ubuntu user’s
~/.ssh/authorized_keys file to Chinel user.
6. Logout of the chinel user using exit command. This will take you back to the ubuntu user.
7. Enter into /home/ubuntu/.ssh/authorized_keys and copy the content.
8. Change back to the chinel user and create a new .ssh directory.
9. Using vim editor, create a file called
authorized_keys inside the .ssh folder and paste the contents from /home/ubuntu/.ssh/authorized_keys copied earlier.
10. Exit and log out of the Ubuntu server.
11. Now I have my .ssh folder and my keys in the authorized_key file and can now ssh into my chinel user directly.
This is is a simple tutorial on how to ssh into an Ubuntu server/instance with a non-default user.
PS: This is my first article on Medium, please like and share. Thank you.
Join other developers and claim your FAUN account now!
Only registered users can post comments. Please, login or signup.