我有一个无聊的项目,提供了ansible。
对于ssh设置,我使用:
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
问题是我使用GUI启动VM
vb.gui = true
已经安装了ansible lightdm-gtk-greeter-settings,
但系统要求我输入ubuntu的用户密码,而不是无业游民的用户。
这是我要解决的问题。
作为一种解决方法(因为我不知道ubuntu的用户密码),我登录了vm并手动进行了更改。无聊的ssh sudo passwd ubuntu但是我仍然想知道背后的秘密。
这是我的Vagrantfile
https://github.com/valentin-nasta/development-environment/blob/master/Vagrantfile
似乎没有将流浪者用户添加到官方流浪者ubuntu / trusty框https://atlas.hashicorp.com/ubuntu/boxes/trusty64上的sudoers中
解决的办法是将这些行添加为内联外壳配置:
# provision
config.vm.provision :shell, inline: <<-SHELL
# Set up sudo
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
# Setup sudo to allow no-password for "sudo" commands
usermod -a -G sudo vagrant
SHELL
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句