Last active
March 31, 2026 05:19
-
-
Save clayrisser/6cf285958c0a1e959a501621ea1304b3 to your computer and use it in GitHub Desktop.
root2admin
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/sh | |
| sudo adduser --disabled-password --gecos "Admin" admin | |
| sudo usermod -aG sudo admin | |
| echo "admin ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/admin | |
| sudo chmod 440 /etc/sudoers.d/admin | |
| sudo -u admin ssh-keygen -t ed25519 -f /home/admin/.ssh/id_ed25519 -N "" | |
| sudo cp /root/.ssh/authorized_keys /home/admin/.ssh/authorized_keys | |
| sudo chown -R admin:admin /home/admin/.ssh | |
| sudo chmod 600 /home/admin/.ssh/authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment