FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 06-30-2012, 05:27 PM
赵佳晖
 
Default Problem with sudo

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 ?

--
好好**,天天向上!!!
 
Old 06-30-2012, 05:34 PM
Alecks Gates
 
Default 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
 
Old 06-30-2012, 06:48 PM
Neil Bothwick
 
Default 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
 
Old 06-30-2012, 07:22 PM
Éric DUNAND
 
Default 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
 
Old 07-01-2012, 02:36 AM
赵佳晖
 
Default 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



--
好好**,天天向上!!!
 
Old 07-01-2012, 02:41 AM
赵佳晖
 
Default 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

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





--
好好**,天天向上!!!
 
Old 07-01-2012, 02:55 AM
Alecks Gates
 
Default 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.
 
Old 07-01-2012, 05:06 AM
赵佳晖
 
Default 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:

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.





--
好好**,天天向上!!!
 
Old 07-01-2012, 08:03 AM
Neil Bothwick
 
Default 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.

sudo -i
sudo su
sudo bash
sudo zsh
sudo screen
sudo tmux

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.
 
Old 07-03-2012, 12:50 PM
Willie WY Wong
 
Default 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
 

Thread Tools




All times are GMT. The time now is 09:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org