I am trying to add sudo permission for a user to login as a different user. Currently I am looking for below scenario.

For eg: If "Sam" need to login as "Scott" using sudo access then what are all the command that I need to run using root ID.


This should do the work, to enable sam to become scott using sudo. Replace last "ALL" with specific commands sam can run as scott.

  • Is this a command? or I need to add this in /ect/sudoers – Jo......... Feb 25 at 21:40
  • Add this to /etc/sudoers. Just type visudo and below line root = ALL(ALL) ALL add the line in the answer – Tryna Learn Somethin Feb 25 at 21:41
  • Its asking me password when I do sudo su - scott. How to grant sudo permission without asking password – Jo......... Feb 25 at 21:49
  • Change line to sam = ALL(scott) NOPASSWD: ALL – Tryna Learn Somethin Feb 25 at 21:50
  • I have already tried that one but I am getting syntax error. – Jo......... Feb 25 at 21:52

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.