About sudo

if I release sudo to a user , the user will have ALL function of root , if I just want a user ONLY have the permission to su another user ( NO any root permission ) , what can i do ? thx

You can control the roles that user going to own after su.

E.g., if you want user1 to do su to user2 only then do the below:

  1. entry to be added to sudoers:

user1 <hostname> = /usr/bin/switch.sh (just an e.g.,)

  1. create the file /usr/bin/switch.sh with the line below

su - user2

  1. chmod +x /usr/bin/switch.sh

  2. ask user user1 to run the below:

$sudo /usr/bin/switch.sh

DONE