Skip to content

Instantly share code, notes, and snippets.

@duffney
Last active April 8, 2020 18:52
Show Gist options
  • Save duffney/f517e0638dad804d2660d3c8d64316fb to your computer and use it in GitHub Desktop.
Save duffney/f517e0638dad804d2660d3c8d64316fb to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt-get install python -y
useradd -m -d /home/ansible -s /bin/bash ansible
echo 'ansible:P@ssw0rd'|chpasswd
echo 'ansible ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
sudo sed -n 'H;${x;s/\PasswordAuthentication no/PasswordAuthentication yes/;p;}' /etc/ssh/sshd_config > tmp_sshd_config
sudo cat tmp_sshd_config > /etc/ssh/sshd_config
rm -f tmp_sshd_config
sudo service sshd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment