I have a bunch of computers I'm trying to connect to each other with some random router I found lying around. I have all the machines connected to the router and have given them fixed IPs. I have used ssh before and I thought it would be super easy just remote-control the other machines with ssh, but for some reason I get this "permission denied, please try again"-error.

I've tried making firewall adjustments, various conformations of the /.ssh/sshhd_config, but nothing works. I'm at least sure that the machines can "see" each other, since when I enter the IP I'm asked for the password of a username@machinename of the computer I know I'm connecting to.

I'm worried that I may have some configurations to do with my router, or that I'm somehow giving bad static IPs, but in those regards I don't have a first clue about what to do. Do you guys have any other suggestions as to what might be wrong?

Oh yeah, I'm using Ubuntu 20.04.

  • 2
    usually permission denied with ssh means your user authentication failed. ssh key? password? trying to ssh as root (normally disabled)?
    – user10489
    Nov 29 '21 at 5:24
  • Adding a lot of -v to your ssh command give information about what happens. The sshd log on the server might even say explicitly what is wrong. Nov 29 '21 at 13:58

It is most likely a problem with permissions. For security reasons, this is the required/recommended list of permissions for the files that most typically give problems to users:

  • directory ~/.ssh: 0700 (drwx------)
  • file ~/.ssh/authorized_keys: 0600 (-rw-------)
  • file ~/.ssh/config: 0600 (-rw-------)
  • file ~/.ssh/id_rsa (or other private keys): 0600 (-rw-------)

For more details, see 1. Please check that and post feedback.

If that doesn't work, you might check file /etc/ssh/sshd_config. If you have PasswordAuthentication no, change it to yes. Depending on other settings, simply commenting it might work as well. Then restart the service with sudo service sshd restart. You mention you introduced changes to this file, I don't know which were these.

If that doesn't work, I suggest you post the output of the commands below. Further try to interpret that, you may find the answer yourself. And check the links below, they may also help.

$ cat /etc/ssh/sshd_config
$ ssh -v ...
$ ls -al ~/.ssh
$ ls -ald ~/.ssh


  1. SSH error: Permission denied, please try again
  2. https://www.digitalocean.com/community/questions/permission-denied-please-try-again-error-in-ssh
  3. https://serverfault.com/questions/288223/loggin-in-ssh-server-permission-denied-please-try-again
  • Thank you for your reply. I notes that node1 doesn't have the file ~/.shh/id_rsa, and none of the nodes has the files ~/.ssh/config. Was this a type-o on your part or does it indicate some permission issue? I tried now to change the permissions as you said, to the extent that the files exists, but without solving the problem. Posting to above mentioned outputs in a bit. Nov 29 '21 at 9:51
  • $ sudo ls -al ~/.ssh total 28 drwx------ 2 carl-johan carl-johan 4096 nov 26 12:59 . drwxr-xr-x 27 carl-johan carl-johan 4096 nov 25 11:20 .. -rw------- 1 carl-johan carl-johan 2602 nov 26 12:56 authorized_keys -rw-r--r-- 1 carl-johan carl-johan 570 nov 26 12:56 authorized_keys.pub -rw------- 1 carl-johan carl-johan 1381 nov 24 16:53 id_dsa -rw-r--r-- 1 carl-johan carl-johan 606 nov 24 16:53 id_dsa.pub -rw-r--r-- 1 carl-johan carl-johan 1110 nov 26 13:00 known_hosts Nov 29 '21 at 9:59
  • Sorry I have to ask a very ignorant question, how do I post the outputs without making them look like crap and also make them fit the limited character count? Nov 29 '21 at 10:01
  • 2
    @FilterFeeder - You should post any additional info in the question itself, and format it as code. Otherwise, people have to read many disperse pieces of information... that may make more difficult for people to help you. Nov 29 '21 at 11:39
  • .ssh/config and .ssh/id_rsa are in local node (the one you connect from), .ssh/authorized_keys is on distant node (where you connect to (and can be 644))
    – Archemar
    Nov 29 '21 at 14:56

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.