[Users] "permission denied" error on CT rc.local script to add
custom commands by regular user with full root rights granted via sudo
knawnd at gmail.com
knawnd at gmail.com
Sat Jun 25 13:56:36 EDT 2011
Sharp wrote on 25/06/11 21:14:
> On Sat, Jun 25, 2011 at 8:56 PM,<knawnd at gmail.com> wrote:
>> $ sudo echo "# oneadmin test">> /vz/private/164/etc/rc.d/rc.local
>> -bash: /vz/private/164/etc/rc.d/rc.local: Permission denied
>>
>> Does someone have any ideas what can be the reason of insufficient
>> privileges for regular user with full root rights granted via sudo?
>
> That's simple. Your echo command is running as root because of sudo.
> But the shell that's redirecting echo's output is still running as
> you.
>
> You can become a root and do that command without any problems.
Thanks for quick reply!
I need to do that in a script. I found the solution:
$ sudo bash -c 'echo "# oneadmin test 2" >> /vz/private/164/etc/rc.local'
Regards,
Nikolay.
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://openvz.org/mailman/listinfo/users
More information about the Users
mailing list