Can someone suggest how can I change process privileges in Linux to root ?
Assume, I have a normal process running under some user-consider me. Now my script should create some users using 'useradd' command and I want to disable the user accounts after few hours. Let us take time frame of 5 hours. Every 5 hours it should enable the account and after 5 more hours it should disable the account.
Now the problem is from the script if I try to gain root access only via typing 'su' command it asks for prompt. Well, my intention here is to invoke this script from remote client (probably via web service either in .net or in Java).
So Is there a way I can change to root mode and create/enable/disable the accounts in Linux without giving any prompt (where it need to wait for someone's input)? Assume I have a root password.
I did try with pipe command as below:
echo "password" | su
But somehow it brings me on the prompt. If I am successful to run a script directly without prompt, I can proceed with doing same thing via web service.
Any help is really appreciated on this.