Try something like this:
ENV["SSH_USER"] ||= "root"
if ENV["SSH_USER"] == "root"
vortex = "/root"
else
vortex = "/home/" + ENV["SSH_USER"]
end
if ENV["SSH_USER"]
config.vm.synced_folder ".", vortex,
owner: ENV["SSH_USER"] ,
group: ENV["SSH_USER"]
end
In this way,
if you do vagrant up , by default will be root the ssh user, and
vortex will become /root
to avoid changing the vagrant file, you can do
SSH_USER=user1 vagrant up
and that variable will override the root default, and ssh_user will be
user1, and vortex will become /home/user1
On Sat, Feb 15, 2014 at 11:43 AM, RH Becker <[email protected]> wrote:
> I want to do something like ...
>
> config.vm.synced_folder ".", *vortex*,
> owner: *sshuser*,
> group: *sshuser*
>
> ... where *sshuser* is set after any provider-specific
> override.ssh.username action, and *vortex* is set based on the value of
> *sshuser*, like ...
>
> *vortex* = *sshuser* == "root" ? "/root" : "/home/#{*sshuser*}"
>
> But I can't figure out what to reference in my Vagrantfile when setting
> the value for *sshuser*.
>
> I'm inexperienced with ruby and having a hard time finding what I need in
> the vagrant source.
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.