[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I need to be root to run this script



Hello,


15 janv. 2020 à 18:45 de wooledg@eeg.ccf.org:

> On Wed, Jan 15, 2020 at 06:40:42PM +0100, l0f4r0@tuta.io wrote:
>
>> What's the pro of
>>
>> tail -n +1 /etc/sudoers.d/*
>>
>> compared to a simple cat as your tail is fetching from the 1st line so does cat?
>>
>
> It writes a header for each file, if there's more than one file.  So,
> it basically replaces the { echo "=== $f" && ... part of the previously
> suggested command.
>
> wooledg:~$ tail -n+1 /etc/debian_version /etc/hostname
> ==> /etc/debian_version <==
> 10.2
>
> ==> /etc/hostname <==
> wooledg
>
Very clever, thanks :)


16 janv. 2020 à 10:00 de andreimpopescu@gmail.com:

> On Mi, 15 ian 20, 18:40:42, > l0f4r0@tuta.io>  wrote:
>
>> find /etc/sudoers.d -type f -exec echo '{}' \; -exec cat '{}' \;
>>
> Maybe replace the '-exec echo {}' with '-print'?
>
Exactly, thanks as well :)


16 janv. 2020 à 21:59 de dsr@randomstring.org:

> I would put it in /etc/sudoers, myself.
>
It's not recommended to modify /etc/sudoers because it can be overwritten/reset during a next upgrade.
Best is to have a file inside /etc/sudoers.d.
Be sure to have the following instruction in your /etc/sudoers:

#includedir /etc/sudoers.d

NB: this is not a comment but a real/active instruction ;)


16 janv. 2020 à 16:21 de guikaye@gmail.com:

> $ cat /etc/sudoers
> cat: /etc/sudoers: Permission denied
>
Please use:

sudo cat /etc/sudoers

on both machines

PS: if not already the case, you should always edit your sudoers files with visudo or visudo -f /my/path/to/sudoers/fileIt makes some syntaxic checks before saving the file, preventing you having great trouble ;)
Best regards,
l0f4r0


Reply to: