shell - how to check a ssh key is copied to remote server by script -


i want use script below check if ssh key in host copied remote server:

#!/usr/bin/sh ssh -q -o stricthostkeychecking=no user@server "ls >/dev/null </dev/null" if [ $? -eq 0 ] ;then   echo "key copied remote server" else   echo "key not copied remote server" fi 

but pending on password input in case,

user@server's password:  

if there way terminate session , return error immediately?

add -o pubkeyauthentication=yes , -o passwordauthentication=no ssh command in script


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -