jedi4ever/veewee — Issue #160: Passwordless SSH access (Ubuntu)
Author: hedgehog
Created: 2011-11-14 21:03:09+00:00
State: open

Passwordless SSH access:

d-i preseed/late_command string in-target /bin/bash -c "echo 'vagrant ALL=(ALL) NOPASSWD: ALL' |tee -a /etc/sudoers"; \
in-target mkdir -m 0700 /home/vagrant/.ssh; \
in-target wget --no-check-certificate -O /home/vagrant/.ssh/authorized_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub; \
in-target chmod 0600 /home/vagrant/.ssh/authorized_keys; \
in-target cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original; \
in-target chown -R vagrant.vagrant /home/vagrant/.ssh; \
in-target chmod a-w /etc/ssh/sshd_config.original; \
in-target /bin/bash -c "echo PubkeyAuthentication yes |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo RSAAuthentication yes |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo PasswordAuthentication no |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo UsePAM no |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo ChallengeResponseAuthentication no |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo AllowGroups vagrant users |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo AllowUsers vagrant |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo UseDNS no |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo Banner /etc/issue.net |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo PrintMotd no |tee -a /etc/ssh/sshd_config"; \
in-target /bin/bash -c "echo PrintLastLog no |tee -a /etc/ssh/sshd_config"; \
in-target /etc/init.d/ssh restart