Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.
share|improve this question
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 '14 at 16:40
up vote 13 down vote accepted

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.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.