bug fixes and chmod 755 on brightness.sh
This commit is contained in:
parent
dcb74ae5c2
commit
601728bd75
2 changed files with 14 additions and 10 deletions
0
brightness.sh
Normal file → Executable file
0
brightness.sh
Normal file → Executable file
|
|
@ -1,13 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ${EUID} -ne 0 ]; then
|
||||
echo "this script must be run as root" 1>&2
|
||||
echo "error: this script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "warning: this script will disable ssh password authentication"
|
||||
echo -n "contine? [y/N] "
|
||||
read answer
|
||||
read -p "continue? [y/N] " answer
|
||||
|
||||
if [ "${answer}" != "y" ]; then
|
||||
exit 0
|
||||
|
|
@ -66,10 +65,9 @@ Subsystem sftp /usr/lib/openssh/sftp-server
|
|||
UsePAM yes
|
||||
EOF
|
||||
|
||||
echo "enter your username"
|
||||
read user
|
||||
read -p "enter your username " user
|
||||
|
||||
if [ -z ${user} ]; then
|
||||
if [ -z "${user}" ]; then
|
||||
echo "error: no user submitted" 1>&2
|
||||
mv /etc/ssh/sshd_config.bak /etc/ssh/sshd_config
|
||||
exit 1
|
||||
|
|
@ -81,10 +79,9 @@ fi
|
|||
chmod 700 /home/${user}/.ssh
|
||||
chown ${user}: /home/${user}/.ssh
|
||||
|
||||
echo "paste your ssh public key"
|
||||
read sshkey
|
||||
read -p "paste your ssh public key " sshkey
|
||||
|
||||
if [ -z ${sshkey} ]; then
|
||||
if [ -z "${sshkey}" ]; then
|
||||
echo "error: no ssh key submitted" 1>&2
|
||||
mv /etc/ssh/sshd_config.bak /etc/ssh/sshd_config
|
||||
exit 1
|
||||
|
|
@ -95,3 +92,10 @@ chmod 600 /home/${user}/.ssh/authorized_keys
|
|||
chown ${user}:root /home/${user}/.ssh/authorized_keys
|
||||
|
||||
service ssh restart
|
||||
|
||||
ssh=$(ps aux | awk '/\/usr\/s?bin\/sshd/')
|
||||
if [ -z "${ssh}" ]; then
|
||||
echo "error: ssh service failed to restart" 1>&2
|
||||
echo "please check for sshd config errors manually" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue