service: allow starting service with user's realuid
This commit is contained in:
parent
d5210e9bdd
commit
d4cdd59eaa
|
@ -138,11 +138,17 @@ PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
|
||||||
uid= pw->pw_uid;
|
uid= pw->pw_uid;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uid= strtol(cpe->word, &check, 0);
|
if (!strncmp(cpe->word, KW_SELF, strlen(KW_SELF)+1))
|
||||||
if (check[0] != '\0')
|
|
||||||
{
|
{
|
||||||
fatal("do_uid: bad uid/login '%s' at %s:%d",
|
uid= getuid(); /* Real uid */
|
||||||
cpe->word, cpe->file, cpe->line);
|
}
|
||||||
|
else {
|
||||||
|
uid= strtol(cpe->word, &check, 0);
|
||||||
|
if (check[0] != '\0')
|
||||||
|
{
|
||||||
|
fatal("do_uid: bad uid/login '%s' at %s:%d",
|
||||||
|
cpe->word, cpe->file, cpe->line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#define KW_SERVICE "service"
|
#define KW_SERVICE "service"
|
||||||
#define KW_UID "uid"
|
#define KW_UID "uid"
|
||||||
|
#define KW_SELF "SELF"
|
||||||
#define KW_SIGMGR "sigmgr"
|
#define KW_SIGMGR "sigmgr"
|
||||||
#define KW_SCHEDULER "scheduler"
|
#define KW_SCHEDULER "scheduler"
|
||||||
#define KW_PRIORITY "priority"
|
#define KW_PRIORITY "priority"
|
||||||
|
|
|
@ -42,10 +42,12 @@ where \fI<program_name>\fR is the name of the program used to start the
|
||||||
given system service. In each service entry, the following options can
|
given system service. In each service entry, the following options can
|
||||||
be used:
|
be used:
|
||||||
.PP
|
.PP
|
||||||
\fBuid\fR \fI<uid|user name>\fR\fB;\fR
|
\fBuid\fR \fI<uid|SELF|user name>\fR\fB;\fR
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
specifies the user id or the user name to use to run the system service.
|
specifies the user id or the user name to use to run the system service.
|
||||||
|
\fISELF\fR can be used when the service has to start with the realuid of
|
||||||
|
the user who's executing the \fBservice\fR utility.
|
||||||
Many system services run with root privileges (uid \fB0\fR).
|
Many system services run with root privileges (uid \fB0\fR).
|
||||||
The default user is service (uid \fB12\fR).
|
The default user is service (uid \fB12\fR).
|
||||||
.RE
|
.RE
|
||||||
|
|
Loading…
Reference in a new issue