You are not logged in.

#1 2014-09-27 14:45:28

nstgc
Member
Registered: 2014-03-17
Posts: 393

[solved] Handling sudoers.pacnew (pacdiff or visudo?)

Sudo was updated today and a since I don't have a vanilla sudoers file a .pacnew file was installed. I ran pacdiff and found no significant changes and so I left it unedited. However, had I needed to change it, I assume I would not have used pacdiff to do so, correct? The appropriate program to use is visudo, right?

[edit] This assumption comes from https://wiki.archlinux.org/index.php/Sudo#Configuration

Last edited by nstgc (2014-11-26 02:46:45)

Offline

#2 2014-09-27 14:50:04

IMBJR
Member
From: INDCMPLX
Registered: 2014-03-16
Posts: 88

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

In this case I believe you are right. visudo should always be used for the sudoers file. Otherwise, yes, pacdiff is acceptable.

Personally, I just use diff.

Last edited by IMBJR (2014-09-27 14:50:26)

Offline

#3 2014-09-27 15:07:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

I use visudo.

Offline

#4 2014-09-27 20:19:25

root
Member
From: 127.0.0.1
Registered: 2012-04-13
Posts: 297

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

I use vimdiff (through yaourt -C) in order to see the changes and edit the file with visudo in another tab.

As I am still noobish with vi and even if there is no error message after writing the file with the changes I made, I repeat the vimdiff procedure in order to check that everything is fine before deleting the .pacnew file/proceeding to 'ok' the new sudoers file.


\(o_X)/
                        'Cause I wanna be an Archy - An Archy in the UK // Sex Pistols

Offline

#5 2014-09-27 20:59:27

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 12,074
Website

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

How I handle it (with vim set as my default editor):

$ sudo visudo
:diffthis
:vnew
Ctrl+w, r (optional, puts the new buffer on the right)
:e/etc/sudoers.pacnew
:diffthis
Ctrl+w, Ctrl+w

Then merge the differences. Chances are there's nothing worth losing sleep over. I think there was a couple of comment differences when I did mine earlier.

Last edited by WorMzy (2014-09-27 21:00:06)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2014-11-25 23:22:55

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

WorMzy wrote:

How I handle it (with vim set as my default editor):

$ sudo visudo
:diffthis
:vnew
Ctrl+w, r (optional, puts the new buffer on the right)
:e/etc/sudoers.pacnew
:diffthis
Ctrl+w, Ctrl+w

Then merge the differences. Chances are there's nothing worth losing sleep over. I think there was a couple of comment differences when I did mine earlier.

Great answer! That's what I was looking for. I don't remember how I handled it at the time, but now I'm updating a computer that I had not merged any pacnew files for all year. This has given me a long list of special files to deal with and I'm looking for the "proper" way because I remember having some issues before. Those files are:
passwd
shadow
group
gshadow
sudoers

After investigating them, this one is the only one I should've done anything with last time. Since I tried to merge all of them, I got myself into trouble. Seems like a mistake to ever put through pacnew files on group/passwd the related shadow files. I will investigate if they show up again, but probably end up deleting them.

For some reason, even though `echo $EDITOR` shows it's "vim", visudo isn't using vim unless I define the variable again. Even exporting VISUAL to "vim" or "/usr/bin/vim -p -X" in .bashrc or .zshrc doesn't work for me anymore. I have to change your first line to:

$ sudo VISUAL="/usr/bin/vim -p -X" visudo

Last edited by colinkeenan (2014-11-26 00:49:21)

Offline

#7 2014-11-26 02:45:59

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: [solved] Handling sudoers.pacnew (pacdiff or visudo?)

Forgot to mark this as [solved]. I'm just using pacdiff because I'm lazy, though I do think WorMzy's answer is the best.

Offline

Board footer

Powered by FluxBB