0

Dear all,

I'm doing a script to create a DB user on all machines. I have no way of using sudo. This is for a cross section of sun machines.
i need to ssh to the server, then do a su to root, create the account and then exit. i have done the following:
#!/bin/ksh
## Script to create the mondba account ##
## Date 22Aug2007 ##
PATH=$PATH:/usr/local/bin:
export PATH
ssh -p 15560 user1@jupiter << EOW
su - root 2>&1
useradd -m -d /export/home/mondba -u 33332 mondba
passwd mondba
exit
EOW
exit

Now the problem, I will be prompted for the user1 password but not the root password which i'm supposed to get as a result of the su - i'm executing. Instead i get su: Sorry, looks like it gets timed out. Please give me a hint.
Thanks in advance!

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Fest3er
0

Try this:

Put your script in a file, addmondba.sh, e.g. As the last (or second last) line of the script, put in "rm -f /tmp/addmondba.sh" to make the script delete itself. Then:

scp -p 15560 addmondba.sh user1@jupiter:/tmp
ssh -t -p 15560 user1@jupiter su root -c "\"sh -x /tmp/addmondba\""

If this doesn't work directly, it should get you closer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.