If you want to execute a command under a different login, you can use sudo to do so. For instance, if you have the following line in your /etc/sudoers:
Code:
myuser ALL=(user) ls /secret NOPASSWD: /usr/bin/make install
then, you can execute the following lines:
Code:
$ sudo -u user ls /secret
Password: .......
# Contents of /secret shown
$ sudo -u user make install
# Make install runs
$ echo password | sudo -S -u user ls /secret
# Contents of /secret shown without password prompt
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.