via command ssh localhost
You can check whether the ssh service has been installed
As shown in the figure below , the ssh service has been installed
If the following situation occurs, it means that the ssh service has not been installed on the machine
ssh localhost
ssh: connect to host localhost port 22: Connection refused
First, let's talk about how to uninstall the ssh service .
1. Completely uninstall the ssh serviceapt-get purge openssh-server
2. Update the source list (the latest SSH service can be installed)
sudo apt-get update
3. Install SSH service
sudo apt-get install openssh-server
Enter the following command and the system will automatically install the ssh service.
4. The first step after installing the SSH service is to open the SSH service sudo /etc/init.d/ssh start
sudo /etc/init.d/ssh start
ps -e|grep ssh
6212 ? 00:00:00 sshd
6. After the startup is complete, you can modify the ssh configuration
gedit /etc/ssh/sshd_config
7. Next is Some errors and solutions
PS1: You need to enter the passcode for the first connection, and you don't need to enter the passcode in the future. Is it safer to enter the SSH account password without entering it?
PS2: Restrict IP access to SSH, the server will be more secure.
vi /etc/hosts.allow
sshd:172.16.XX:allow #Write 172.16.XX/172.16.0 (segment) in the last line
vi /etc/hosts.deny
sshd:ALL
PS3: Assuming you want to delete the public key, in SECURECRT Do not select the public key when connecting, and then enter the SSH configuration file and modify it as follows:
1. Comment #AuthorizedKeysFile %h/.ssh/authorized_keys
2. PasswordAuthentication yes
PS4: When using SecureCRT to connect, it prompts: unable to authenticate using any of the configured authentication methods
Solution: PasswordAuthentication yes
If there is an error, please correct me.