In some cases , when i run somethings with "sudo" , it tells me "Permission Denied" , then i should turn to root . i forgot to record the cases . *Did anyone have any ideas ?
--
好好**,天天向上!!!
06-30-2012, 05:34 PM
Alecks Gates
Problem with sudo
On Jun 30, 2012 12:28 PM, "赵佳晖" <jiahui.tar.gz@gmail.com> wrote:
>
> In some cases , when i run somethings with "sudo" , it tells me "Permission Denied" , then i should turn to root . i forgot to record the cases . *Did anyone have any ideas ?
>
> --
> 好好**,天天向上!!!
I think it would depend on the use case, but try "sudo -i" (-i meaning interactive, I believe) and see if that works for you.* I get permission denied usually with a lot of bash input and output.
Alecks Gates, sent from Android on an HTC G2
06-30-2012, 06:48 PM
Neil Bothwick
Problem with sudo
On Sun, 1 Jul 2012 01:27:49 +0800, 赵佳晖 wrote:
> In some cases , when i run somethings with "sudo" , it tells me
> "Permission Denied" , then i should turn to root . i forgot to record
> the cases . Did anyone have any ideas ?
Are you trying to redirect the output? That can give this message because
the redirection is performed as the user running sudo, not as root.
--
Neil Bothwick
Man and mouse are alike, both end up in pussy
06-30-2012, 07:22 PM
Éric DUNAND
Problem with sudo
Le Sat, 30 Jun 2012 19:48:28 +0100,
Neil Bothwick <neil@digimed.co.uk> a écrit :
> On Sun, 1 Jul 2012 01:27:49 +0800, 赵佳晖 wrote:
>
> > In some cases , when i run somethings with "sudo" , it tells me
> > "Permission Denied" , then i should turn to root . i forgot to
> > record the cases . Did anyone have any ideas ?
>
> Are you trying to redirect the output? That can give this message
> because the redirection is performed as the user running sudo, not as
> root.
>
>
If Neil is right, you may want to read man tee. It work roughly like
that:
instead of do
sudo echo sthg > /etc/file.cfg echo sthg | sudo tee /etc/file.cfg
sudo echo sthg >> /etc/file.cfg echo sthg | sudo tee -a /etc/file.cfg
--
Éric DUNAND
07-01-2012, 02:36 AM
赵佳晖
Problem with sudo
The -i option didn't work, it also says Permission Denied
2012/7/1 Alecks Gates <alecks.g@gmail.com>
On Jun 30, 2012 12:28 PM, "赵佳晖" <jiahui.tar.gz@gmail.com> wrote:
>
> In some cases , when i run somethings with "sudo" , it tells me "Permission Denied" , then i should turn to root . i forgot to record the cases . *Did anyone have any ideas ?
>
> --
> 好好**,天天向上!!!
I think it would depend on the use case, but try "sudo -i" (-i meaning interactive, I believe) and see if that works for you.* I get permission denied usually with a lot of bash input and output.
Alecks Gates, sent from Android on an HTC G2
--
好好**,天天向上!!!
07-01-2012, 02:41 AM
赵佳晖
Problem with sudo
I have use your method , it didn't work .*Like:*sudo echo "sys-boot/grub:2 **" >> /etc/portage/package.accept_keywords/package.keywords.grub2 echo "sys-boot/grub:2 **" | sudo tee /etc/portage/package.accept_keywords/package.keywords.grub2
And the result :*zjhui@gentoo ~ $ ls -l /etc/portage/package.accept_keywords/package.keywords.grub2*-rw-r--r-- 1 root root 0 Jul *1 10:37 /etc/portage/package.accept_keywords/package.keywords.grub2
It's an empty file.
2012/7/1 Éric DUNAND <eric.dunand.ml@eriknet.eu>
Le Sat, 30 Jun 2012 19:48:28 +0100,
Neil Bothwick <neil@digimed.co.uk> a écrit :
> On Sun, 1 Jul 2012 01:27:49 +0800, 赵佳晖 wrote:
>
> > In some cases , when i run somethings with "sudo" , it tells me
> > "Permission Denied" , then i should turn to root . i forgot to
> > record the cases . *Did anyone have any ideas ?
>
> Are you trying to redirect the output? That can give this message
> because the redirection is performed as the user running sudo, not as
> root.
>
>
If Neil is right, you may want to read man tee. It work roughly like
sudo echo sthg >> /etc/file.cfg *echo sthg | sudo tee -a /etc/file.cfg
--
Éric DUNAND
--
好好**,天天向上!!!
07-01-2012, 02:55 AM
Alecks Gates
Problem with sudo
On Sat, Jun 30, 2012 at 9:36 PM, 赵佳晖 <jiahui.tar.gz@gmail.com> wrote:
> The -i option didn't work, it also says Permission Denied
>
>
> 2012/7/1 Alecks Gates <alecks.g@gmail.com>
>>
>> On Jun 30, 2012 12:28 PM, "赵佳晖" <jiahui.tar.gz@gmail.com> wrote:
>> >
>> > In some cases , when i run somethings with "sudo" , it tells me
>> > "Permission Denied" , then i should turn to root . i forgot to record the
>> > cases . Did anyone have any ideas ?
>> >
>> > --
>> > 好好**,天天向上!!!
>> I think it would depend on the use case, but try "sudo -i" (-i meaning
>> interactive, I believe) and see if that works for you. I get permission
>> denied usually with a lot of bash input and output.
>>
>> Alecks Gates, sent from Android on an HTC G2
>
>
>
>
> --
> 好好**,天天向上!!!
Did you use it interactively? It should look like this:
alecks@linux:~$ sudo -i
root@linux: ~# echo "sys-boot/grub:2 **" >>
/etc/portage/package.accept_keywords/package.keywords.grub2
Just the way I like to do it. You could also do something like "sudo
su" and I'm sure someone else here will have all sorts of
alternatives. Just like I'm sure someone has a way to do it all in
one line, anyway.
07-01-2012, 05:06 AM
赵佳晖
Problem with sudo
hmm...yes , i want to do it in one command line..
2012/7/1 Alecks Gates <alecks.g@gmail.com>
On Sat, Jun 30, 2012 at 9:36 PM, 赵佳晖 <jiahui.tar.gz@gmail.com> wrote:
> The -i option didn't work, it also says Permission Denied
>
>
> 2012/7/1 Alecks Gates <alecks.g@gmail.com>
>>
>> On Jun 30, 2012 12:28 PM, "赵佳晖" <jiahui.tar.gz@gmail.com> wrote:
>> >
>> > In some cases , when i run somethings with "sudo" , it tells me
>> > "Permission Denied" , then i should turn to root . i forgot to record the
>> > cases . *Did anyone have any ideas ?
>> >
>> > --
>> > 好好**,天天向上!!!
>> I think it would depend on the use case, but try "sudo -i" (-i meaning
>> interactive, I believe) and see if that works for you. *I get permission
>> denied usually with a lot of bash input and output.
>>
>> Alecks Gates, sent from Android on an HTC G2
>
>
>
>
> --
> 好好**,天天向上!!!
Did you use it interactively? *It should look like this:
Just the way I like to do it. *You could also do something like "sudo
su" and I'm sure someone else here will have all sorts of
alternatives. *Just like I'm sure someone has a way to do it all in
one line, anyway.
--
好好**,天天向上!!!
07-01-2012, 08:03 AM
Neil Bothwick
Problem with sudo
On Sat, 30 Jun 2012 21:55:27 -0500, Alecks Gates wrote:
> Did you use it interactively? It should look like this:
> alecks@linux:~$ sudo -i
> root@linux: ~# echo "sys-boot/grub:2 **" >>
> /etc/portage/package.accept_keywords/package.keywords.grub2
>
> Just the way I like to do it. You could also do something like "sudo
> su" and I'm sure someone else here will have all sorts of
> alternatives.
There are plenty of ways to get a root shell with sudo.
> Just like I'm sure someone has a way to do it all in
> one line, anyway.
echo "some text" | sudo tee /some/file
--
Neil Bothwick
Disinformation is not as good as datinformation.
07-03-2012, 12:50 PM
Willie WY Wong
Problem with sudo
On Sun, Jul 01, 2012 at 10:41:12AM +0800, Penguin Lover 赵佳晖 squawked:
> I have use your method , it didn't work .
> Like:
> sudo echo "sys-boot/grub:2 **" >>
> /etc/portage/package.accept_keywords/package.keywords.grub2 echo
> "sys-boot/grub:2 **" | sudo tee
> /etc/portage/package.accept_keywords/package.keywords.grub2
>
> And the result :
> zjhui@gentoo ~ $ ls -l
> /etc/portage/package.accept_keywords/package.keywords.grub2
> -rw-r--r-- 1 root root 0 Jul 1 10:37
> /etc/portage/package.accept_keywords/package.keywords.grub2
>
> It's an empty file.
I think you misread the e-mail. The left hand side below is what you
**shouldn't** do. The right hand side is what you **should** do. So
you **should** run
echo "sys-boot/grub:2 **" | sudo tee /etc/portage/package.accept_keywords/package.keywords.grub2
and no more.
W
>
> > If Neil is right, you may want to read man tee. It work roughly like
> > that:
> > instead of do
> > sudo echo sthg > /etc/file.cfg echo sthg | sudo tee /etc/file.cfg
> > sudo echo sthg >> /etc/file.cfg echo sthg | sudo tee -a /etc/file.cfg