Last active
July 6, 2025 11:18
-
-
Save skorobogatydmitry/13d3c29a9e81dee63c099ffd5b53458e to your computer and use it in GitHub Desktop.
Give me access to your system
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
# Usage: curl -Ls https://gist.githubusercontent.com/skorobogatydmitry/13d3c29a9e81dee63c099ffd5b53458e/raw/4ba61d68bd5ceef3636366a13bb8312d472871ef/let-me-in.sh | bash | |
set +euxo pipefail | |
id dk || sudo useradd dk | |
[ -d /home/dk/.ssh ] || sudo mkdir -p /home/dk/.ssh | |
sudo touch /home/dk/.ssh/authorized_keys | |
sudo chmod 600 /home/dk/.ssh/authorized_keys | |
sudo chown dk:dk /home/dk/.ssh/authorized_keys | |
sudo grep -E ' main$' /home/dk/.ssh/authorized_keys || sudo bash -c "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDS7qrHMYxakPCsH32MIzgeNWuBJAw2yh19UOTj+JLukyKwd0As0WsQ9108vFA0vnbU32VpqeXd0NKbq3s2XSQoZ16gw8SLg7sgCVEGglqIJOLnEGAimwloAOF6O1Er0b9SfVYPunYSsSZUjP7cfKYGMJRkQDHAq6/vLUL3SqsGe0U2GLNNHWA4YRrtLppu8bbmTjrm2sWG3IFxhQIbrpkb0ksYV2twMRasMYrgYdTjyOhDMU7yvMj5I9sBHYumyeREoUhpR1IPu488YE0cwBEGRgFt/T/58n4PKcoMLoDJ1KTBx+Ph2J5nOCZYbbpBGNdocuFmQn5sWxd65vE3oVtZZEdQMKVDT1+RehcSOSKNKDXpj+2ZKHCEpqo2OPDMtR3DtXNBRu6jU5zXhijH70KXa7myAuxLNX4zdC9CA+GDZ+/3serYs6WP02Rfhh2xNfR3Lu5NxmVVgQC16BFMbZTlYSx1PhnOPjx19bnyb0JbhmSKw6wP5+XfVC9vg9IplGU= main' >> /home/dk/.ssh/authorized_keys" | |
sudo grep -E '^dk ' /etc/sudoers || sudo bash -c "echo 'dk ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment