0

i'm running a centos server and I would like to make it so, that when you type the shut down command(s) it would instead reboot the server.

4
  • Typing shutdown in a shell or executing shutdown from anywhere? Because you could alias all shutdown commands to reboot in your shell (albeit with any flags not working), but can still execute the commands through the absolute path to the executable (usually /sbin/shutdown)
    – ethanwu10
    Commented Mar 5, 2016 at 20:42
  • Through shell & ssh
    – Jojo Coana
    Commented Mar 5, 2016 at 21:16
  • Just curious, but: Why. It would make things very confusingwhen you want to do maintenance and shut down to single user mode and instead of shutting down the host suddenly reboots. Same when you want to power it down. If you just want to use this for a single account: Why not use an alias. If you do not want people to accidentally shut down the server: Why give them these rights at all?
    – Hennes
    Commented Mar 5, 2016 at 22:32
  • It's also a hacker precaution i was thinking, that maybe typing a special shutdown command would then really shutdown.
    – Jojo Coana
    Commented Mar 5, 2016 at 22:36

1 Answer 1

0

You could just alias all shutdown commands to /sbin/reboot in the system-wide bashrc (/etc/bash.bashrc) as a hack. This means that running shutdown would instead run the reboot command, but most command-line arguments wouldn't work because reboot doesn't use the same flags. Also this would only affect users using bash for their shell, as people using other shells would not respect the system-wide bashrc.

1
  • thanks for the help, but i noticed that it still executes the shutdown command if i do sudo shutdown
    – Jojo Coana
    Commented Mar 6, 2016 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .