2

sudo -l gives me output:

User test may run the following commands on server:
(root) NOPASSWD: /usr/bin/vim /usr/bin/motd

sudo -ll gives me output:

Sudoers entry:
    RunAsUsers: root
    Options: !authenticate
    Commands:
        /usr/bin/vim /usr/bin/motd

When i run as user 'test': sudo /usr/bin/vim I get error:

Sorry, user test is not allowed to run '/usr/bin/vim' as root on server.

I have a feeling this is due to the fact that usr/bin/vim is symlinked to another file /usr/bin/vim -> /etc/alternatives/vim

Is there anything I can do?

3

Turns out I misinterpreted the sudo -l command. This message:

User test may run the following commands on server:
(root) NOPASSWD: /usr/bin/vim /usr/bin/motd

means that the only command that can be run without password is vim with /usr/bin/motd as an argument. It doesn't mean vim or motd can be run freely.

I feel like an idiot :D

| improve this answer | |
  • 1
    You've figured it out, good job! Next time please post actual, unedited output in your question :) – gronostaj Mar 13 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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