some improvements
This commit is contained in:
parent
98057ae340
commit
d4c169aaa6
3 changed files with 66 additions and 59 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
UNAME=$(uname)
|
||||
[ $(id -u) -ne 0 ] && { echo "error: this script must be run as root" 1>&2; exit 1; }
|
||||
[ $(id -u) -ne 0 ] && { echo "error: this script must be run as root">&2; exit 1; }
|
||||
|
||||
echo "warning: this script will disable ssh password authentication"
|
||||
echo -n "continue? [y/N] "
|
||||
|
|
@ -64,7 +64,7 @@ echo -n "enter your username "
|
|||
read user
|
||||
|
||||
if [ -z "${user}" ]; then
|
||||
echo "error: no user submitted" 1>&2
|
||||
echo "error: no user submitted">&2
|
||||
mv ${ssh_config}.bak ${ssh_config}
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -79,7 +79,7 @@ echo "paste your full ssh public key "
|
|||
read sshkey
|
||||
|
||||
if [ -z "${sshkey}" ]; then
|
||||
echo "error: no ssh key submitted" 1>&2
|
||||
echo "error: no ssh key submitted">&2
|
||||
mv ${ssh_config}.bak ${ssh_config}
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -101,7 +101,7 @@ case ${UNAME} in
|
|||
esac
|
||||
|
||||
if [ -z "$(ps aux -w | awk '/\/usr\/s?bin\/sshd/')" ]; then
|
||||
echo "error: ssh service failed to restart" 1>&2
|
||||
echo "please check for sshd config errors manually" 1>&2
|
||||
echo "error: ssh service failed to restart">&2
|
||||
echo "please check for sshd config errors manually">&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue