Bug 224667 - The tools reboot and halt are installed with incorrect permissions
Summary: The tools reboot and halt are installed with incorrect permissions
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.1-RELEASE
Hardware: i386 Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-29 07:28 UTC by dr2867.business
Modified: 2018-01-16 15:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dr2867.business 2017-12-29 07:28:50 UTC
The programs halt and reboot in /sbin do not seem to be installed with correct group and permissions.

strata:/home/dr2867 1032 $$$ ->cd /sbin
strata:/sbin 1033 $$$ ->ls -l reboot halt poweroff shutdown
-r-xr-xr-x  4 root  wheel      7680 Dec 22 23:58 halt
-r-sr-xr--  2 root  operator  11508 Dec 22 23:58 poweroff
-r-xr-xr-x  4 root  wheel      7680 Dec 22 23:58 reboot
-r-sr-xr--  2 root  operator  11508 Dec 22 23:58 shutdown
strata:/sbin 1034 $$$ ->

I do not know if they were installed this way originally, but I noticed this just now after trying to reboot the system as a normal user.  I can do it through shutdown -r now though.  I have performed a make buildworld and make installworld to include security fixes for 11.1 release.
Comment 1 Mark Millard 2017-12-29 22:09:41 UTC
(In reply to dr2867.business from comment #0)

This likely is deliberate for reboot, quoting
"man reboot" about it not normally being used:

 Normally, the shutdown(8) utility is used when the system needs to be
     halted or restarted, giving users advance warning of their impending doom
     and cleanly terminating specific programs.

Reboot takes more ricks of unclean behavior.
It being more restricted makes sense.

This really covers:

NAME
     reboot, halt, fastboot, fasthalt - stopping and restarting the system

as more risky by not cleanly terminating
as much as the shutdown command variations do.
Comment 2 dr2867.business 2018-01-16 08:47:53 UTC
Fair enough.  Why not just make it all one program then?  Since the shutdown program has all the functionality and it is safe.  According to the man page for shutdown(1):

poweroff is equivalent to shutdown -p now.

In that case, reboot would be shutdown -r now
halt: shutdown -h now

I thought it was the same program but looking at the ls it is obvious that they are not.
Comment 3 Mark Millard 2018-01-16 15:48:34 UTC
(In reply to dr2867.business from comment #2)

Quoting the man page for reboot:

-l	     The halt or reboot	is not logged to the system log.  This option
	     is	intended for applications such as shutdown(8), that call
	     reboot or halt and	log this themselves.

So shutdown uses reboot/halt for its last stage of operation
if the above description is correct.

There may be special contexts in which the extra steps that
shutdown does are to be avoided. (Not that I know of any off
the top of my head. May be if there is evidence of memory
corruption or some such: a clean shutdown based on a garbage
state need not make sense.)