Commit b0e61d2f authored by Vitaly Lipatov's avatar Vitaly Lipatov

add rooter code

parent ab0091ba
#!/bin/sh
# Print out user's pub key
fatal()
{
echo "Error: $@"
exit 1
}
[ "$UID" = 0 ] || fatal "Run me only as root"
USERNAME=$1
[ -n "$USERNAME" ] || fatal "Usage: $0 username"
if [ "$USERNAME" = "root" ] ; then
HOMEDIR=/root
else
HOMEDIR=/home/$USERNAME
fi
USERKEY=$HOMEDIR/.ssh/id_dsa.pub
[ -r "$USERKEY" ] || USERKEY=$HOMEDIR/.ssh/id_rsa.pub
#[ -r "$USERKEY" ] || fatal "Can't read ssh key $USERKEY"
cat $USERKEY
#!/bin/sh
fatal()
{
echo "Error: $@"
exit 1
}
[ "$1" = "-c" ] || fatal "Run me only via ssh"
shift
run()
{
case "$1" in
""|"help")
echo "Welcome to Etersoft rooter!"
echo "Available commands:"
echo " get pubkey USER"
#echo " allow USER HOST [VEID]"
#echo " list hosts"
#echo " list host veid"
exit
;;
"get")
shift
case "$1" in
"pubkey")
shift
sudo /home/rooter/bin/get_ssh_pubkey.sh "$1"
;;
*)
fatal "Unknown command get $1"
;;
esac
;;
*)
echo "Etersoft rooter (c) 2015"
echo "Unknown command $*"
exit 1
;;
esac
}
run $*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment