Connect to the virtual machine created by vagrant through xshell (centos 7)

method one

1. Find your private_key

Insert picture description here

Second, import it into your Xshell

  • Enter your login name:vagrant
  • Input secret key
    Insert picture description here
    User secret key, import
    Insert picture description here
    OK

Three, login successfully

Insert picture description here
No need to enter any password, login method similar to ssh
login is your vagrant account

Insert picture description here
Log in as your root user

su root

Type your password (vagrant default password)

Insert picture description here

Method Two

  • Configure root password
  • Enter the virtual machine just created
vagrant ssh 
  • Use command to enter root user
su root
password:vagrant
  • Modify sshd_config so that the root user can log in with a password
vi /etc/ssh/sshd_config

Insert picture description here

  • To
PasswordAuthentication yes

Enter passwdchange password
Insert picture description here

Account: vagrant
Password: vagrant

reboot  #重启

login successful
Insert picture description here

Account: root
Password: vagrant

Insert picture description here
Insert picture description here
login successful!!!

Guess you like

Origin blog.csdn.net/weixin_44763595/article/details/110094424