![]() |
VOOZH | about |
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Senior Technical Writer at DigitalOcean
Building future-ready infrastructure with Linux, Cloud, and DevOps. Full Stack Developer & System Administrator. Technical Writer @ DigitalOcean | GitHub Contributor | Passionate about Docker, PostgreSQL, and Open Source | Exploring NLP & AI-TensorFlow | Nailed over 50+ deployments across production environments.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I have made a bash script to automate the setup process, hopefully this will be useful to someone else.
Followed all the steps for SSH key authentication but after the last step as root user
rsync โarchive โchown=anthony:anthony ~/.ssh /home/anthony and opening a new tab in my terminal, I still had to enter my passphrase after running ssh anthony@xxx.xx.xxx.xxx
After filling in my passphrase Iโm getting Connection closed by xxx.xx.xxx.xxx port 22
The last command as root should be:
$ rsync --archive --chown=sammy:sammy /root/.ssh/ /home/sammy/.ssh/
Otherwise the authorized_keys file is created in the userโs home folder.
Pretty useful, thanks
go through all this and then try to login with the user created in the install and it doesnโt work. Iโve done it 3 times and each time I get the same result. I canโt login with those credentials. Has something changed since you wrote these instructions? Or perhaps it would have been better to give various ways of installing, which you made reference to, instead of ONLY including the install process YOU believe is the best. Choices should be offered so users can choose which path they wish to take. As it is at the moment though, your tutorial fails.
Worked flawlessly for me. I expected an extra step though. Once I have my own user, with my own name, I would like to disable the root user completely.
The usermod -aG sudo sammy command didnโt work for me, weirdly. I also tried gpasswd -a sammy sudo. I ended up having to manually add my user to the /etc/sudoers file like so:
# User privilege specification
root ALL=(ALL:ALL) ALL
sammy ALL=(ALL:ALL) ALL
Warning: As explained here, you shouldnโt edit this file with a normal text editor (but I did, because yolo).
@bboucheron I followed the steps of this tutorial exactly on a completely fresh Ubuntu 20.04 droplet, so the tutorial might need updating? Could just be that my droplet was haunted. Very strange that a very basic command like usermod wouldnโt work though.
Edit: Tested on another fresh 20.04 server and had the same problem - very strange. I also tried upgrading all packages with apt upgrade, and then trying usermod again, but no luck.
Hello,
For anyone interested, I just created a similar video demo on how to do the initial server setup as described in this tutorial:
Hope that this helps!
Regards, Bobby
This comment has been deleted
After executing this command: rsync --archive --chown=sammy:sammy ~/.ssh /home/sammy
I am still asked for a password. Note that my ssh key file is named differently, it is not named id_rsa.
I know that on login I need to add the -i flag to indicate the name of the file, and this worked when logging in as root user, but not for this new user, please help.
Iโm logging in with this: ssh -i /home/MY_USER/.ssh/MYUSER_id_rsa MY_USER@MY.DROPLET.IP.ADDRESS
Where MY_USER is the name of the user I created, and notice my ssh key file is renamed, it is not id_rsa
Iโm getting this error: Warning: Identity file /home/MY_USER/.ssh/MYUSER_id_rsa not accessible: No such file or directory.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.