In Amazon linux on my ec2 server, how do I allow a group of restricted users to su to a specific user. Also I would like for them not to be prompted for password. I have a group called 'my-users' and a user called 'app-admin'. I would like for 'my-users' to be able to su into 'app-admin' and use that user to run programs. I don't want 'my-users' to have root access. Do I need to edit the sudoers file? Do I need to edit the /etc/sudoers.d/cloud-init file?
I figured out the answer. In your sudoers file, you can put the following entry:
%my-users ALL=NOPASSWD: /bin/su - app-admin
Then you can use the following to login:
sudo su - app-admin
Note: Be sure to use
sudo visudo to edit anything sudo related or you could corrupt your sudo privileges.