Run script as a different user from root
by B612 from LinuxQuestions.org on (#4XEKQ)
Hello
I have a script that erase files from different folders, and because of this I'd like to limit the risk in running this script from a limited user.
The problem is that script need to mount folders and for this I need to run it as root.
I've tried to call from the root's script a second script as different user, but it runs with root rights.
What is right way to deal with this ?
- one script for mounting as root, and another from different user for erasing ? (with 2 crontabs)
Thanks


I have a script that erase files from different folders, and because of this I'd like to limit the risk in running this script from a limited user.
The problem is that script need to mount folders and for this I need to run it as root.
I've tried to call from the root's script a second script as different user, but it runs with root rights.
What is right way to deal with this ?
- one script for mounting as root, and another from different user for erasing ? (with 2 crontabs)
Thanks