0

I've created a VM CentOS7 using Vagrant (2.2.3) and Virtual Box (5.2.24), on Windows 10 in this way (following these instructions ... https://blog.centos.org/2019/02/updated-centos-vagrant-images-available-v1901-01/)

vagrant init centos/7
vagrant up

And all works fine

Then I've installed the Guest Addition (rif. https://github.com/dotless-de/vagrant-vbguest), in this way

vagrant plugin install vagrant-vbguest

And my final Vagrantfile is the follow

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.synced_folder ".", "/vagrant", type: "virtualbox"

  config.vm.provider "virtualbox" do |vb|
     vb.memory = "4096"
     vb.name = "Test"
   end
end

The vagrant up execution works fine

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' version '1901.01' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
[default] GuestAdditions 5.2.24 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => D:/Cesare/Personale/VagrantCentOS7/TestNew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

The VM starts but when I try to connect via Putty (SSH on port 22), using the IP address (192.168.33.10) I obtain the following error

enter image description here

Where am I doing wrong?

3
  • 2
    probably related to the line default: SSH auth method: private key which means: not plain text password. Imho It's vagrant's settings for ssh keys, not a CentOS problem.
    – A.B
    Feb 17, 2019 at 15:40
  • Thanks for the quick and useful reply. I think so ... I'm using a standard vagrant box (ref. https://app.vagrantup.com/centos/boxes/7), so I don't know how is configured, and I'm quite a newbie on these stuffs ... do you have some suggestions?
    – Cesare
    Feb 17, 2019 at 15:51
  • Sorry I never used vagrant
    – A.B
    Feb 17, 2019 at 16:41

1 Answer 1

0

I've solved!

I've edited /etc/ssh/sshd_config file with sudo vi /etc/ssh/sshd_config and changed #PasswordAuthentication yes to PasswordAuthentication yes(uncommented the line ...).

Then I've restarted sshd service with the command sudo systemctl restart sshd and now all works fine when I connect my VM CentOS 7 from Putty.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .