From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1SlA7k-0008JE-2Y for garchives@archives.gentoo.org; Sun, 01 Jul 2012 02:42:56 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2920121C01D; Sun, 1 Jul 2012 02:42:40 +0000 (UTC) Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com [209.85.214.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 1EDB7E07C0 for ; Sun, 1 Jul 2012 02:41:12 +0000 (UTC) Received: by obbup19 with SMTP id up19so6592390obb.40 for ; Sat, 30 Jun 2012 19:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=fTxY/pys74myY097RdVVcoVpNt8C4i+4gAE5KQS4lbo=; b=HFmEqPRrm0WeEX1xK6XfVHMF/AdVV7Wzkn2298xVI22MJtR5JkjhiEYuOYzAgW/hRC F/VNzTnR+0yn1CJlxRldw2Wkvmf1OvSe3jq5h27Fsj7ntc0ywfvpvSjAdfJa1A1qk4vz f13yvlPGFSMozc/1UXABvOk5Ro3EdhnO9E0FlpDApDyH1kaeqBpjs8LOpRaBFqRh0PX2 gCP5k1Xf1C7zzhn44SRb7ZAZ8XkvwQ48hvcfrTDMDaT34cshN8aMeNWhyzi5bpNed3ib rOvarXLkNC+iLSn9C3ueuGFw7xUPGqY8TG87n+Hq43z5s4QJmNmy73zk2Hsow59imFX3 9iEw== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.50.173.69 with SMTP id bi5mr4453159igc.38.1341110472684; Sat, 30 Jun 2012 19:41:12 -0700 (PDT) Received: by 10.64.81.196 with HTTP; Sat, 30 Jun 2012 19:41:12 -0700 (PDT) In-Reply-To: <20120630212251.0a08e0a1@tsukuyomi.home> References: <20120630194828.02dbea54@digimed.co.uk> <20120630212251.0a08e0a1@tsukuyomi.home> Date: Sun, 1 Jul 2012 10:41:12 +0800 Message-ID: Subject: Re: [gentoo-user] Problem with sudo From: =?GB2312?B?1dS80erN?= To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=e89a8f5034fe54349804c3bb9d11 X-Archives-Salt: 558dee33-606a-41eb-a8ab-0eed8eb959d9 X-Archives-Hash: 2f562d48451c7386e2c2b98ac998b02f --e89a8f5034fe54349804c3bb9d11 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =C3=89ric DUNAND > Le Sat, 30 Jun 2012 19:48:28 +0100, > Neil Bothwick a =C3=A9crit : > > > On Sun, 1 Jul 2012 01:27:49 +0800, =E8=B5=B5=E4=BD=B3=E6=99=96 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 > -- > =C3=89ric DUNAND > > --=20 =E5=A5=BD=E5=A5=BD=E5=AD=A6=E4=B9=A0=EF=BC=8C=E5=A4=A9=E5=A4=A9=E5=90=91=E4= =B8=8A=EF=BC=81=EF=BC=81=EF=BC=81 --e89a8f5034fe54349804c3bb9d11 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have use your method , it didn't work .=C2=A0
Like:=C2=A0
sudo echo "sys-boot/grub:2 **" >> /etc/portage/package.a= ccept_keywords/package.keywords.grub2 echo "sys-boot/grub:2 **" |= sudo tee /etc/portage/package.accept_keywords/package.keywords.grub2

And the result :=C2=A0
zjhui@gentoo ~ $ ls -l= /etc/portage/package.accept_keywords/package.keywords.grub2=C2=A0
-rw-= r--r-- 1 root root 0 Jul =C2=A01 10:37 /etc/portage/package.accept_keywords= /package.keywords.grub2

It's an empty file.


2012/7/1 =C3=89ric DUNAND <eric.dunand.ml@erik= net.eu>
Le Sat, 30 Jun 2012 19:48:28 +0100,
Neil Bothwick <neil@digimed.co.uk<= /a>> a =C3=A9crit :

> On Sun, 1 Jul 2012 01:27:49 +0800, =E8=B5=B5=E4=BD=B3=E6=99=96 wrote:<= br> >
> > In some cases , when i run somethings with "sudo" , it = tells me
> > "Permission Denied" , then i should turn to root . i fo= rgot to
> > record the cases . =C2=A0Did 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<= br> > root.
>
>

If Neil is right, you may want to read man tee. It work roughly like<= br> that:
instead of =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 do
sudo echo sthg > /etc/file.cfg =C2=A0 echo sthg | sudo tee /etc/file.cfg=
sudo echo sthg >> /etc/file.cfg =C2=A0echo sthg | sudo tee -a /etc/fi= le.cfg
--
=C3=89ric DUNAND




-- =E5=A5=BD=E5=A5=BD=E5=AD=A6=E4=B9=A0=EF=BC=8C=E5=A4=A9=E5=A4=A9=E5=90=91= =E4=B8=8A=EF=BC=81=EF=BC=81=EF=BC=81
--e89a8f5034fe54349804c3bb9d11--