3

Suppose that the machine has two users:

  • Alice (admin)
  • Bob (standard user)

While Bob is logged in, how can Alice modify a root file (Bob does not have this permission even with sudo)?

Alice tried:

$ sudo vim /etc/hosts
[sudo] password for Bob: 
Bob is not in the sudoers file.  This incident will be reported.
1
  • 1
    This is because Bob is not in the /etc/sudoers file. It just means that the administrator (Alice) does not trust Bob for administrative privileges.
    – Ramesh
    Mar 26, 2014 at 16:40

1 Answer 1

13

Use su:

su - alice
sudo vim /etc/hosts

From man su:

   The su command is used to become another user during a login session.
   Invoked without a username, su defaults to becoming the superuser. The
   optional argument - may be used to provide an environment similar to
   what the user would expect had the user logged in directly.

For more information, see

man su

and Wikipedia.

3
  • It works. Can you add please more information about this solution? Thanks! Mar 26, 2014 at 16:43
  • 2
    See man su. su allows the user to log in to others' accounts. en.wikipedia.org/wiki/Su_%28Unix%29
    – enedil
    Mar 26, 2014 at 17:14
  • 1
    @enedil don't put additional information into a comment - edit you answer instead.
    – guntbert
    Mar 26, 2014 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .