Git Product home page Git Product logo

fish-ssh-agent's Introduction

fish-ssh-agent

Utility functions to start your ssh agent when using fish shell. You will only need to run ssh-add and type your password once, after the running ssh_agent should do the work for you.

Installation

Using fundle

Add

fundle plugin 'danhper/fish-ssh-agent'

to your config.fish, reload your shell and run fundle install.

Using Fisher

fisher install danhper/fish-ssh-agent

Manually

Copy functions and conf.d to your $__fish_config_dir directory. That's all.

fish-ssh-agent's People

Contributors

berenddeboer avatar danhper avatar edouard-lopez avatar ijohanne avatar ioistired avatar jorgebucaran avatar tokozedg avatar vejeta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fish-ssh-agent's Issues

Licence?

I could not find any licence information in the repository of this project.
Under which licence is it distributed?

I would like to create a package for the Linux distribution I'm using, but the lack of licence prevents this.

ssh-agent keys not persisted

This might be my fault, but my ssh-agent keys are only persisted per-shell (session) on my laptop. My desktop has the same config and the keys are persisted even between reboots, and I don't know how to fix this. I thought fish-ssh-agent was supposed to reuse agents for all the shells, but it seems to launch one agent per shell, even though .ssh/environment exists and points to the last agent spawned.

Install error

When installing, I got a large set of errors that all seemed to be repeats of:

Unsupported use of '='.

This is with Ubuntu on Windows 10.

Could not open a connection to auth agent

So I have a layout that looks like this:

$ tree .ssh/
.ssh/
|-- authorized_keys
|-- config
|-- environment
|-- id_rsa
|-- id_rsa.pub
|-- known_hosts
`-- my_user
    |-- id_rsa
    `-- id_rsa.pub

If I run:

$ ssh-add ~/.ssh/id_rsa
Identity added: /home/my_user/.ssh/id_rsa (/home/my_user/.ssh/id_rsa)

It works.

But If I try to add my other private key:

$ ssh-add ~/.ssh/my_user/id_rsa
Could not open a connection to your authentication agent.

Any ideas why it's not working? Probably related to ssh-agent and not fish right?

Here is some more info:

$ fish --version
fish, version 2.3.1

$ head -n2 ~/.config/fish/config.fish
if not functions -q fundle; eval (curl -sfL https://git.io/fundle-install); end
fundle plugin 'tuvistavie/fish-ssh-agent'

$ fundle install
tuvistavie/fish-ssh-agent installed in /home/my_user/.config/fish/fundle/tuvistavie/fish-ssh-agent

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.3.1611 (Core)
Release:        7.3.1611
Codename:       Core

grep error during install

Cloning into '/home/joe/.config/fish/fundle/tuvistavie/fish-ssh-agent'...
remote: Counting objects: 6, done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 6
Unpacking objects: 100% (6/6), done.
Checking connectivity... done.
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

I suspect the issue is here when $SSH_AGENT_PID is void.

(Re)starting multiple terminal windows race condition

I've noticed that when I restart my computer and have the terminal windows restored (I have multiple terminals in iTerm and some in VSCode), I start getting errors like:

fish: Unknown command: nv
~/.ssh/environment (line 4):
nv SSH_AGENT_PID 1013;
^
from sourcing file ~/.ssh/environment
	called on line 3 of file ~/.config/fish/functions/__ssh_agent_is_started.fish
in function '__ssh_agent_is_started'
	called on line 5 of file ~/.config/fish/conf.d/fish-ssh-agent.fish
from sourcing file ~/.config/fish/conf.d/fish-ssh-agent.fish
	called on line 246 of file /opt/homebrew/Cellar/fish/3.5.1/share/fish/config.fish
from sourcing file /opt/homebrew/Cellar/fish/3.5.1/share/fish/config.fish
	called during startup

My ~/.ssh/environment file looks like:

setenv SSH_AUTH_SOCK /tmp/ssh-xo1lUD2fkYK4/agent.1003;
setenv SSH_AGENT_PID 1017;
#echo Agent pid 1017;
nv SSH_AGENT_PID 1013;
#echo Agent pid 1013;

It seems then that multiple terminals are starting up the ssh agent at the same time and trying to write to the same lock file.
I can also confirm I do have two SSH agents running:

 1013   ??  Ss     0:00.01 ssh-agent -c
 1017   ??  Ss     0:00.00 ssh-agent -c

SSH_AGENT_PID not set

SSH_AGENT_PID is not set when I try to add an SSH key with ssh-add ~/.ssh/id_rsa.

$ ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
$ echo $SSH_AGENT_PID

$ # ↑ empty string ↑

Yet, ssh-agent is well started:

$ ps aux | grep ssh-agent
morgan   16643  0.0  0.2   3688   984 ?        Ss   11:43   0:00 ssh-agent -c

I did manage to add a key with the following commands:

$ eval (ssh-agent -c)
Agent pid 18541
$ echo $SSH_AGENT_PID
18541
$ ssh-add ~/.ssh/id_rsa
Identity added: /home/morgan/.ssh/id_rsa (rsa w/o comment)

My configuration:

$ fish --version
fish, version 2.2.0
$ ssh -V
OpenSSH_6.7p1 Raspbian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016

Not sure how ssh-agent works though... Any help would be much appreciated.

communication with agent failed

Hi,

I installed, reload the shell and try ssh-add but can't get communication to the ssh-agent.

Here is my config.fish

dhilst@dhilst-thinkpad ~> cat .config/fish/config.fish 
fundle plugin 'tuvistavie/fish-ssh-agent'
dhilst@dhilst-thinkpad ~> 

The error message:

dhilst@dhilst-thinkpad ~> ssh-add
Enter passphrase for /home/dhilst/.ssh/id_ed25519: 
Could not add identity "/home/dhilst/.ssh/id_ed25519": communication with agent failed
dhilst@dhilst-thinkpad ~> env | grep SSH
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

I see SSH_ENV at the plugin code. This environment doesn't exist for me.

Any idea!?

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.