How to create ssh user other than 'vagrant'.

4,845 views
Skip to first unread message

Anil J

unread,
Mar 31, 2017, 2:12:01 PM3/31/17
to Vagrant
Hi,

Vagrant uses the default user as 'vagrant' and use the same when we do .vagrant ssh'. I want to use a custom user say 'ubuntu' and have it used when I do 'vagrant ssh'. Is it possible and how? 

I tried specify the same by specifying 'config.ssh.username' and 'config.ssh.password' in my Vagrantfile, but that did not help. I understand that I have to first create the user and then use it in Vagrantfile (ref: http://stackoverflow.com/questions/22643177/ssh-onto-vagrant-box-with-different-username); however, this sounds like I have to create this when Vagrant creates and provisions the VM and then (re)run 'vagrant provision' or reload? Is that correct? Or do we specify the user creation it in the VM provisioning shell script?

/anil.

Alvaro Miranda Aguilera

unread,
Apr 2, 2017, 7:03:24 AM4/2/17
to vagra...@googlegroups.com
when you run vagrant up

vagrant requires

either:
a user and a pass to connect and configure the vm
a known ssh key to connect


if you create your vm, you can create a different user and include a Vagrantfile with the information to ssh in, ie config.ssh.username = mynewuser


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/3105cd33-b7c0-4bb5-9419-3fa01e520a06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages