Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#24095 - [initscripts] rc: error if user is not root or uses sudo
Attached to Project:
Arch Linux
Opened by Steffen Weber (boenki) - Wednesday, 04 May 2011, 15:00 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 18 June 2011, 23:55 GMT
Opened by Steffen Weber (boenki) - Wednesday, 04 May 2011, 15:00 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 18 June 2011, 23:55 GMT
|
DetailsDescription:
If you execute /sbin/rc without beeing root or using sudo it will try to start/stop/restart the service. But that does not work. Someone may add a check if the user is allowed to do the task before even trying it. Additional info: * package version(s) Name : initscripts Version : 2011.04.1-2 |
This task depends upon
~> id -u
1000
~> /sbin/rc
usage: rc action daemon ...
e.g: rc list
rc help
rc start sshd gpm
~> /sbin/rc list
[STARTED][AUTO] alsa
[STOPPED][ ] avahi-daemon
[STOPPED][ ] avahi-dnsconfd
[STARTED][AUTO] cups
[STARTED][AUTO] dbus
[STARTED][AUTO] fcrond
...
starting / stoping a service.
If a normal user tries to start a service it does not work.
So the user rights should be checked before rc tries to start/stop/restart a service.
If the user does not have the required privileges rc should not try to execute the command,
echo something like "Error: You need to use sudo or to be root"
and exit.
eg:
[boenki ~]$ id -u
1000
[boenki ~]$ rc start dbus
:: Starting D-BUS system messagebus [BUSY]
Failed to start message bus: The pid file "/var/run/dbus.pid" exists, if the message bus is not running, remove this file
[FAIL]
I notified Seblu in case he sees a reasonable solution to this. At the moment I do not.
I don't really see the need either though, if you don't have the permissions it will be obvious enough... I'll close as won't implement unless someone proposes an elegant implementation.
BTW Tom, you can assign a bug to any bug tracker user, not only developers.
I didn't manage to assign the bug to anyone not in the list... but I guess the notification has the same effect.
If we want to disallow non-root users to "run" a rc.d script, we should _not_ implement this into /sbin/rc.d but in functions.
Otherwise rc.d start httpd and /etc/rc.d/http start will no longer be equivalent.
Thomas, when you say rc.d should be used as root. You could say the same of pacman. However, it is possible to have access to lots of pacman functions when you are not root.
And it's convenient.
There is no serious reason to refuse to list daemon status (rc.d list) when you are not root. Information is readable in /run by everyone. It's sugar display.
The biggest technical problem i see with a global/generic restriction on user it's about commands other than start / stop / restart / reload, which have a priori need to be root.
For example, some script have an status (eg: rc.d git-daemon status) or whatever, which can be called without being root. if we blocks in rc.d or in functions, we will lost some functionnalities.
that take in account all concerns presented in this report.