How I connect by ssh after configure my vps droplet?

Hello, I create and change the configuration of one user diferent of root, for permissions is like a root. and i create the public key and paste into a ‘/home/<newuser>/.ssh/authorized_keys’ file, I do that exactly:

ssh <newuser>@ sudo mkdir .ssh sudo chmod 0700 .ssh sudo touch .ssh/authorized_keys sudo chmod 0644 .ssh/authorized_keys sudo chown <newuser> ~/.ssh -R sudo nano .ssh/authorized_keys // i paste the pub key here a goout
// saving file sudo nano /etc/ssh/sshd.config

// in this file I put that Port 222 PubKeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys PermitEmptyPasswords no PermitRootLogin yes // by the moment

// I go out saving file

sudo systemctl restart sshd.service // restart service exit

// now in my local ubuntu

ssh -p 222 <newuser>@

// the response from server is that: debug1: connect to address port 222: Resource temporarily unavailable // its the same that i treat to connect whit root

ssh -p 222 root@

you can help me what´s happend?

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 there,

I could suggest a couple of things:

  • I would set the permissions to 600 rather than 644 for extra security:
sudo chmod 0600 .ssh/authorized_keys
  • Also if you have a firewall like ufw, make sure to open port 222, as the error that you are getting indicates that your local PC is unable to connect to the Droplet on that port.

  • You can add the -vvv argument to your SSH command for some extra debug information:

ssh -vvv -p 222 <newuser>@

Let me know how it goes! Regards, Bobby