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
Post a Comment