how do I SSH into a GUEST as ROOT instead of vagrant ssh?

24,843 views
Skip to first unread message

robertj

unread,
Feb 8, 2012, 11:25:02 AM2/8/12
to vagra...@googlegroups.com
Hi,

I want to SSH directly as a root into my running GUEST-VM (ubuntu 11.10 created with veewee)

so I do this "ssh devbox" and I have defined this as my 
~/.ssh/config
Host devbox
  Hostname localhost
  Port     2222
  User     root    
  ForwardX11 yes

however I get a permission denied error

robertj$ ssh devbox
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 

As I have created this with veewee (2.3.3) I assume that the password of root is "vagrant".
obviously it isn't. also as I have successfully provisioned the GUEST-VM with vagrant
which uses the root user. 
I can btw login as vagrant@devbox

any help is greatly appreciated.

Best regards

Robert

Stefan Goethals

unread,
Feb 8, 2012, 2:04:38 PM2/8/12
to vagra...@googlegroups.com
Once you are logged in as vagrant you can # sudo su -   to become root without password.

Zipkid

Pritesh Mehta

unread,
Feb 8, 2012, 2:18:22 PM2/8/12
to Vagrant
Vagrant logs in to the guest as the "vagrant" user and uses sudo
configuration to not require a password for admin privileged commands.

An ubuntu box sets a random password for the root user. If you
absolutely have to use the root user to login, you should set a
password for the root user.

--
# After logging in as vagrant
$ sudo passwd -u root
--

You should probably also check that the ssh config [/etc/ssh/
sshd_config] hasn't disabled remote root ssh sessions.

An alternate is to add your ssh PUBLIC key to the root user's
authorized_keys file. (you /could/ use the vagrant users public key if
this machine isn't holding critical or sensitive data. Not recommended
as the private key is in the public domain)

HTH

jasherai

purna ganesh

unread,
Apr 16, 2016, 5:26:12 AM4/16/16
to Vagrant, ste...@zipkid.com
many thanks
Reply all
Reply to author
Forward
0 new messages