Hi!

I need to add in script some custom commands into /etc/rc.local file located in CT filesystem in order to execute them on CT start up. It needs to be done under regular user with full root rights granted via sudo. But "permission denied" error appears.

$ sudo echo "# oneadmin test" >> /vz/private/164/etc/rc.d/rc.local
-bash: /vz/private/164/etc/rc.d/rc.local: Permission denied

$ grep -v ^# /etc/sudoers|grep -v ^$
Defaults    env_reset
Defaults    env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
                        LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \ LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
                        _XKB_CHARSET XAUTHORITY"
root    ALL=(ALL)       ALL
%cloud  ALL=(ALL)       NOPASSWD: ALL

$ id
uid=9000(oneadmin) gid=9001(cloud) groups=9001(cloud)

$ sudo id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

$ sudo ls -al /vz/private/164/etc/rc.d/rc.local
-rwxr-xr-x 1 root root 227 Jun 25 20:17 /vz/private/164/etc/rc.d/rc.local

Whereas the same command (i.e. echo "# oneadmin test" >> /vz/private/164/etc/rc.d/rc.local) is performed normally under superuser.

CT is based on Scientific Linux 5 template. Hardware node is running under CentOS 5.6.

Does someone have any ideas what can be the reason of insufficient privileges for regular user with full root rights granted via sudo?

Thanks in advance,
Nikolay.

_______________________________________________
Users mailing list
[email protected]
https://openvz.org/mailman/listinfo/users

Reply via email to