Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ssh-agent]

ssh-agent is a single sign-on mechanism for SSH that is included in the OpenSSH software. Use this tag for questions on how to configure and use ssh-agent.

240
votes
15answers
299k views

How can I run ssh-add automatically, without a password prompt?

I want to communicate between several computers on my network (static Ethernet), through SSH. In order to do that I need to run ssh-add every time I log in on a specific machine, how can I do it so ...
178
votes
1answer
171k views

How to list keys added to ssh-agent with ssh-add?

How and where can I check what keys have been added with ssh-add to my ssh-agent ?
151
votes
8answers
257k views

ssh-add complains: Could not open a connection to your authentication agent

I've been trying to get ssh-add working on a RaspberryPi running Raspbian. I can start ssh-agent, when I do it gives the following output into the terminal: SSH_AUTH_SOCK=/tmp/ssh-06TcpPflMg58/...
147
votes
3answers
86k views

ssh-add is not persistent between reboots

I added a ssh key to the agent by: $ ssh-add ~/.ssh/id_rsa_mac Identity added: /Users/alex/.ssh/id_rsa_mac (/Users/alex/.ssh/id_rsa_mac) After a reboot the agent doesn't have this key added anymore: ...
58
votes
2answers
231k views

How to enable diffie-hellman-group1-sha1 key exchange on Debian 8.0?

I am unable to ssh to a server that asks for a diffie-hellman-group1-sha1 key exchange method: ssh 123.123.123.123 Unable to negotiate with 123.123.123.123 port 22: no matching key exchange method ...
56
votes
1answer
15k views

Why eval the output of ssh-agent?

In order to run ssh-agent I have to use eval $(ssh-agent) Why do I have to eval the output of ssh-agent? Why isn't it designed so that I can just run it? Note: Backticks (`) removed as they are ...
23
votes
3answers
13k views

How do I get ssh-agent to work in all terminals?

I have set up automatic (password less) ssh login to some servers using ssh-copy-id. ssh-agent works only from the terminal where it was run. How do I get ssh-add to work in all my terminals? ...
20
votes
1answer
15k views

How to use ssh-agent with multiple (valid) keys and yet choose which one to use?

Let's say there are two keys A and B, both of which are valid for user@host public key authentication. Since authorized_keys is configured for different behaviour depending on the key, ~/.ssh/config ...
17
votes
4answers
16k views

How can I solve this ssh-agent problem?

I'm using Linux Mint, and have not been able to get gnome-keyring to unlock automatically at login, it seems. A symptom of my problem is as follows: $ ssh-add Identity added: /home/me/.ssh/id_rsa (/...
15
votes
4answers
3k views

Have ssh-add be quiet if key already there

I want to put ssh-add /path/to/special_key at the top of a script. This works fine, but it always prompts for the passphrase. This is strange, and a little annoying, as it still asks for the ...
14
votes
3answers
4k views

How to get asked for SSH key passphrase once and only when needed?

(I have read many of the questions on this site that look related and I believe this is a genuinely new question.) I have lots of keys on lots of servers and they're all protected with passphrases. ...
12
votes
3answers
11k views

ssh-add returns with: “Error connecting to agent: No such file or directory”

ssh-add alone is not working: Error connecting to agent: No such file or directory How should I use that tool?
12
votes
2answers
5k views

How to start and use ssh-agent as systemd service?

How to start ssh-agent as systemd service? There are some suggestions in the net, but they are not complete. How to add automatically unencrypted keys if ssh-agent service was started successfully? ...
10
votes
3answers
10k views

Configuring the default timeout for the SSH agent

I use ssh-add to add my SSH keys to the SSH agent. By default, it adds them indefinitely. There's a command-line option to specify a timeout, but is there a configuration file option which will ...
10
votes
2answers
6k views

gpg-agent refuses SSH keys with ssh-add reporting “agent refused operation”

I'm using openssh7.5p1 and gnupg 2.1.21 on arch linux (these are the default versions that come with arch). I would like to use gpg-agent as an ssh agent. I put the following in my ~/.gnupg/gpg-...
10
votes
2answers
1k views

ssh-agent: don't forward authentication for the whole keyring

I have two private ssh keys : one to access my personnal machines, one to access servers at my job. I add those two keys to my ssh-agent with ssh-add. Now, when I do ssh -A root@jobsrv I would ...
10
votes
4answers
15k views

ssh-agent not getting set up (SSH_AUTH_SOCK, SSH_AGENT_PID env vars not set)

I set up a new user account for a friend on Kubuntu 12.04. When he uses ssh he gets this error: Could not open a connection to your authentication agent We're running ssh in some bash scripts. ...
9
votes
4answers
4k views

Where does gnome-keyring set $SSH_AUTH_SOCK?

I am in the process of getting rid of gnome-keyring as an SSH agent. Things that I have done Searched the internet for hours. Changed stuff and restarted, often. Finally just rm-ed all the autostart ...
9
votes
1answer
461 views

Is there a technical reason why ssh-agent lacks a sudo-like inactivity/idle timeout feature?

There are some brief discussions about the existing ssh-agent -t feature at [1], and there was a post as far back as 2001 on debian-devel [2] wishing for an inactivity timeout feature. There's a ...
9
votes
1answer
998 views

Who is starting my ssh-agent, and why won't it properly terminate?

This is a problem I've been having for a long time, but every time I try to figure something out I get lost, so I figured I'd better ask here where maybe someone more experienced could help me. ...
8
votes
5answers
13k views

Is there a way to check a users SSH key to see if the passphrase is blank [duplicate]

I'm looking to lock down our Solaris 10, RHEL 5, and SLES 11.2 servers. It has come to my attention that some of the users have no passphrase for their SSH keys. Is there a way I can check for this ...
8
votes
2answers
2k views

Force SSH to ask my private key passphrase in the shell (not in a window)

When I use SSH for the first time after booting, it asks me for my private key unlocking passphrase (which is the behaviour I expect). But it does so in a window, not in the shell (similar to gksudo ...
8
votes
1answer
3k views

How can I silence ssh-agent?

I have a script like this one at my .bashrc file at the mysuer home: eval `ssh-agent` ssh-add /path/to/my/key The problem is I have this output when I log with the user mysuer (su - myuser): Agent ...
8
votes
1answer
2k views

Save SSH key passphrase using keychain with --noask option

I want to use keychain to manage passphrase prompt for SSH keys, but it should 1) ask it only when I'm actually using key and 2) save it for some period of time after that. Currently I've 2 options: $...
8
votes
1answer
866 views

Detecting the remaining lifetime of an ssh-agent identity

The ssh-add command lets you specify the lifetime of an identity being added to ssh-agent. For example, if I type ssh-add -t 1h the identify will expire after 1 hour. I can then list the identities ...
7
votes
4answers
4k views

Must I store a private key in a file?

I have a db-driven application that needs to communicate with another server via ssh. The web app can generate a keypair and give the user the pubkey, or it can accept the unencrypted private key in a ...
7
votes
1answer
3k views

How would I detect a non-login shell? (In Zsh)

I want to create a script that runs when a Zsh instance starts, but only if the instance is: Non-login. Interactive I think I'm right to say .zshrc runs for all interactive shell instances, ....
7
votes
1answer
5k views

SSH agent forwarding, multiple hop

I tested this setup with Linux origin machine - everything is the same - only the first hop can use keys from origin machine. Initial problem I'm trying to set up SSH agent forwarding with multiple ...
6
votes
3answers
5k views

ssh-add add all private keys in .ssh directory

In my day-to-day, I need to ssh to various machines, all of which I have a different private key for. When I start a new shell session - only my default id_rsa is added to the ssh key chain - I have ...
6
votes
5answers
2k views

Avoid separately adding ssh keys (with password) to shell sessions

Note: Adding a few lines to the .<name of shell>rc will not solve the problem here, since this particular ssh key has a password and that would not eliminate the need to keep typing it. So I ...
6
votes
2answers
19k views

How to save an SSH key passphrase in gnome-keyring?

I want to save an SSH key passphrase in gnome-keyring and then use it automatically when I need it. How to do this?
6
votes
4answers
3k views

Windows subsystem for linux - share ssh-agent?

I am running Ubuntu 16.04 within a Windows Subsystem for Linux (WSL) shell on Windows 10. From within a terminal I can start ssh-agent and use it many times over the life of that terminal. I can see ...
6
votes
2answers
1k views

SSH password requested when in Tmux

When I connect to my remote machine I do authenticate using a rsa key (I think is rsa, don't remember). If I do ssh from a regular shell I get logged on the machine without a password. However if I ...
6
votes
1answer
3k views

How do I stop ssh-agent trying all keys with agent forwarding?

Often I'll connect via SSH to VM instances to deploy code from private Bitbucket repositories, cloning repositories via git over SSH. Today I was getting the error: conq: repository access denied. ...
5
votes
2answers
1k views

Why ssh-agent group ownership is not root

Trying to understand why ssh-agent has sgid bit and found this post ssh-agent has sgid I have another question, why the group ownership of ssh-agent is nobody not root? What is the reason behind it? ...
5
votes
3answers
4k views

Remote shell script Enter passphrase for

How can I run a script to log into a remote server and execute a remote ssh command without entering in my passphrase? For example: When I log onto a remote server and execute the git pull command I ...
5
votes
2answers
5k views

How is ssh-agent being autostarted?

I am currently running Crunchbang Linux with Openbox, and as soon as I log in I have an ssh-agent process running and I can't for the life of me figure why it is being autostarted. Here is the ssh-...
5
votes
1answer
3k views

Can I set how long ssh-agent keeps keys in memory?

I'd like to have my keyfiles leave memory after a certain amount of disuse. Is there a way to make ssh-agent expire keys faster? It feels like it keeps them in memory and not needing a passphrase for ...
5
votes
2answers
1k views

Deleted my ssh keys

I'm on a Mac (OSX). I've accidentally deleted my ssh keys, but I haven't restarted my computer yet so I'm still able to access servers with my key. I guess the ssh-agent has some form of it in memory?...
5
votes
1answer
2k views

Ssh keeps asking for passphrase several times [duplicate]

I have a remote machine, with which I have set up public-key ssh auth - that is, I can ssh to it without typing in password each time. And I have a set of actions in a script, which use that ssh ...
5
votes
2answers
287 views

Why would pgrep not show my processes but sudo pgrep does?

I looked at a list of processes and filtered out ssh-agent which correctly shows the 3 processes I expected: $ ps -ef | grep ssh-agent belmin 1051 1 0 16:05 ? 00:00:00 ssh-agent -a /...
5
votes
2answers
355 views

share ssh session/key with remote user

Assume the following setup: User bob is working locally on his workstation foo. User alice is working locally on her workstation bar. User bob has ssh access to server baz:22 via a key stored at bob@...
5
votes
2answers
8k views

“ssh-add -d” refused to remove identity

In order to forget private keys passphrase (id_rsa) i usually run: ssh-add -D # to forget all loaded identities ssh-add -d # to forget primary identity ($HOME/.ssh/id_rsa) Now with macOS Sierra v10....
5
votes
2answers
764 views

`ssh-agent` asks passphrase after it has been added

I'm new to the ssh-agent and encounter what I identify as a "bug". Situation I have a passphrase-protected private key. I want to use the ssh-agent so I do not write the passphrase each time I ssh. ...
4
votes
1answer
15k views

“Permanently added the RSA host key” what does it mean?

I'm very new to Unix and things around it, particularly for this question is SSH and authentication. I know that I can create identities (create a pair of public/private key), put it into ssh-agent ...
4
votes
1answer
217 views

How are loaded SSH keys referenced by name?

I'm using chef's knife ec2 tool which requires the name of a loaded SSH key (that was created in the Amazon EC2 control panel) It seems strange to me that it uses a name to reference the keypair - ...
4
votes
2answers
892 views

Does Gnome Keyring support new-format OpenSSH private keys?

Does gnome-keyring support SSH private keys that are saved in the newer OpenSSH file format? Will Gnome Keyring automatically import those private keys? In more detail: When generating a SSH private ...
4
votes
1answer
843 views

Why do I need to insert the passphrase for an RSA key on a remote host after SSH?

From host B I can SSH various other hosts (C, D) without using any password as I put the public key in the correspondent authorized_keys files (in hosts C and D). From host A I can SSH host B (via ...
4
votes
0answers
1k views

Could not add card - Agent refused operation

I am on Ubuntu 16.04 and trying to add the certs on my CAC card using the ssh-add commands with no luck. ssh-add -s /usr/local/lib/opensc-pkcs11.so Enter passphrase for PKCS#11: Could not add card "/...
4
votes
1answer
783 views

Why is my SSH authentication socket different from the man pages?

These two entries of man ssh-agent describe the SSH authentication socket: $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid> UNIX-domain sockets used to contain the connection to the authentication agent....