LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-20-2011, 02:06 AM   #1
amitk.gupta09
Member
 
Registered: Aug 2011
Location: pune
Posts: 37

Rep: Reputation: Disabled
ssh agent related query


i do not want to give our passphrase for a remote login on server machine.for that i start used ssh agent feature.
i just wrote this command on my local machine
$ssh-add
and i got this error message ------------
Could not open a connection to your authentication agent

i also tried with this command-------
ssh-add ~/.ssh/id_dsa

but i got same error message-----------
Could not open a connection to your authentication agent

and ssh-agent program is running on mine local machine because when i execute this command-------
ps aux|grep ssh-agent

and i got this output-----
amitg 1229 0.0 0.0 3368 192 ? Ss 09:56 0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu
amitg 2107 0.0 0.0 4160 868 pts/3 S+ 10:24 0:00 grep --color=auto ssh-agent


help me......
 
Old 09-20-2011, 04:57 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by amitk.gupta09 View Post
Could not open a connection to your authentication agent
If 'env|grep SSH_AGENT_PID' doesn't return anything then you need to export the PID ssh-agent runs as. For example try running 'export SSH_AGENT_PID=$(pgrep ssh-agent) && ssh-add -l || ssh-add;' in your shell.

Quote:
Originally Posted by amitk.gupta09 View Post
ps aux|grep ssh-agent
BTW: easier / efficient would be to run 'pgrep ssh-agent' (or 'ps --no-headers -o pid -C ssh-agent').
 
Old 09-20-2011, 06:53 AM   #3
amitk.gupta09
Member
 
Registered: Aug 2011
Location: pune
Posts: 37

Original Poster
Rep: Reputation: Disabled
still the same error is coming....
 
Old 09-20-2011, 07:01 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
What does '/usr/bin/ssh-agent; env|grep SSH' return?
 
Old 09-20-2011, 08:03 AM   #5
amitk.gupta09
Member
 
Registered: Aug 2011
Location: pune
Posts: 37

Original Poster
Rep: Reputation: Disabled
After executing this command---------
/usr/bin/ssh-agent; env|grep SSH

I got this message-------------

SSH_AUTH_SOCK=/tmp/ssh-tWWZUcKy2213/agent.2213; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2214; export SSH_AGENT_PID;
echo Agent pid 2214;

and when i execute ssh-add after above command i got following message

Could not open a connection to your authentication agent.
 
Old 09-20-2011, 09:05 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Because your session is started as '/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu' all its child processes should see the SSH_AGENT_PID and SSH_AUTH_SOCK variables automagically. Your reply means these did not get exported. Did you make any permission changes to the system? Anyway, running 'eval echo `/usr/bin/ssh-agent -s`; ssh-add' should update your current shell sessions variables and add your key(s).
 
Old 09-21-2011, 05:30 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by unSpawn View Post
Code:
eval echo `/usr/bin/ssh-agent -s`; ssh-add
It should work without the echo command too.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xterm related query mr.blacklisted Linux - Server 1 11-17-2010 09:36 AM
Query related to ssh private-public key authentication saagar Linux - Newbie 3 03-23-2010 10:59 AM
[SOLVED] ssh-agent -> The agent has no identities. windstory Linux - Security 2 11-19-2008 06:45 PM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
ssh-agent/ssh-add question mega Slackware 2 01-26-2005 03:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration