Created
November 3, 2021 16:22
-
-
Save BirknerAlex/e6b3277a15007ba07878cc9211d28251 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
#!/bin/bash | |
if [[ -d "/home/ubuntu/.ssh/" ]]; then | |
mv -v /home/ubuntu/.ssh/ /root/ | |
chown -R root:root /root/.ssh/ && chmod 700 /root/.ssh/ && chmod 600 /root/.ssh/* | |
sed -ie 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config | |
systemctl reload ssh | |
pkill -u ubuntu && userdel -r ubuntu | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment