Log in

Bekijk de volledige versie : su cannot set groups: Operation not permitted



zonix
02-10-2009, 23:39
Hi,

I have a WL-500gP with Oleg FW release 1.9.2.7-10.

I'm trying to create a non-root user.

I started by creating a group 'users' with addgroup:


> addgroup -g 500 users

And then created user 'fred':


> adduser -h /tmp/harddisk/home/fred -s /bin/sh -G users fred

And then made sure that '/etc/group' and '/etc/passwd' were permantely stored by entering:


> echo /tmp/etc/group >> /tmp/local/.files
> echo /tmp/etc/passwd >> /tmp/local/.files
> flashfs save && flashfs commit && flashfs enable && reboot

After that I could login with user 'fred' but can't su to admin:


> su admin
Password:
cannot set groups: Operation not permitted

Anyone have any idea what might be wrong?

Thanks!

zonix
10-04-2010, 23:03
Anyone can help?

al37919
11-04-2010, 07:33
I think you will not be able to use built in su in such way. For such operation su should have suid bit set. However, built in su is a symlink on busybox. So if you set suid for busybox, then all utilities will possess it, which is a serious flaw.

You have to use either sudo or discrete su from coreutils package. Both cases will require optware libraries installed.

zonix
11-04-2010, 16:18
Ok, I guess sudo will do.

I think I can get a similar behavior to su using:


sudo -u admin /bin/sh

Thanks!

al37919
11-04-2010, 17:28
I guess even

sudo su admin
should work correctly

zonix
11-04-2010, 20:32
Yes, in fact it does with a minor detail:


sudo -u admin su admin

Thanks!