VOOZH about

URL: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04?comment=89651

โ‡ฑ Initial Server Setup with Ubuntu 20.04 | DigitalOcean


Not using Ubuntu 20.04?
Choose a different version or distribution.
Ubuntu 20.04
๐Ÿ‘ Initial Server Setup with Ubuntu 20.04

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Senior Technical Writer at DigitalOcean

๐Ÿ‘ Vinayak Baranwal
Vinayak Baranwal
Editor
Technical Writer II
See author profile

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.

Still looking for an answer?

Was this helpful?

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.

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

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.

๐Ÿ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOceanโ€™s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow โ€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

ยฉ 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.