#845165 vagrant-lxc: vagrant ssh key with wrong permissions, vm creation fails

#845165#5
Date:
2016-11-20 23:58:25 UTC
From:
To:
Dear Maintainer,

When vagrant-lxc places its authorized_keys file in to a new centos7 vm's ~vagrant/.ssh directory, it does so with too permissive ownership.
As a result, the centos7 vm's ssh wont allow ssh login.

I can work around this by manually running the following in another terminal, whilst the vm is being created

chmod 600 /var/lib/lxc/<vagrant vm name>/rootfs/home/vagrant/.ssh/authorized_keys


Here is the main terminal output, the "Authenticaion failure" will repeat over and over and eventually fail. The following examples shows when i perform the manual work around above.



dean@cliffjumper:~/git/stash/conform-OIE-module$ vagrant up --provider=lxc
Bringing machine 'default' up with 'lxc' provider...
==> default: Importing base box 'goodsmileduck/centos-7-lxc'...
==> default: Checking if box 'goodsmileduck/centos-7-lxc' is up to date...
==> default: Setting up mount entries for shared folders...
    default: /foo-module => /home/dean/git/stash/my-foo-module
==> default: Starting container...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 10.0.3.252:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
==> default: Machine booted and ready!
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Loaded plugins: fastestmirror
==> default: Determining fastest mirrors
==> default:  * base: centos.mirror.crucial.com.au
==> default:  * extras: centos.mirror.crucial.com.au
==> default:  * updates: centos.mirror.crucial.com.au
==> default: Resolving Dependencies

#845165#10
Date:
2021-10-22 09:21:56 UTC
From:
To:
Hi Dean,
I found in the upstream source code the following commit:
https://github.com/fgrehm/vagrant-lxc/commit/43aa9bfb3e5c6000233350a611bd0d3e3909e8d7

As this commit is part of vagrant-lxc since version 1.2.4, there is a
reasonable chance your issue has been fixed since then.

Cheers,
  Diederik

#845165#13
Date:
2021-10-22 09:21:56 UTC
From:
To:
Hi Dean,
I found in the upstream source code the following commit:
https://github.com/fgrehm/vagrant-lxc/commit/43aa9bfb3e5c6000233350a611bd0d3e3909e8d7

As this commit is part of vagrant-lxc since version 1.2.4, there is a
reasonable chance your issue has been fixed since then.

Cheers,
  Diederik