How Do You Block a Command in Linux?
Contents

How do I block a command in Linux?

However if you only want to allow the user to run several commands, here is a better solution:

  1. Change the user shell to restricted bash chsh -s /bin/rbash <username>
  2. Create a bin directory under the user home directory sudo mkdir /home/<username>/bin sudo chmod 755 /home/<username>/bin.

How do I block a specific user in Linux?

How to disable a specific command for a specific user in Linux

  1. Find the absolute path to the command to be controlled: # which mkdir /bin/mkdir.
  2. Display the current ACL for that program: …
  3. Add an access control rule for the user john: …
  4. View the updated access control: …
  5. Test the setting:
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest