Nп/п : 86 из 100
 От   : Keith Thompson                      2:5075/128        19 сен 23 17:21:04
 К    : Hongy                                                 19 сен 23 03:25:02
 Тема : Re: sed -i `/%sudo/c %sudo ALL=(ALL:ALL) NOPASSWD:ALL` /etc/sudoers
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <87cyyditjj.fsf@nosuchdomain.example.com>
aad9590d
@REPLY:
<2eceb154-cc94-46a3-a897-825f885316f5n@googlegroups.com> 8586fb81
@REPLYADDR Keith Thompson
<Keith.S.Thompson+u@gmail.com>
@REPLYTO 2:5075/128 Keith Thompson
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
<87cyyditjj.fsf@nosuchdomain.example.com>
<f1c33e51-6c3b-4e7a-ab15-fd694fdee755n@googlegroups.com><874jjqk812.fsf@nosuchdo
main.example.com><2eceb154-cc94-46a3-a897-825f885316f5n@googlegroups.com>
pan> @TZUTC: -0700
@PID: Gnus/5.13 (Gnus v5.13) Emacs/27.2
(gnu/linux)
@TID: FIDOGATE-5.12-ge4e8b94
"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:
> On Tuesday, September 19, 2023 at 2:10:42 PM UTC+8, Keith Thompson wrote:
>> "hongy...@gmail.com" <hongy...@gmail.com> writes: 
>> > I noticed the following usage here [1]: 
>> > 
>> > sed -i `/%sudo/c %sudo ALL=(ALL:ALL) NOPASSWD:ALL` /etc/sudoers 
>> > visudo -c 
>> > 
 >> > But I`m puzzled by the `c` that appeared in the `/%sudo/c`
part of the sed command above. Any tips will be helpful. 
>> > 
>> > [1] https://blog.51cto.com/u_4820306/5425575
>> The `c` command is a GNU extension. Type "info sed" for documentation, 
>> or search online for GNU sed documentation if you don`t have it 
>> installed locally. 
>> 
>> (Seriously, I wonder why checking the documentation wasn`t your first 
>> thought before posting here.) 
>
> See the following documentation on my machine and the corresponding tests:
[SNIP]
> Therefore, the explanation of the documentation is not very adequate.

I see that the explanation in `info sed` is clear enough to explain the
behavior of the sed command you showed in the parent article.  (Each
line containing "%sudo" is replaced with the specified text.  You could
use the `s` command to do the same thing, perhaps more clearly, since
the `c` command is a bit obscure IMHO.)

(`man sed` is missing this information, but the "SEE ALSO" section
at the bottom says the man page is incomplete.  This is usually
the case for GNU software.)

I`d just edit the file manually using `visudo`, but maybe you want to do
this on a lot of systems and want to automate it.

You might also consider first running the sed command on a copy of your
sudoers file so you don`t risk breaking anything.

If you want to ask about something like this please (1) let us know that
you actually checked the documentation before posting (it was reasonable
to assume that you hadn`t bothered) and (2) if you find the
documentation unclear, let us know what you find unclear about it.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
--- Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 * Origin: None to speak of (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх