This article was last edited over 3 years ago. Information here may no longer be accurate. Please proceed with caution, and feel free to contact me.
I have a Vagrant box where I want to SSH in as the standard
vagrant user for the initial provision and
deployment, but I want to use my own alternate custom user account
for my dev work.
I want to use
vagrant for the initial deploy as that
is the standard user for many vagrant machine images. Adding my
own user into the image would be a pain, and would prevent me from
being able to use a standard Vagrant image.
I want to add my custom
deploy user during
provisioning, and use that for my dev work, because that is the
account my staging and production servers use. Having this user
account present for dev work will allow me to be more consistent
with our real environments.
Unfortunately, that was a bit more challenging to do than I would
have anticipated, and I could not find an option in the Vagrant
docs that would allow me to use two different users for
vagrant up and
Vagrantfile and add this conditional in the
VAGRANT_COMMAND = ARGV Vagrant.configure("2") do |config| if VAGRANT_COMMAND == "ssh" config.ssh.username = 'other_username' end ... end
Perfect. Now my
in my case) will only be used if the
ssh argument is