mrdavidlaing / vagrant-unison

Vagrant plugin to sync local files to VM using Unison over SSH
MIT License
37 stars 29 forks source link

Allow setting SSH username #1

Open wizonesolutions opened 11 years ago

wizonesolutions commented 11 years ago

The box I want to test this on runs the web stuff under a different username than my local user, and it isn't vagrant. I can handle ensuring I've set up the SSH keypair for that user. I just need to be able to tell vagrant-unison where to go.

mrdavidlaing commented 11 years ago

A simpler solution would be to add the vagrant user to the same group as your web username; which would enable it to write files to those locations.

Would that work for you?

wizonesolutions commented 11 years ago

I thought about that, but that means that my web permissions and umask have to be 775 and 002. That's more of a pain than it's worth. Also, new files will be created as vagrant, not www-data. If you let me know where to look I'd be happy to send a pull request when I get a chance.

mrdavidlaing commented 11 years ago

A PR would be welcomed.

The relevant code is here: https://github.com/mrdavidlaing/vagrant-unison/blob/master/lib/vagrant-unison/command.rb#L58

I guess the thing to do would be to have an additional config param - and use that rather than ssh_info[:username] if set.

So, your config would become something like:

config.sync.host_folder = "src"  #relative to the folder your Vagrantfile is in
config.sync.guest_folder = "src" #relative to the vagrant home folder -> ~/
config.sync.guest_user = "www-data" 
mrdavidlaing commented 11 years ago

@wizonesolutions - Before you work on a PR for this; please consider #3

mrdavidlaing commented 11 years ago

@wizonesolutions - I'm finished filling with the code; so if you would like to submit a PR to allow overriding of the ssh username, then now is a good time.