How can I restrict users switching by su
command?
Suppose there are 3 users (root,user1 and user2) only root and user1 can switch by using su
command. root or user1 should not be able to switch to user2 by using su
command.
root@instance# su - user1 *ok*
user1@instance$ sudo su - *ok*
root@instance# su - user2 *should be blocked*
user1@instance$ sudo su - user2 *should be blocked*
How can I do this?
OS is RHEL 7