Reference the Vagrant box ubuntu/xenial64のubuntuユーザのpasswordについて
1. You can use vagrant ssh to login to Ubuntu/xenial64 's terminal via Git Bash
2. Enter in the terminal: Vim
useradd.sh File Contents
#!/bin/bashset -ceuuser="vagrant"" Vagrant"をsha- でハッシュ password'print crypt (" Vagrant "," \$6\$ "); ' -P ${password}-M ${user}
Copy the content into the open editor, and then press ESC to enter ": W useradd.sh"
3. Executive useradd.sh
Sh./useradd.sh
After execution, you can try the su vagrant command, using the user name: vagrant, Password: vagrant to switch users.
4. After switching to vagrant, perform the sudo apt-get update, prompting "vagrant is not in the sudoers file. This incident would be reported. " The message.
5. Enter exit in Git bash, exit the current vagrant login user, and switch to the default Ubuntu user.
Next, you need to add the vagrant user to/etc/sudoers
1. Add Write permission to the file. That is, enter the command "chmod u+w/etc/sudoers".
2. Edit the/etc/sudoers file. Enter the command "Vim/etc/sudoers", go to edit mode, find this line: "Root all= (All) All" add "vagrant all= (All)" below, and then save the exit.
3. Revoke the Write permission of the file. Enter the command "chmod u-w/etc/sudoers".
4. Try to switch to the vagrant user, enter the command "Su vagrant", enter the password: vagrant, try to run "sudo apt-get update", Prompt for the password, enter the vagrant password again, you should execute sudo apt-get Update command.
Note : Add vagrant User in order to be able to use a software can be logged in via SSH, the author added the purpose of the user is to be able to log in through the XSHELL5 software to xenial.
Reference:
Vagrant box ubuntu/xenial64のubuntuユーザのpasswordについて Add Vagrant User
- Ubuntu trick is not in the Sudoers file workaround to resolve the vagrant user's absence from the sudoers file
- Vagrant ' s Ubuntu 16.04 vagrantfile default password
Vagrant box ubuntu/xenial64 no password solution