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:
ssh subdomain.mydomain.com
It brings this error :
Permission denied (publickey)
But If I use any of this syntax:
ssh my_user@subdomain.mydomain.com
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).
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.
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:
and add the following line:
Save the file and exit. Then simply reload the .bashrc profile with this command:
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:
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
(nod
in the filename) does allow you set global options for thessh
client to use but more typical in these cases is the per-user config mentioned above.