Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    If you're running sudo -u jbossuser ./script.sh, then the sudoers line should be user ALL = (jbossuser) NOPASSWD: /path/to/script.sh, with the full path to script.sh. It isn't clear how the server is given to script, so it's not possible to say how you could limit that, and the script is only using the jbossuser and running ps -ef, so those restrictions are already in place. Commented Oct 30, 2018 at 1:42
  • I've added more detail to the question, and actually your comment got me thinking... it would be easier to put the status() function into a separate script and allow the Standard Users to execute that as the jbossuser (basically what you wrote above. Its not as tidy but it would probably work. Commented Oct 30, 2018 at 17:37
  • Eh, why bother with modifying the script instead of letting "standard users" run sudo -u jbossuser script.sh? Commented Oct 31, 2018 at 4:58
  • It's because the script also allows you to stop, start and restart the instances, which I don't want the standard users to be able to do. Commented Oct 31, 2018 at 9:30
  • Maybe the standard users should have sudo access to a separate status-only script? Commented Oct 31, 2018 at 10:06