como evitar o desligamento manual ou reinicializar para definir o passwd, mesmo que o login como root

2

Eu dei o comando reboot inesperadamente, para evitar que este problema precise atribuir confirmação de senha para atividades de desligamento ou reinicialização, mesmo que o log como root.Kindly sugerir para evitar este problema.Obrigado antecipadamente.

    
por Vijay 12.06.2017 / 09:16

2 respostas

2

Uma solução para sua solicitação foi encontrada aqui

Na raiz .bash_profile, configure dois alias como:

alias shutdown='/usr/local/bin/confirm shutdown'
alias reboot='/usr/local/bin/confirm reboot'

Com /usr/local/bin/confirm sendo algo como:

#!/bin/bash
echo "Before proceeding to perform $1, please ensure you have approval to perform this task"
echo -n "Would you like to proceed y/n? "
read reply

if [ "$reply" = y -o "$reply" = Y ]
then
   /sbin/$1
else
   echo "$1 cancelled"
fi

Notes:

  • You can replace the y respond with your password
  • You can use shell-compiler to replace the shell script with a compiled code which won't expose the password
    
por 12.06.2017 / 09:22
1

Precisa ser uma senha?

link

molly-guard was primarily designed to shield SSH connections. This functionality (which should arguably be provided by the openssh-server package) is implemented in /etc/molly-guard/run.d/30-query-hostname.

This script first tests whether the command is being executed from a tty which has been created by sshd. It also checks whether the variable SSH_CONNECTION is defined. If any of these tests are successful, test script queries the user for the machine's hostname, which should be sufficient to prevent the user from doing something by accident.

e

setting ALWAYS_QUERY_HOSTNAME in /etc/molly-guard/rc causes the script to always query.

    
por 12.06.2017 / 10:34

Tags