Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/var/bin/mksh
- cd && cd .ssh || exit 1
- case "$1" in
- ""|enabled)
- echo '__enabled__'
- sed -n '/^ssh/{
- h
- s/^.* //
- p
- }' < authorized_keys
- ;;
- disabled)
- echo '__disabled__'
- sed -n '/^#ssh/{
- h
- s/^.* //
- p
- }' < authorized_keys
- ;;
- hosts)
- echo __hosts__
- sed -n '/^ssh/{
- h
- s/^.* //
- s/^.*@//
- p
- }' < authorized_keys | sort | uniq
- ;;
- users)
- echo __users__
- sed -n '/^ssh/{
- h
- s/^.* //
- s/@.*$//
- p
- }' < authorized_keys | sort | uniq
- ;;
- *)
- print $(basename $0) enabled
- print $(basename $0) disabled
- print $(basename $0) hosts
- print $(basename $0) users
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement