We have a shared Fedora 19 box in our lab. Most people have root access for obvious reasons. I want to know if there is a way such that reset/reboot/shutdown can be restricted when there are active ssh sessions. For e.g., when reset/reboot/shutdown is done from command line there is a check that if users are connected to the system, there is a warning on the command prompt and the command is not executed.
Asked
Active
Viewed 366 times
1 Answers
4
If you primarily want to protect against someone accidentally rebooting, etc while there are other users logged in I'd say that the easiest approach is to create some kind of override for the reboot/shutdown/poweroff commands. That override would then perform whatever checks you want it to perform, before then calling the real binary.
The least intrusive methods to create such an override ought to be to either have a shell alias pointing to a custom script or to define a shell function. Both aliases and functions are tried before the shell goes looking for an executable in the PATH.
andol
- 7,074