You can't ssh as root by default on CentOS. Check https://www.liquidweb.com/kb/enable-root-login-via-ssh/
On Tue, Jan 29, 2019 at 2:37 AM rory toma <[email protected]> wrote: > I have set the following in the packer json file: > > { > "builders": > [ > { > "type": "qemu", > "iso_url": " > http://netinstall/kickstart/isos/CentOS-7-x86_64-Everything-1708.iso", > "iso_checksum": "d23eab94eaa22e3bd34ac13caf923801", > "iso_checksum_type": "md5", > "output_directory": "output_centos_tdhtest", > "shutdown_command": "shutdown -P now", > "disk_size": 50000, > "format": "qcow2", > "accelerator": "kvm", > "headless": true, > "qemuargs": [ > [ "-m", "8192M" ], > [ "-smp", "cpus=1,maxcpus=2,cores=2" ] > ], > "http_directory": "http", > "ssh_username": "root", > "ssh_password": "password", > "ssh_timeout": "2m", > "vm_name": "centos-test", > "output_directory": "centos7", > "net_device": "virtio-net", > "disk_interface": "virtio", > "boot_wait": "10s", > "boot_command": [ > "<tab> text ks= > http://netinstall:80/kickstart/ks/new-configs/packer-CL7.6-X.cfg > init.sshd<enter><wait>" > ] > } > ] > } > > > > > > In my centos kickstart file, I have: > > lang en_US.UTF-8 > keyboard us > url --url=http://bigassnas/ks/CentOS-7.6-x86_64 > cmdline > reboot --eject > firewall --disabled > services --enabled=NetworkManager,sshd > network --bootproto=dhcp --device=eth0 --onboot=on --hostname=test-packer > sshpw --username=root installme --plaintext > > > It sets it up to run on a non-default port on 127.0.0.1, however, when I > try to ssh to it: > > [root@menzoberranzan ~]# ssh -vvv -o PreferredAuthentications=password -o > PubkeyAuthentication=no -l root 127.0.0.1 -p 3037 > OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 > debug1: Reading configuration data /etc/ssh/ssh_config > debug1: /etc/ssh/ssh_config line 58: Applying options for * > debug2: resolving "127.0.0.1" port 3037 > debug2: ssh_connect_direct: needpriv 0 > debug1: Connecting to 127.0.0.1 [127.0.0.1] port 3037. > debug1: Connection established. > debug1: permanently_set_uid: 0/0 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/identity type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/identity-cert type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_rsa type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_rsa-cert type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_dsa type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_dsa-cert type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_ecdsa type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_ecdsa-cert type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_ed25519 type -1 > debug1: key_load_public: No such file or directory > debug1: identity file /root/.ssh/id_ed25519-cert type -1 > ssh_exchange_identification: Connection closed by remote host > > Not sure what I'm missing here. I tried to set communicator to "none", but > apparently, that doesn't really work. > > > > > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/73b10fb2-3c57-4f88-b53c-4b802b187975%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/73b10fb2-3c57-4f88-b53c-4b802b187975%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt-tvZXOtXiKt3ZM7LHgB4_Om3J%2ByQ3hWrpcVZ8WGov00A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
