slash
slash

Reputation: 59

replace a system command shutdown with sometghing else

What i have done is renamed the orignal shutdown command /sbin/shutdown to /sbin/shutdown.orignal and then created /sbin/shutdown which contains

    echo "yes this was executed" >> /var/www/html/shutdown-logs/temp.txt

    /sbin/shutdown.orignal -h now

so that which ever script calls will first have to call shutdown which will then call shutdown.orignal

whenever i try calling shutdown it says permission denied !

How can i solve this

Upvotes: 0

Views: 85

Answers (1)

Mustafa DOGRU
Mustafa DOGRU

Reputation: 4112

try this;

  echo "yes this was executed" >> /var/www/html/shutdown-logs/temp.txt

   sudo /sbin/shutdown.orignal -h now

and

sudo chmod 755 /sbin/shutdown

Upvotes: 1

Related Questions