Search This Blog

Permission denied when execute a script remotely using ssh

when execute a script remotely using ssh:
ssh user@server script.sh

It asks for password and failed with error:
user@server's password: 
Permission denied, please try again.
user@server's password: Permission denied (publickey,password).

solution

add -t option to ssh command:
ssh -t user@server script.sh

according to the man page of ssh:
    -t    Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

No comments:

Post a Comment