OpenVZ Forum


Home » Mailing lists » Users » "permission denied" error on CT rc.local script to add custom commands by regular
Re: "permission denied" error on CT rc.local script to add custom commands by reg [message #42991 is a reply to message #42990] Sat, 25 June 2011 17:56 Go to previous message
knawnd is currently offline  knawnd
Messages: 27
Registered: April 2011
Junior Member
Sharp wrote on 25/06/11 21:14:
> On Sat, Jun 25, 2011 at 8:56 PM,<knawnd@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.
 
Read Message
Read Message
Read Message
Previous Topic: vzdev-3.3.13-1.4.swsoft
Next Topic: Strange mount problem
Goto Forum:
  


Current Time: Mon Aug 11 16:42:04 GMT 2025

Total time taken to generate the page: 0.42646 seconds