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*

3
  • Did you try actually excluding those commands in the file? Commented May 22, 2021 at 10:49
  • 1
    Did you also exclude for example vi? Example: sudo vi /tmp/foo . In vi :sh and again you get a root shell. That's just to tell this method is doomed to fail (ok maybe this example gets some unknown protection with SELinux, I don't know but not everything will). Commented May 22, 2021 at 10:53
  • 1
    If you want to prevent users from getting a root shell, you need to provide an approved list of commands; otherwise if they can write anywhere, they can add their own copy of a shell, which won’t be on the denied list, and run that. As A.B hints, you also need to be absolutely certain that the commands on the approved list can’t be used to get a shell; that’s one reason why users shouldn’t be allowed to run editors as root, but use sudoedit instead. Commented May 22, 2021 at 16:30