Run Linux command as predefined user
Posted
by vijay.shad
on Stack Overflow
See other posts from Stack Overflow
or by vijay.shad
Published on 2010-03-30T11:29:04Z
Indexed on
2010/03/30
11:33 UTC
Read the original article
Hit count: 411
shell-scripting
|linux
Hi all,
I have created a shell script to start a server
program.
startup.sh start
When above command will executes, it will try starts the server
as adminuser
. To achieve this my script has written like this.
SUBIT="su - adminuser -c "
SERVER_BOX_COMMAND_A="Server"
##############
# Function to start cluster
function start(){
$SUBIT "$SERVER_BOX_COMMAND_A"
}
When i execute the command it asks for password. Is there any other way to do this so, it will not ask for password.
© Stack Overflow or respective owner