Alfred Wächter
Alfred Wächter

Reputation: 55

How to write bash file for establishing a ssh connection

I tried to write a bash file for establishing a SSH tunnel from Pi 1 to Pi2. I found several guides and did it according to them - so far so good. Everything is working now if I type the following in the terminal:

ssh -i .ssh/key_rsa [email protected]

I tried the same line of code in a bash file, but there appears the following error message: „File or Dictionary not found“

My bash Code:

#!usr/bin/bash -f

xterm -title “Terminal1“ -hold -e ssh -i “.ssh/key_rsa“ “ [email protected]

What's the problem here?

Upvotes: 0

Views: 54

Answers (1)

wowbagger
wowbagger

Reputation: 630

Are you running it from inside you $HOME where .ssh/key_rsa is located?
Perhaps set it to use an absolute path like $HOME/.ssh/key_rsa

Upvotes: 1

Related Questions