Ultimately, I want to shutdown a freebsd box from my android (there are lots of android apps to run scripts).
I do not want to be prompted for a password.
One step at a time, first I just want to shut down the remote from another freebsd box.
The following did not work:
I am prompted for a password twice.
Taking a step back, I tried to just ssh into the remote:
I get the error message:
> Pseudo-terminal will not be allocated because stdin is not a terminal.
I tried another script, which supposedly worked for bash
Get the following errors:
> ./t.sh: spawn: not found
> ./t.sh: expect: not found
> ./t.sh: send: not found
BTW: while developing a script, I often use one letter filenames. I change the names once I get the script to work.
I am out of ideas.
Maybe I should try another language? Like python or perl? I am not sure how that would work from an android.
Any thoughts appreciated. Thanks in advance.
I do not want to be prompted for a password.
One step at a time, first I just want to shut down the remote from another freebsd box.
The following did not work:
Code:
#!/bin/sh
ssh -t walter@192.168.1.2 "echo PASSWORD | sudo shutdown -p now"
I am prompted for a password twice.
Taking a step back, I tried to just ssh into the remote:
Code:
#!/bin/sh
echo PASSWORD | ssh walter@192.168.1.2
I get the error message:
> Pseudo-terminal will not be allocated because stdin is not a terminal.
I tried another script, which supposedly worked for bash
Code:
#!/bin/sh
spawn ssh walter@192.168.1.2
expect "password:"
sleep 1
send "PASSWORD:"
Get the following errors:
> ./t.sh: spawn: not found
> ./t.sh: expect: not found
> ./t.sh: send: not found
BTW: while developing a script, I often use one letter filenames. I change the names once I get the script to work.
I am out of ideas.
Maybe I should try another language? Like python or perl? I am not sure how that would work from an android.
Any thoughts appreciated. Thanks in advance.