Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The key was copied well and shows exactly the same in userlocalhome/.ssh/id_rsa.pub as in userserverhome/.ssh/authorized_keys. However, the server keeps asking me for a password. Did I miss something?
Shouldn't you be editing /etc/ssh/sshd_config instead?
Apologies, there was a 'd'... Now it says
Code:
Permission denied (publickey).
Does it take another configuration? Maybe it's because my DHCP hasn't any domain name set up and the authorized_keys shows user@name-of-the-local-host?
Last edited by thomasbb; 12-31-2020 at 06:49 AM.
Reason: add info
Did you restart the sshd service?
Careful if you aren't 100% sure that Key login works.
You could lock yourself out.
Do you have physical access to the server?
The server is an old PC I configured as a router and it's by my desk, so I can reconfigure it physically when needed.
The service is restarted but it still doesn't accept my key... Thank you for the link
It was commented but it seems to be the default value. If I uncomment it and restart the service, it still doesn't work. But if I comment the PasswordAuthentication no line, then I can connect with ssh useronserver@IP-of-the-server. The same happens if instead of the IP I use the hostname of the server.
You can connect but I assume you need to enter your password.
Make sure the ~/.ssh directory is owned by your user_on_server and has permissions 700 i.e. drwx------
The ~/.ssh/authorized_keys file should also be owned by your user_on_server and have permissions of 600 i.e. -rw-------
Using the ssh -v option shows additional debug messages which might lend a clue to why keys are not working.
It's named id_rsa_router, and I made another one named id_rsa_router_2048 with less encryption. But apparently the client uses none of them... Regarding the access rights, I had checked them
In that case the key name must be used on the command line via the -i option or you can use a ~/.ssh/config file to automatically use user defined directives.
Code:
Host My_Server
HostName IP_address or hostname
User user_on_server
IdentityFile ~/.ssh/id_rsa_router
In that case the key name must be used on the command line via the -i option or you can use a ~/.ssh/config file to automatically use user defined directives.
Code:
Host My_Server
HostName IP_address or hostname
User user_on_server
IdentityFile ~/.ssh/id_rsa_router
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.