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

2
  • 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, 2014 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, 2014 at 7:55

3 Answers 3

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.

1
  • It would be better suggest to use visudo instead of vim, visudo provides basic sanity checks, and checks for parse errors.
    – Lety
    Sep 18, 2014 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.

1
  • No, if we edit sudoers file then not even a chance. Jul 28, 2014 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .