Permission denied (publickey, password) solution for SSH remote access

Install SSH service on windows

  1. Settings-"Applications-"Optional Features-"Add Features -" Install OpenSSH Server and OpenSSH Client
  2. Enter the service in the search bar in the lower left corner, and set the related SSH service to automatic (delayed start)

Insert picture description here

  1. Open the cmd interface, enter: ssh 用户名@目标ip地址to access
  2. Enter exit, or use ctrl + D to close remote access

Install SSH on ubuntu

If you need SSH to log in to other computers , you need to install openssh- client , which is installed by default in ubuntu.
If you need to connect to the machine remotely , you need to install openssh- server , and the program needs to be installed by yourself.

premise:

Make sure that the virtual machine has internet, you can try to open a webpage on the ubuntu built-in browser

Related commands:

To check whether the SSH service is installed or started: sudo ps -e |grep ssh
Check the SSH version: ssh -V
SSH server installation: sudo apt-get install openssh-server
SSH client installation: sudo apt-get install openssh- The client
starts the SSH service: sudo service ssh start or sudo service ssh restart
closes the SSH service: service ssh start or service sshd stop
Insert picture description here
notices that after closing SSH, ssh-agent still exists. It is an ssh agent program, used to facilitate the management of private keys.
ssh-agent is mainly used in the following two scenarios:
1. Use different keys to connect to different hosts, and specify the private key each time you connect;
2. When the private key is set with a password, you need to enter the password every time you use authentication, very troublesome.

Permission denied (publickey, password) solution for SSH remote access

Insert picture description here
 After making sure that the ssh service is turned on, the administrator password is correct, the IP address is correct, and the network is unblocked, I found that the user3 user was not created in my ubuntu, so the user name and user password must be wrong, just change to the user name of the virtual machine administrator. ; Or you can try to add a user3 user in ubuntu.

Add user

1. sudo useradd 用户名 -m, where -m: automatically create a user's login directory.
2. View all users: ls /home/
3. Set a password for creating a user: sudo passwd 用户名
4. Be sure to remember the password, otherwise you can only delete the user

delete users

sudo userdel  用户名

Guess you like

Origin blog.csdn.net/qq_41571459/article/details/113530829