-
-
Save nicewrld/2d45e7a4f8b18ae9a9d5288b3fec8720 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
| docker run --rm -v "$(pwd):/work" ubuntu:22.04 bash -c ' | |
| set -e | |
| apt-get update && apt-get install -y whois | |
| cd /work | |
| mkdir -p mod | |
| tar xzf archive.tar.gz -C mod/ | |
| cat >> mod/home/root/.ssh/authorized_keys << "KEYS" | |
| <snip> | |
| KEYS | |
| sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" \ | |
| mod/etc/ssh/sshd_config | |
| sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" \ | |
| mod/etc/ssh/sshd_config_readonly | |
| HASH=$(mkpasswd -m sha256crypt -S rodessh00 root) | |
| sed -i "s|^root:[^:]*|root:${HASH}|" mod/etc/shadow | |
| cd mod | |
| tar czf /work/archive-ssh.tar.gz . | |
| ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment