I want to execute two command on two servers via ssh from my local machine
ssh user@"$APP_HOST" "sh /home/agents/startAgent.sh --auto-shutdown > agent.log 2>&1 </dev/null & "
ssh user@"$DB_HOST" "sh /home/agents/startAgent.sh --auto-shutdown > agent.log 2>&1 </dev/null & "
with APP_HOST
it works fine and starts .sh.
script on remote just ok.
But my DB_HOST
asks for password when I try to run the same command. For now I don't have configured access without password (no rights to do).
But how to provide password inside the command itself without input?
Best Answer
If you have a different behaviour for the same ssh command, it's probably an SSH miscounfiguration.
Check you SSH config file, it there is no difference, check you ssh keys.
What does a simple
ssh user@"$DB_HOST"
do?