Ssh login shell_command


I try to login with a shell_command script on my proxmox host to make a backup.

Ssh without password work from the shell with ssh root@xxxxx . There I need no password.

Now I have this shell_script:

set timeout 20
ssh [email protected]
set timeout 20
vzdump 101 --compress zstd --storage pbs

But I get this error:

stdout: ""
stderr: "Pseudo-terminal will not be allocated because stdin is not a terminal.\r\nssh: Could not resolve hostname\r: Name does not resolve\r\n/config/script/ line 5: vzdump: command not found"
returncode: 127


First, it seems the ip address could not be reached from home-assistant.

Second, if I understand your code, you should add the commands in ssh :

ssh [email protected] "vzdump 101 --compress zstd --storage pbs" 


thank’s looks better now.

But get this error:

stdout: ""
stderr: Host key verification failed.
returncode: 255


ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no -o ServerAliveInterval=3 -i <path to the private key> ...

But be sure you have enabled key authentication first. That will not work with password authentication.

the command from @Ogrinou run, if I try it direct from the terminal&ssh addon.
Is the problem maybe, that the addon’s are container and the command send from HA direct?

You don’t have any security?
Then adding StrictHostKeyChecking=no to the command will bypass the Host key verification failed error.

Doesen’t work

stdout: ""
stderr: "Permission denied, please try again.\r\nPermission denied, please try again.\r\[email protected]: Permission denied (publickey,password)."
returncode: 255

Yeah, because a key or password is needed. See the “-i” in my answer above.
I guess the proper key is in ~/.ssh/id_rsa in the SSH addon.
Copy it to a /config/ssh/ directory and use ssh StrictHostKeyChecking=no -i /config/ssh/id_rsa ...

1 Like

I’m back with a short question.

Today I saw that the script doesen’t work any more.
If I try the script from the shell it work. But in the developer console I get this error:

stdout: ""
stderr: Host key verification failed.
returncode: 255

Is it possible, after the update to 2024.2