Karim N Gorjux
Karim N Gorjux

Reputation: 3033

ssh pem file, password and fabric script

I have a fabric script that I use to do some works on several different AWS servers. Recently I moved all my development work on a Ubuntu 14 LTS server on virtualbox and every time I want to use my script ssh ask me the password. To avoid the problem I must run the following commands for every terminal opened

$ ssh-add PEM_FILE
$ ssh-agent /bin/bash

On macosx I never had to run the ssh-agent, but I just added the pem file with ssh-add.

What I'm missing?

Upvotes: 1

Views: 212

Answers (1)

Jakuje
Jakuje

Reputation: 25966

Add the script to your ~/.bashrc:

if [ "x$SSH_AUTH_SOCK" = "x" ]; then
    eval `ssh-agent`
    ssh-add PEM_FILE
fi

To make sure your shells have the agent running. Ubuntu desktops usually runs also agents. But the above method is probably the easiest.

Upvotes: 1

Related Questions