默认情况下以root身份登录无业游民 [英] vagrant login as root by default

查看:124
本文介绍了默认情况下以root身份登录无业游民的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:通常我在框中输入的第一个命令是su -.

Problem: frequently the first command I type to my boxes is su -.

问题:默认情况下,如何使vagrant ssh使用root用户?

Question: how do I make vagrant ssh use the root user by default?

版本:无业游民1.6.5

Version: vagrant 1.6.5

推荐答案

解决方案:
将以下内容添加到您的Vagrantfile:

Solution:
Add the following to your Vagrantfile:

config.ssh.username = 'root'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'

此后,当您vagrant ssh时,您将以root身份登录,并应满足以下条件:

When you vagrant ssh henceforth, you will login as root and should expect the following:

==> mybox: Waiting for machine to boot. This may take a few minutes...
    mybox: SSH address: 127.0.0.1:2222
    mybox: SSH username: root
    mybox: SSH auth method: password
    mybox: Warning: Connection timeout. Retrying...
    mybox: Warning: Remote connection disconnect. Retrying...
==> mybox: Inserting Vagrant public key within guest...
==> mybox: Key inserted! Disconnecting and reconnecting using new SSH key...
==> mybox: Machine booted and ready!

更新2015年6月23日: 这也适用于1.7.2版.自1.7.0版以来,键控安全性有所提高;此技术将覆盖使用已知私钥的先前方法.此解决方案不适用于在发布前未采取适当安全措施的情况下可公开访问的盒子.

Update 23-Jun-2015: This works for version 1.7.2 as well. Keying security has improved since 1.7.0; this technique overrides back to the previous method which uses a known private key. This solution is not intended to be used for a box that is accessible publicly without proper security measures done prior to publishing.

参考:

这篇关于默认情况下以root身份登录无业游民的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆