Gentoo Archives: gentoo-user

From: "赵佳晖" <jiahui.tar.gz@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Problem with sudo
Date: Sun, 01 Jul 2012 02:42:56
Message-Id: CAJf79niNjoL_3mvaZEv+YyCEUZ-68eE1cLw__u2omYqStovWYQ@mail.gmail.com
In Reply to: Re: [gentoo-user] Problem with sudo by "Éric DUNAND"
1 I have use your method , it didn't work .
2 Like:
3 sudo echo "sys-boot/grub:2 **" >>
4 /etc/portage/package.accept_keywords/package.keywords.grub2 echo
5 "sys-boot/grub:2 **" | sudo tee
6 /etc/portage/package.accept_keywords/package.keywords.grub2
7
8 And the result :
9 zjhui@gentoo ~ $ ls -l
10 /etc/portage/package.accept_keywords/package.keywords.grub2
11 -rw-r--r-- 1 root root 0 Jul 1 10:37
12 /etc/portage/package.accept_keywords/package.keywords.grub2
13
14 It's an empty file.
15
16
17 2012/7/1 Éric DUNAND <eric.dunand.ml@×××××××.eu>
18
19 > Le Sat, 30 Jun 2012 19:48:28 +0100,
20 > Neil Bothwick <neil@××××××××××.uk> a écrit :
21 >
22 > > On Sun, 1 Jul 2012 01:27:49 +0800, 赵佳晖 wrote:
23 > >
24 > > > In some cases , when i run somethings with "sudo" , it tells me
25 > > > "Permission Denied" , then i should turn to root . i forgot to
26 > > > record the cases . Did anyone have any ideas ?
27 > >
28 > > Are you trying to redirect the output? That can give this message
29 > > because the redirection is performed as the user running sudo, not as
30 > > root.
31 > >
32 > >
33 >
34 > If Neil is right, you may want to read man tee. It work roughly like
35 > that:
36 > instead of do
37 > sudo echo sthg > /etc/file.cfg echo sthg | sudo tee /etc/file.cfg
38 > sudo echo sthg >> /etc/file.cfg echo sthg | sudo tee -a /etc/file.cfg
39 > --
40 > Éric DUNAND
41 >
42 >
43
44
45 --
46 好好学习,天天向上!!!

Replies

Subject Author
Re: [gentoo-user] Problem with sudo Willie WY Wong <wongwwy@××××××××××.org>