0

I am trying to create an Alfred workflow that connects to my server through ssh without asking for my password. I tried

ssh root@myServerIP ; mypswd 

and many other variants, but i can't seem to be able to wait for terminal to ask me my password before the script answer it. Is it possible, in this case and in general to pre-enter the password on a terminal command ?

Thanx a lot in advance Jad

Zick
  • 39
  • 5
  • I think this is a duplicate of https://stackoverflow.com/questions/16937104/provide-password-to-ssh-command-inside-bash-script-without-the-usage-of-public – Neil Smithline May 18 '15 at 21:25

2 Answers2

1

There is no need of ; at the end. You can just hit enter at the end of the line and it will take it as an input for next command. for your case, it would look something like this.

ssh root@myServerIP
mypswd
Prike
  • 57
  • 10
0

If it's possible, I'd try to make it so that your workflow doesn't involve using SSH as root. Storing your password in a script seems like a security risk.

What I would suggest is using public/private key pairs (tutorial here and other places) to enable passwordless login from your client to the server, and sidestep the issue entirely. It's technically possible to do this with the root account as well, but again, I wouldn't recommend it.

Mark Kelly
  • 31
  • 1
  • 5