rvim

Matthew Hannigan mlh at zip.com.au
Wed Jun 26 10:07:19 EDT 2002


Agreed.  Like so many sudo questions,
this is one satisfied by writing a special
script and putting that in sudoers.

The script could be something as simple
as

    #!/bin/sh
    # copyhosts:  copy hosts file in current dir to /etc/hosts
    # written expressly to be executed via sudo.
    cp /etc/hosts /etc/hosts.backup && cp hosts /etc/hosts


This would allow some to edit their own private
copy of the hosts file, for instance, and copy
it back to /etc/hosts and only /etc/hosts.

You would have to write one for each file that you
want to allow people to edit; or write a fancier
script to allow copying to other files.  (But be
careful!)

To make the above easier to use, you'd need another
script:

    #!/bin/sh
    # vihosts
    vi hosts && sudo copyhosts


Regards,
Matt



Yocom, Ray wrote:
> I just can't resist throwing my two cents.  If rvim will allow a user to
> open, edit and write a file as root, they can eventually gain full root
> access.  The wrapper is a good idea, but I assume that once they are in rvim
> they can open another file.  If that is the case all they would need to do
> is edit any script file that runs as root and they could do anything from
> setting up a new user to moving in a home grown login file.  If what you are
> after is the ability to edit /etc/hosts and the like, I would recommend you
> script the various edit functions (add, delete, change) and run those
> scripts via sudo.  
> 
> Ray
>





More information about the sudo-users mailing list