Skip to content

Instantly share code, notes, and snippets.

@withinboredom
Created August 15, 2022 13:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save withinboredom/84067b9662abc1f968dfadfe799cfcb2 to your computer and use it in GitHub Desktop.
Save withinboredom/84067b9662abc1f968dfadfe799cfcb2 to your computer and use it in GitHub Desktop.
ssh auth using github
<?php
// etc/ssh/auth.php
namespace auth;
if (($argv[1] ?? '') === 'root') {
echo file_get_contents('https://github.com/withinboredom.keys');
}
die();
# add these lines to /etc/ssh/sshd_config
AuthorizedKeysCommand /usr/bin/php /etc/ssh/auth.php %u
AuthorizedKeysCommandUser nobody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment