1

I am trying to connect to a my SSH server (running on Ubuntu 16.04.2 LTS) from my local machine (Ubuntu 18.04.03 LTS).

I have created a private and public key on my local machine and copied my public key to my SSH server's authorized_keys file.

I could log in with ssh root@ip-address and I have access (as root user), but when I tried to log in as another user with command ssh name@ip-address, it generated an error message:

name@ip_address: Permission denied (publickey)

What can I do so the name@ip-address could be accessed?

3
  • What OS/releases are you using on client/server? root logins are not normal for Ubuntu and usually disabled. – guiverc Dec 19 '19 at 5:18
  • @guiverc my server is using Ubuntu 16.04.2 LTS, and Ubuntu 18.04.3 for my client – tokmbo Dec 19 '19 at 5:22
  • Alright, I made mistake. I didn't know that each user has their own authorized_keys. So I only add the public key on root's, after adding the key to this user, I can log in using it. – tokmbo Dec 19 '19 at 6:19
0

Step 1: Open sshd_config file

sudo nano /etc/ssh/sshd_config

Step 2: Change the following lines

PermitRootLogin prohibit-password to PermitRootLogin yes 
PasswordAuthentication no to PasswordAuthentication yes

Step 3:restart ssh service:

sudo service ssh restart
0

Here are a few of the first things I would check.

*- Make sure the key in the authorized key file is marked as trusted.

  • Make sure the account you are trying to use has ssh privileges.

  • Make sure there are no typos in the username.*

This page can tell you a lot about how to use ssh keys.

This page can tell you more about ssh keys.

OTHER IDEAS

*- If you want to check the account and make sure it has the proper privileges you can use command id to see the user groups.

  • Check your /etc/ssh/sshd_config file to be sure you have the correct settings for ssh users.*

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.