From: Florian Philipp <lists@binarywings.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Allow non root users to edit files owned by root?
Date: Tue, 20 Dec 2011 17:00:01 +0100 [thread overview]
Message-ID: <4EF0B101.3060709@binarywings.net> (raw)
In-Reply-To: <CA+czFiBbUJdk5W-fCGNecektdA+mn_jzb46eXnUk=5gjUD=NmQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]
Am 20.12.2011 16:13, schrieb Michael Mol:
> On Tue, Dec 20, 2011 at 10:04 AM, Tanstaafl <tanstaafl@libertytrek.org> wrote:
>> Hi all,
>>
>> I'm guessing this is a sudo question, but I'm unfamiliar with the nuances of
>> sudo (never had to use it before).
>>
>> I have a new hosted VM server that I want to allow a user to be able to edit
>> files owned by root, but without giving them the root password.
>>
>> I already did:
>>
>> /usr/sbin/visudo
>>
>> and added the following line:
>>
>> %sudoroot ALL=(ALL) ALL
>>
>> and made sure the user is in this group, but they still get an access denied
>> error when trying to mv or cp files that are owned bu root.
>>
>> What is the best way to do this? I'd really prefer to not give them the root
>> password so they can su -...
>
> The sudo command allows commands to be executed *as though they were root*.
>
> 'sudo su -' would work. So would 'sudo mv src dst'.
>
> So, incidentally, would 'sudo passwd root'...
>
For file editing alone, you can allow rights to sudoedit, for example:
%sudoroot sudoedit
This allows sudoroot members to execute `sudoedit $file` which starts an
editor (defined via environment variable EDITOR) with the file in a save
fashion (similar to visudo). But you also have to restrict the editors
because most of them are able to spawn a shell (which would then have
root rights). Restricted editors like `rnano` or `rvim` circumvent this
issue. To do this, set something like this in your sudoers file:
editor=rnano:rvim
You should probably also restrict which files can be edited (not
/etc/passwd, /etc/shadow or /etc/sudoers, for sure!). You can do this
with globs. For example:
%sudoroot sudoedit /var/www/*
Hope this helps,
Florian Philipp
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2011-12-20 16:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 15:04 [gentoo-user] Allow non root users to edit files owned by root? Tanstaafl
2011-12-20 15:13 ` Michael Mol
2011-12-20 16:00 ` Florian Philipp [this message]
2011-12-20 17:03 ` Tanstaafl
2011-12-20 17:20 ` Florian Philipp
2011-12-20 18:20 ` Tanstaafl
2011-12-22 15:41 ` Tanstaafl
2011-12-22 15:46 ` James Broadhead
2011-12-20 16:51 ` Tanstaafl
2011-12-20 17:06 ` Michael Mol
2011-12-21 5:55 ` Walter Dnes
2011-12-21 19:07 ` Florian Philipp
2011-12-20 17:19 ` [gentoo-user] " Nikos Chantziaras
2011-12-22 15:44 ` Tanstaafl
2011-12-22 18:00 ` Nikos Chantziaras
2011-12-22 18:53 ` Tanstaafl
2011-12-22 19:21 ` Alan McKinnon
2011-12-22 19:33 ` Tanstaafl
2011-12-22 19:49 ` Alan McKinnon
2011-12-22 19:42 ` Nikos Chantziaras
2011-12-22 19:36 ` Nikos Chantziaras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EF0B101.3060709@binarywings.net \
--to=lists@binarywings.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox