LEDE Project

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category Base system
  • Assigned To
    Yousong Zhou
  • Operating System All
  • Severity High
  • Priority Very Low
  • Reported Version Trunk
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: LEDE Project
Opened by Alexander Lochmann - 28.08.2017
Last edited by Yousong Zhou - 09.11.2017

FS#988 - Procd does not respect a user's groups when using parameter user

Hi folks!

I’m referring to git revision 4b3ffecf2b.
Using this, procd does *not* respect a user’s groups (/etc/group) when starting a service.
In my case, I want a particular service running as a particular user (procd_set_param user foo). The user is a member of several groups, and they are needed when running that service.
However, the service runs as user foo, but he is not a member of the other groups as described in /etc/group. I verified it by using a wrapper script which wrote the output of ‘id’ to a file.

Steps to reproduce:
1. Create a user foo having primary group foo and is a member of group bar.
2. Write a short bash script which write the output of ‘id’ to a file.
3. Create a service that starts the aforementioned script.
4. Have a look at the output. It should say something like this: uid=XXX(foo) gid=xxx(foo).

I expect it to be: uid=XXX(foo) gid=XXX(foo) groups=XXX(bar).

Cheers,
Alex


Closed by  Yousong Zhou
09.11.2017 10:01
Reason for closing:  Fixed
Additional comments about closing:  

ht tps://git.lede-project.org/b2aa820b48add 74b97e0eab993ede648c43e85db

Project Manager
Yousong Zhou commented on 09.11.2017 09:59

Hi, please check relevant entries in /etc/passwd and /etc/group to see if user "foo" has the right primary group id set there. If you are using /lib/functions.sh to add group and users, it's very likely that it generated wrong id in the user/group database.

The following snippet should confirm that.

. /lib/functions.sh
# old, buggy way
# group_add_next bar; gid=$?
gid=$(group_add_next bar)
user_add foo "" "$gid"

. /lib/functions/procd.sh
service_triggers() { true; }
procd_open_service foo foo
procd_open_instance bz
procd_set_param user foo
procd_set_param command '/bin/sh' '-c' 'logger $(id)'
procd_close_instance
procd_close_service

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing