1

I am trying to gain root user access to another user so that I can run a command with adding sudo in front of any command.

Example: fdisk -l

Getting the error message as:

fdisk: cannot open /dev/loop0: Permission denied
fdisk: cannot open /dev/loop1: Permission denied
fdisk: cannot open /dev/loop2: Permission denied
fdisk: cannot open /dev/loop3: Permission denied

I tried to give the root user access to the user with the name sudhir.

switched to root user with su -

visudoers

Added the user as

root    ALL=(ALL:ALL) ALL
sudhir  ALL=(ALL:ALL) ALL

screenshot of the sudoers file

Saved with ctrl+o, switched to user & executed the command fdisk -l, still getting the same error.

Any idea?

Melebius
  • 11,431
  • 9
  • 52
  • 78
  • 4
    Did you remember to logout/login after changes to user permissions? – user535733 Jul 10 '19 at 00:52
  • 1
    You must still type sudo fdisk -l as user sudhir. – PerlDuck Jul 10 '19 at 08:48
  • 1
    Is your goal that all commands run by sudhir, even without sudo, run as if by root? This is inadvisable; e.g., users shouldn't run firefox or libreoffice as root (nor with abilities equivalent to root's). Even if you're not concerned about security, this would make some strange and unexpected mistakes easier to make. If you still want that, I recommend you [edit] to make that clear. Otherwise, I recommend you [edit] about what you do need. Did @PerlDuck's comment answer your question? Do you want sudo not to require a password? Does sudhir want a root shell (as with sudo -i)? – Eliah Kagan Jul 11 '19 at 01:17
  • I have updated sudoers file saved (ctrl+) & exited (ctrl+x). – user497091 Jul 11 '19 at 02:40
  • @PerlDuck Im trying run command fdisk -l with user "sudhir" without sudo command infront. Just like the root user. – user497091 Jul 11 '19 at 02:43

0 Answers0