On 14/12/12 19:37, Rodrigo Rivas wrote:
On Fri, Dec 14, 2012 at 8:39 AM, Robbie Smith <zoqaeski@gmail.com> wrote:
On 14/12/12 01:04, Neil Perry wrote:
On 13 December 2012 13:52, Robbie Smith <zoqaeski@gmail.com> wrote:
vipw and vigr don't seem to do anything for me. It doesn't matter what
changes I make, they both report that nothing was changed.
# vipw (Makes changes in $EDITOR, writes and quits) vipw: no changes made vipw: /etc/passwd unchanged
?
I believe vipw and vigr will launch the file in using $EDITOR. Once you have made changes it will sanity check in a sandbox style before saving to the 'production' file.
Correct me if I'm wrong please.
Neil
That's what it's supposed to do, according to all the documentation that I can find. But (for me at least), it opens a temporary file in $EDITOR named vi(pw|gr).XXXXXX, where XXXXXX is a random string. Upon editing the file and exiting the editor, instead of comparing and merging the changes to the production file, it does nothing. I've even made a copy of the production file myself (as an extra precaution), and deleted every line in the tmp file, and it still does nothing.
That may depend on the editor used, you didn't say what you use. I expect that if the editor exit code is anything other than EXIT_SUCCESS (that is 0) the edition is cancelled. And some editors out there may not be mindful about the exit status. I'd recommend to use for example "vi", that does it right, and see what happens. -- Rodrigo
I use Vim as my editor, for both my own user and root. Strangely enough, if I use vi (by passing a different value for $EDITOR), it works. # EDITOR=/usr/bin/vi vipw If I query the return status of vim though on the successful modification of a file, I get 0. So I don't know why it doesn't work with vipw.