Change SSH login address root[at]lalalala

Currently when I login to SSH the name is root@my-initial-droplet-name, how to change it to root@new-droplet-name?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, thanks for answering, but it seems your guide is to create new user, what I want is changing the name after @ on SSH command line, from root@my-initial-droplet-name to root@new-droplet-name.

Changing droplet name doesn’t change this SSH address. I already deleted the login detail on my winscp and recreate it, but doesn’t change anything either. Thanks

Add a new user, with sudo permissions

  1. copy your current root@ ssh key pair some place safe.
  2. generate a new key par for your non-root user with ssh-keygen - (keep it to a different place to your root keys).
  3. create another user on your droplet call him mrwww.
  4. You’ll need a way for your new user to become root. sudo or doas are god for this.
  • as root grant your new user access with echo 'mrwww ALL=(ALL) ALL' >> /etc/sudoers
  1. copy the .pub from the new key pair into ~mrwww/.ssh/authorized_keys, and chmod 0400 it.
  2. test your key will let you in with
  • ssh -i /path/to/new-id_rsa mrwww@yourdroplet
  1. test that you can do stuff as root
  • sudo touch /tmp/what
  • ls -l /tmp/what # this should show the file created by root.