Vagrant box ubuntu/xenial64 no password solution

Source: Internet
Author: User
Tags exit in

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:

    1. Vagrant box ubuntu/xenial64のubuntuユーザのpasswordについて Add Vagrant User

    2. Ubuntu trick is not in the Sudoers file workaround to resolve the vagrant user's absence from the sudoers file
    3. Vagrant ' s Ubuntu 16.04 vagrantfile default password

Vagrant box ubuntu/xenial64 no password solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.