Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing folder to a user directory breaks SSH #4791

Closed
rvangundy opened this issue Nov 6, 2014 · 6 comments
Closed

Syncing folder to a user directory breaks SSH #4791

rvangundy opened this issue Nov 6, 2014 · 6 comments

Comments

@rvangundy
Copy link

I've got a pretty custom setup going, so this might be outside the scope of vagrant, but I figured someone here might have some experience with this kind of thing...

I've built an Arch Linux base image. I would like to synchronize my project folder with a folder in the user's home directory, such as /home/vagrant/my_project. If I mount it like this:

config.vm.synced_folder ".", "/home/vagrant/my_project"

I am no longer able to SSH in. I get the following response:

ssh_exchange_identification: Connection closed by remote host

I'm able to mount any other folder outside the user's directory just fine. The /vagrant mount works as expected.

I'm wondering if there's a security-related setting I'm missing that relates to folder permissions in a user's home directory? Since this is a vagrant-y issue, maybe others building vagrant boxes have encountered this.

@canausa
Copy link
Contributor

canausa commented Nov 6, 2014

Most linuxish systems use ssh keys located in a hidden home directory
located at ~/.ssh . it is how the systems now which keys are valid for each
system. So when you mount your project to that directory it loses access to
the .ssh directory.

There are 3 solutions.

  • copy the .ssh directory in to your project.
  • not mount your project to the home directory of vagrant
  • tell vagrant to use password authentication instead of ssh keys.

On Thu, Nov 6, 2014 at 11:33 AM, rvangundy notifications@github.com wrote:

I've got a pretty custom setup going, so this might be outside the scope
of vagrant, but I figured someone here might have some experience with this
kind of thing...

I've built an Arch Linux base image. I would like to synchronize my
project folder with a folder in the user's home directory, such as
/home/vagrant/my_project. If I mount it like this:

config.vm.synced_folder ".", "/home/vagrant/my_project"

I am no longer able to SSH in. I get the following response:

ssh_exchange_identification: Connection closed by remote host

I'm able to mount any other folder outside the user's directory just fine.
The /vagrant mount works as expected.

I'm wondering if there's a security-related setting I'm missing that
relates to folder permissions in a user's home directory?


Reply to this email directly or view it on GitHub
#4791.

@rvangundy
Copy link
Author

@canausa Good points. In my case I'm mounting a folder next to the .ssh folder, in /home/vagrant/project. I've done this using other base images, so I'm guessing it's a configuration issue in my image.

@Xylakant
Copy link
Contributor

@rvangundy If there's an issue with directory permissions or similar you could have a look at the logfiles inside the machine. I'd start the machine with enabled gui and then the log in there (username/pw should be vagrant/vagrant) and observe the logs while trying an ssh login. This should give you an idea where to look.

edit: sorry for the initially wrong mention :(

@mitchellh
Copy link
Contributor

Yes, @canausa is correct. We do some detection to detect this but it isn't 100%. Don't sync to your home folder. :)

@domenkozar
Copy link

Hmmm, unpleasant. Couldn't .ssh be installed/created after synced folders are mounted?

@nakulpathak3
Copy link

Ran into same issue today

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants