Cannot connect with ssh since update to Fedora core 31

To resolve this issue you have to commented out /etc/ssh/ssh_config

#PermitRootLogin yes

PermitRootLogin is valid in the /etc/ssh/sshd_config file; not the ssh_config file. The difference is that the sshd_config file controls the SSH server and the ssh_config file controls the client.

  1. OpenSSH client configuration file ssh_config
  2. OpenSSH daemon configuration file /etc/ssh/sshd_config

After gaining root, use systemd to restart the SSH daemon.

systemctl restart sshd

This is not the best approach. this is available in your server side.

Allow

openSSH default configuration file has two directives for both allowing and denying SSH access to a particular user(s) or a group.

Go to your remote server, and edit sshd_config file:

Allow SSH Access to a user or group

Add or edit the following line:

AllowUsers username

To allow an entire group, say for example root, add/edit the following line:

AllowGroups root

Those who are in the “root” group can be able to ssh to the remote server.

Restart SSH service to take effect the changes.

sudo systemctl restart sshd

Deny SSH Access to a user or group

Similarly, to deny a specific user from logging in via SSH, you simply use the DenyUsers or DenyGroups option with a list of users or groups to deny access respectively.

DenyUsers username

If you try to login as any of the above users, you will get permission denied.To deny a group of users of a group, you would add the following line to SSHd configuration file.

DenyGroups group

Restart SSH service to take effect the changes.

sudo systemctl restart sshd

Regards.,