set -- `echo $public_keys | sed -e '/.pub$/s///g'`
for private_key in $*
do
- legend="'${private_key}' corresponding to '${private_key}.pub'"
+ legend="Private '${private_key}' corresponding to '${private_key}.pub'"
if [ -r $private_key ]
then
echo "$legend exists and is readable."
agent="
#!/bin/bash
# Agent script generated by sshauth.
+TERM=dumb # This magic prevents some classes of problems
+export TERM # if you have a shell profile on the remote machine.
checkonly=$check
fi
fixperms .ssh
-if [ -x .ssh/authorized_keys ]
+if [ -f .ssh/authorized_keys ]
then
echo \"Remote authorized_keys file will not be overwritten.\"
echo \"To remove it, do 'sshauth -d ${user}@${host}'.\"
elif [ \$checkonly = 'yes' ]
then
echo \"Remote .ssh exists, authorized_keys could be installed.\"
+ exit 0
else
echo \"Creating remote .ssh/authorized_keys file...\"
cat >.ssh/authorized_keys <<EOF
`cat $public_keys`
EOF
fi
+# End of agent script
"
if [ "$check" = 'yes' -a "$verbose" = '-v' ]
echo "Here is the agent script that would be run:"
echo "$agent"
exit 0
-elif echo "$agent" | ssh -T ${quiet} ${user}@${host}
+elif echo "$agent" | ssh -T ${verbose} ${quiet} ${user}@${host}
then
echo "Installation or check successful."
exit 0