Last active
April 21, 2020 00:34
-
-
Save jesboat/e25c452a97a2ebcd08df6e05f52aa66b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash -c ' | |
if [ "$(whoami)" = root ]; then | |
echo "No, you are supposed to run this bit as non-root" | |
exit 1 | |
fi | |
sudo -v | |
pass=$(openssl rand -hex 16 | sed -e "s/\\(....\\)/\\1-/g; s/-\$//") | |
echo "Chosen random password: $pass" | |
{ | |
echo "root:$pass" | |
echo "$(whoami):$pass" | |
} | sudo chpasswd | |
sudo sh -c " | |
apt-get update | |
apt-get upgrade | |
apt-get -y install screen openssh-server | |
service sshd start" | |
echo | |
echo "Remote access is set up." | |
echo "Account:" | |
echo " $(whoami) : $pass" | |
echo "Addresses:" | |
ip addr | sed -e "/^ *inet/ b p; d; :p s/^ */ /" | |
echo "SSH fingerprints:" | |
for k in /etc/ssh/ssh_host*.pub; do | |
ssh-keygen -lf $k | sed -e "s/^/ " | |
done | |
echo | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment