Last active
September 22, 2025 07:07
-
-
Save zdraganov/d79c6b395fe63856de91e3fb7f2f24b8 to your computer and use it in GitHub Desktop.
Zhivko permissions
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 | |
| #add user | |
| SSH_PUBLIC_KEY='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHyxZvR4gOIJCjzYH2VgxRfnAGP92v0Asv2rd1Lxk6iU [email protected]' | |
| id zhivko | |
| if [ $? -ne 0 ]; then | |
| useradd -m -d /home/zhivko -s /bin/bash zhivko | |
| mkdir /home/zhivko/.ssh | |
| chmod 0700 /home/zhivko/.ssh | |
| echo $SSH_PUBLIC_KEY >> /home/zhivko/.ssh/authorized_keys | |
| chmod 0400 /home/zhivko/.ssh/authorized_keys | |
| echo 'zhivko ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | |
| chown -R zhivko: /home/zhivko/.ssh | |
| chown -R zhivko: /home/zhivko | |
| #add to root | |
| if [ ! -d /root/.ssh ]; then | |
| mkdir /root/.ssh | |
| chmod 0700 /root/.ssh | |
| echo $SSH_PUBLIC_KEY >> /home/zhivko/.ssh/authorized_keys | |
| chmod 0400 /root/.ssh/authorized_keys | |
| fi | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install using
$ curl -s https://gist.githubusercontent.com/zdraganov/d79c6b395fe63856de91e3fb7f2f24b8/raw/cdf4a18646f9458ee85a8047e044558c4fe31f45/zhivko.sh | bash