Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
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 at 16:40

1 Answer 1

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 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 at 17:14
1  
@enedil don't put additional information into a comment - edit you answer instead. –  guntbert Mar 26 at 18:04

Your Answer

 
discard

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.