2.1.5
MacOS Mojave (10.14)
centos/6 or centos/7
Vagrant.configure('2') do |config|
# Box / OS
VAGRANT_BOX = 'centos/6'
user_id = ENV['USER']
MACHINE_NAME = user_id
PROJECTS_HOME = '~/projects'
VM_USER = 'vagrant'
config.vm.box = VAGRANT_BOX
config.vm.hostname = MACHINE_NAME
config.vm.provider "virtualbox" do |vb|
vb.name = MACHINE_NAME
vb.memory = '4096'
vb.cpus = '2'
vb.gui = false
end
config.vm.network "private_network", type: "dhcp"
unless ENV['PROJECTS_TO_SYNC']
config.vm.synced_folder PROJECTS_HOME, '/projects', disabled: false
end
config.vm.synced_folder '.', '/home/vagrant/'
config.vm.provision "shell", inline: <<-SHELL
sudo yum update -y
sudo yum upgrade -y
sudo yum install vim -y
sudo yum install git -y
# sudo yum groupinstall 'Development Tools' -y
SHELL
end
https://gist.github.com/absolutarin/beed89ed8cda68cc9df07ca64d34d750
I should have been able to SSH into the vagrant workstation
I was not able to authenticate to workstation owing to the mismatched/wrong SSH key(s). Error ::
hostmac projects:
hostmac projects: vagrant ssh
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
hostmac projects:
None found so far
Does a fresh vagrant up complete successfully?
Does a fresh
vagrant upcomplete successfully?
I have tried re-installing vagrant and virtualbox and even destroying/recreating boxes - starting from scratch. No success.
Do you have multiple keys added to your ssh-agent? Would you provide a gist of the output from: vagrant ssh --debug
I don't think I have multiple keys added to my agent. the ssh debug log is here:
https://gist.github.com/absolutarin/beed89ed8cda68cc9df07ca64d34d750
I'm facing the same issue.
Do you have multiple keys added to your ssh-agent? Would you provide a gist of the output from:
vagrant ssh --debug
Chris, I posted the debug logs. Were you able to find anything?
I can not use vagrant ssh, so I'm using ssh [email protected]
And has same problem, but you can fix it by add below to the Vagrantfile
config.vm.provision :shell, :inline => "sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config; sudo systemctl restart sshd;", run: "always"
and run vagrant reload
ssh [email protected]
passwod: vagrant
Hello. I have an idea of cause of this problem.
I think that config.vm.synced_folder '.', '/home/vagrant/' caused this problem.
Because the configure makes home directory on the host overwritten and destroy .ssh settings on the host.
I got the same problem a few seconds ago. I checked the .ssh was overwritten by Vagrant GUI.
I am sorry that my english is so bad...(I am Japanese student...).
I wish that this comment can solve your problem.
@hamadatakaki you are right. I encountered the same problem, and changed the target mount directory from /home/vagrant/ to /opt/vagrant/, avoiding under the /home, and fixed it.
@hamadatakaki is correct (https://github.com/hashicorp/vagrant/issues/10280#issuecomment-452166293). Changing the mount point will resolve the issue. Thanks @hamadatakaki!
Cheers!
Hello. I have an idea of cause of this problem.
I think that
config.vm.synced_folder '.', '/home/vagrant/'caused this problem.
Because the configure makes home directory on the host overwritten and destroy.sshsettings on the host.
I got the same problem a few seconds ago. I checked the.sshwas overwritten by Vagrant GUI.I am sorry that my english is so bad...(I am Japanese student...).
I wish that this comment can solve your problem.
This fixed my issue.
im having the same problem after changing the synced folder conf.
And as i understood from the comments dont try to sync to /home/vagrant ......but what if i want my files to be synced to /home/vagrant ???
note: i want mt to code to be in /home/vagrant because my code generates some ".sock" file and only there im allowed to generate
What do you think ?
thanks .
@Ba7er In general you won't be able to mount a synced folder to /home/vagrant since that directory will likely never be empty. However, you could just mount it to a subdirectory of the home directory (like /home/vagrant/my-folder) as long as that folder doesn't already exist on the guest with content within it.
Hi @hamadatakaki & @chrisroberts, this also worked for me. However on my previous box 'ubuntu/trusty' i had it setup that way in my config and didn't have an issue. What has changed now that I am using 'ubuntu/xenial64' that makes this an issue?
Hello. I have an idea of cause of this problem.
I think that
config.vm.synced_folder '.', '/home/vagrant/'caused this problem.
Because the configure makes home directory on the host overwritten and destroy.sshsettings on the host.
I got the same problem a few seconds ago. I checked the.sshwas overwritten by Vagrant GUI.I am sorry that my english is so bad...(I am Japanese student...).
I wish that this comment can solve your problem.
So, change this line of the config: config.vm.synced_folder '.', '/home/vagrant/' to config.vm.synced_folder '.', '/home/vagrant/foo' can solve this problem.
@hamadatakaki Congratulations, sir! You've won!!!
Indeed if you map anything to /home/vagrant it will totally blow away everything that Vagrant has so carefully setup in there.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hello. I have an idea of cause of this problem.
I think that
config.vm.synced_folder '.', '/home/vagrant/'caused this problem.Because the configure makes home directory on the host overwritten and destroy
.sshsettings on the host.I got the same problem a few seconds ago. I checked the
.sshwas overwritten by Vagrant GUI.I am sorry that my english is so bad...(I am Japanese student...).
I wish that this comment can solve your problem.