Fresh Fedora 36 Install. Cannot SSH Into Local Devices

I’ve only been using Linux regularly for around a year. After trying multiple distributions I landed on Fedora and really like it.

I installed Fedora KDE a couple nights ago from Fedora KDE Plasma Desktop but I noticed this morning that I am unable to SSH into my local devices.

These are devices I SSH into on a daily basis so know that the credentials are definitely correct but since installing Fedora running the command;
ssh deviceusername@
results in the error "Permission Denied, please try again.

After running the SSH command for the first time on each device I am asked to add it to my known hosts as usual. After entering yes I’m asked for my password which after entering/pasting I get the error above.

There are no other users setup on the system other than the one created during install. Iv checked my account page and the account is definitely set to Administrator. I attempted to SSH into 3 different devices to eliminate the issue being related to a specific device but the issue persists. As mentioned, these are devices I SSH into on a daily basis however my previous Linux experience is only with Manjaro & Ubuntu based Distro’s where I never had this issue.

A friend suggested running chmod -R 0600 /home/myusername/.ssh but running that resulted in the following error chmod: cannot access '/home/myusername/.ssh/known_hosts' Permission Denied.
Obviously I replaced “myusername” with my actual username.
Thinking about it now perhaps I should of added sudo to the start of the command ??

I’m far from being a Linux pro and have no idea what the issue is, especially since its a fresh install, so any help is hugely appreciated.

Thank you.

Definitely not. Doing so could dump root owned files in your home directly.

What you should do is check the owner of all your files in your home directory.

1 Like

Thank you for the reply. How would I check the owner? Iv never had to do this before as I’m the only person that ever uses this computer.

I assume you did ssh to fedora from other device? is it right? if yes, There are a few reasons why you could be getting a “Permission Denied” error when attempting to log in using SSH. If you receive this error, check for the following issues:

  • The password is incorrect
  • The SSH key is missing on your local computer
  • You are trying to use a password, but PasswordAuthentication is disabled in sshd_config
  • You are trying to use an SSH key, but key based authentication is disabled in sshd_config
  • The authorized_keys file has the wrong permission
    You can create authorized_key in your /home/username/.ssh with this command:
    $ touch ~/.ssh/authorized_keys
    $ chmod 600 ~/ssh/authorized_keys
    You can create your .ssh direktori with this command:
    $ mkdir -p ~/.ssh
    $ chmod 700 ~/.ssh
    You can create pair ssh key with ssh-keygen or man ssh-keygen for detail.
1 Like

No, the other way around. Im attempting to SSH into other devices, from Fedora.

If in other way, you can check configuration for your ssh server with my reply above. I think fedora default installed ssh client and all linux distro installed by default ssh client. Check your port ssh server is open? default is 22, you can check with this command:
nc -v ip_address_ssh_server port_number

1 Like
find ! -user myusername -exec ls -dl {} +

As far as linux is concerned there is at least one other person: the sudo person. Everytime you use sudo you impersonate someone else. That “someone else” might create files in your home directory that you do not have permission to open.

1 Like

ls -la .ssh should show that the directory is only accessible by you, and all contents are only accessible by you. Otherwise ssh and friends won’t trust your keys and hosts.

[me@my-laptop ~]$ ls -la .ssh
drwx------  2 me me 4.0K Jun 17 08:33 ./
drwx------ 18 me me 4.0K Aug 10 07:56 ../
-rw-------  1 me me  411 Jun 17 08:33 id_ed25519
-rw-------  1 me me 6.3K Jun 28 06:53 known_hosts

This is the most common source of problem on your client computer, that is, the one from which you are running the ssh command. If you don’t see permissions like that, then chmod 700 .ssh ; chmod 600 .ssh/*

1 Like

Use the verbose switch -v to debug ssh client login failures:

ssh -v  user@ip.address

During installation steps there was a tab to create a root account and a user account. I created the user account set as admin & when I went back the root account tab was greyed out and shown as “disabled” should I of created a root account as well?
I don’t think iv ever encountered this with my previous Ubuntu based distros so I could possibly of made an error perhaps?

Kind regards.

Creating a root account separately is not necessary and unrelated to this problem. No worries here. Check the permissions and as suggested above, try adding -v when using ssh.

The root account will always be there. What it does not have is a valid password. And it doesn’t need one as you can use sudo to impersonate the root account. In Ubunto it doesn’t even ask you if you want to create a password for the root accmount.

To test

[vek@newbox ~]$ sudo touch testfile
[vek@newbox ~]$ ls -l testfile
-rw-r--r--. 1 root root 0 Aug 11 16:50 testfile
[vek@newbox ~]$ touch mytestfile
[vek@newbox ~]$ ls -l mytestfile
-rw-r--r--. 1 vek vek 0 Aug 11 16:51 mytestfile
[vek@newbox ~]$ 

Here testfile was created by the user root as can bee seen by then name in the third column. The file mystestfile was created my me and I am the owner of this file, and root is the owner of the other file. Now I do not have permission to modify testfile.

[vek@newbox ~]$ echo test > testfile
bash: testfile: Permission denied
[vek@newbox ~]$ 

Try that on Ubuntu or any other unix or linux system you get the same result.

I assume that one of the files in our .ssh directory is owned by root and that is why you have the problem you have. And the reason could be that someone did sudo ssh.