bash shell script "sudo -
Hi there I got a question about the bash shell script and sudo.
Normally I would google for help, but then I dont know what am i supposed to search for. e.g. i am under root user Code:
sudo -u oracle sqlplus user/pass <createuser.sql my understanding is the sudo -u user let us execute a command on a specific user. For my above scenario, is there a way to modify my bash file so that upon the oracle user finishing its "sqlplus user/pass <createuser.sql" statement, my bash file will continue to execute? Thanks! |
I'm assuming you aren't using some type of Ubuntu...
If you are running a shell script as the root user you will not need to put "sudo" in the script. Ubuntu disables the root account by default, restricting major changes to the local user's password. The command "su" will prompt for the root password, and will allow you to do *most things. The command "su -" will actually switch you to the root account. And, assuming you have more than one user account, the command "su - whateverusername" will "log you in" (in the given shell) as that user. |
Hey there,
Also make sure that (even though it's not necessary in certain circumstances) you make the sudo rule NOPASSWD: so that if, say, the oracle user has it in their .profile, it won't hang waiting on an interactive password entry! Best wishes, Mike |
All times are GMT -5. The time now is 07:07 AM. |