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.


Solution 1:

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

Related:

  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