ssh connection ubuntu access denied (access denied)

Most of the online solutions to ssh connection ubuntu access denial are to install ssh or firewall to open ports, etc., but after all these are all right, the access is still denied, then consider that the ssh package may have a problem with the installation, and you can try to reinstall it. The process is as follows:

1. Uninstall ssh on ubuntu

sudo apt-get remove openssh-server
sudo apt-get remove openssh-client

2. Delete the /etc/ssh folder (this step is critical!)

cd /etc
sudo rm -r ssh

3. Reinstall ssh

sudo apt-get install openssh-server
sudo apt-get install openssh-client

An error occurred during reinstallation, unable to install, error message:

Not replacing deleted config file /etc/ssh/sshd_config

 Considering it is an uninstall problem, perform a cleanup

sudo apt purge openssh-server

If it cannot be cleared, first change the contents of the /var/lib/dpkg/info/openssh-server.postrm file to

#!/bin/sh
exit 0

Uninstall and then install

sudo apt-get install openssh-server

reference:

About ubuntu refuses to be accessed by ssh_ubuntu refuses ssh connection_wzg2016's blog-CSDN blog

Error installing openssh-server Ubuntu 20.04.2 LTS - Ubuntu Forums

Guess you like

Origin blog.csdn.net/dou3516/article/details/129164514