conecct with domain name insted of user and IP

I’m working on a Virtual Machine where I have Ubuntu Server, in that server I connect to my Droplet (Ubuntu as well), via ssh , but when I tried to login with this syntax:


It brings this error :

Permission denied (publickey)

But If I use any of this syntax:

ssh my_user@Droplet_IP

I login without a problem. So I was just wondering If the first syntax is wrong or I have something messed up within sshd_config file or my Droplet firewall service configuration (just my IP can access to my droplet).

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.

Hello, @k0r3n

If you use the ssh command without specifying the user a session will be created with the user that is currently in use on your Virtual Machine. This is the reason this works fine when you specify the username.

You can follow up the example above which or simply create an alias in your .bashrc profile for quick access.

You can open the file with any text editor:

sudo nano ~/.bashrc

and add the following line:

alias dropletssh='ssh my_user@Droplet_IP'

Save the file and exit. Then simply reload the .bashrc profile with this command:

source ~/.bashrc

Now if your type dropletssh in the command line (terminal) you will connect to your droplet.

Hope that this helps! Regards, Alex

The short answer is… you can configure the ssh client with a simple text file located here:


(~ is a shortcut to your Ubuntu VM user’s home directory)

Inside that file these lines would provide the behavior you want:

    User my_user

Just as an aside, the /etc/ssh/sshd_config manages the SSH service running on an ubuntu server, not the ssh client you use to connect to one. /etc/ssh/ssh_config (no d in the filename) does allow you set global options for the ssh client to use but more typical in these cases is the per-user config mentioned above.