Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Ubuntu 16.04 - Creating New User and Adding SSH Keys
I am following the tutorial to add an SSL certificate to the Ubuntu 16.04 droplet, but in the instructions it is recommended this is not done through the root user, but rather a super user. As a result, I created a separate user and added it to a super user group, but I’m getting hung up on the step that adds ssh keys to this user.
First, I should switch to the user via
su - *username*, which should take you to the
/home directory of the user. When I check the path with
pwd it shows
/home, but when I run
who I am shown as the root user. Is this the correct behavior since I’m still technically logged in under root, but sudoing into this user?
I am then asked to create the
~/.ssh/id_rsa.pub with my ssh-key, but it already exists when I run the commands. Side note: I created this user a while back and may have added them then, but not sure. I decided to move on since they exist.
I tried to ssh into my user and it successfully connects, but then immediately closes. Any reason why that might be? Any help to point me in the right direction would be great!
ssh firstname.lastname@example.org email@example.com's password: Welcome to Ubuntu 16.04 * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as System load: 0.08 Processes: 76 Usage of /: 19.8% of 19.56GB Users logged in: 0 Memory usage: 42% IP address for: 220.127.116.11 Swap usage: 0% Graph this data and manage this system at: https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Jun from xxx.x.xx.x.x.x Connection to 18.104.22.168 closed.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×