2

I don't want any users in my machine to use a command in my machine other than root user. The command is given below.

"sudo -E su"

For security reasons

  • What do you really want to do? What do you want to accomplish from restricting that command? sudo su switches a user to root, but blocking this command won't stop them from running commands as root, nor will it stop them from logging in as root too, because as bodhi.zazen pointed out, they will still be able to run sudo -i which also takes them into a root shell. – Alaa Ali Jul 28 '14 at 5:53
  • "For security reasons" would changing the admin password and removing anyone from admin permissions not be better, security wise? (by the way: that is the default Ubuntu installs with ;) ) – Rinzwind Jul 28 '14 at 7:55
1

You are asking no other user can do sudo to be a root user.

you just need to edit a line in sudoers file.

vim /etc/sudoers

change the line from

%admin ALL=(ALL) ALL

to

your-username ALL:(ALL) ALL

after editing no other user except you can use sudo command. This is kicking all other users from sudoers file. except you.

| improve this answer | |
  • It would be better suggest to use visudo instead of vim, visudo provides basic sanity checks, and checks for parse errors. – Lety Sep 18 '14 at 21:51
0

You need to give each user a separate account (or create at least one non-admin user). Users in the admin group will be able to access root, via sudo -i or any other method.

| improve this answer | |
  • No, if we edit sudoers file then not even a chance. – Dishank Jindal Jul 28 '14 at 7:47
0

Lshell is configured via an INI file. By default, it holds a whitelist of allowed commands, but it can be easily configured to prohibit user from using a specific command.

https://unix.stackexchange.com/questions/90998/block-particular-command-in-linux-for-specific-user

| improve this answer | |

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.