{"id":1998,"date":"2010-06-03T10:36:31","date_gmt":"2010-06-03T14:36:31","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/?p=1998"},"modified":"2010-06-03T10:36:31","modified_gmt":"2010-06-03T14:36:31","slug":"startkeychain-bash-utility-to-start-ssh-agent","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/startkeychain-bash-utility-to-start-ssh-agent\/","title":{"rendered":"startKeychain &#8211; bash utility to start ssh-agent"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2010\/06\/ssh-agent.jpg?w=640\" class=\"alignleft\"\/>For my (and your) future reference, here&#8217;s a function to put on your .bashrc or .bash_profile, you can invoke it later at any time to start\/re-start your ssh-agent.<br \/>\n<br clear=\"all\"\/><br \/>\n[bash]<br \/>\nfunction startKeychain {<br \/>\n    killall ssh-agent<br \/>\n    rm ~\/.keychain\/*<br \/>\n    keychain id_rsa<br \/>\n    HOSTNAME=`hostname`<br \/>\n    source ~\/.keychain\/${HOSTNAME}-sh<br \/>\n}<br \/>\n[\/bash]<\/p>\n<p>Then at any time, the &#8220;command&#8221; <strong>startKeychain<\/strong> will be available on your command line.<\/p>\n<p>Output should look something like this:<br \/>\n[bash]<\/p>\n<p>gubatron@gubatron-desktop:~$ startKeychain <\/p>\n<p>KeyChain 2.6.8; http:\/\/www.gentoo.org\/proj\/en\/keychain\/<br \/>\nCopyright 2002-2004 Gentoo Foundation; Distributed under the GPL<\/p>\n<p> * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-sh file&#8230;<br \/>\n * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-csh file&#8230;<br \/>\n * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-fish file&#8230;<br \/>\n * Starting ssh-agent<br \/>\n * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-sh-gpg file&#8230;<br \/>\n * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-csh-gpg file&#8230;<br \/>\n * Initializing \/home\/gubatron\/.keychain\/gubatron-desktop-fish-gpg file&#8230;<br \/>\n * Starting gpg-agent<br \/>\n * Adding 1 ssh key(s)&#8230;<br \/>\nIdentity added: \/home\/gubatron\/.ssh\/id_rsa (\/home\/gubatron\/.ssh\/id_rsa)<\/p>\n<p>[\/bash]<\/p>\n<p>Comments are welcome to improve it, I&#8217;m not an ssh-agent expert, but this seems to do the work.<\/p>\n<p>[SOLVED] Issue with KDE 4.4.2 and Dolphin always asking my ssh passwords whenever I browsed folder I checked out from a remote subversion repository.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For my (and your) future reference, here&#8217;s a function to put on your .bashrc or .bash_profile, you can invoke it later at any time to start\/re-start your ssh-agent. [bash] function startKeychain { killall ssh-agent rm ~\/.keychain\/* keychain id_rsa HOSTNAME=`hostname` source ~\/.keychain\/${HOSTNAME}-sh } [\/bash] Then at any time, the &#8220;command&#8221; startKeychain will be available on your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15,43],"tags":[166,284,601,1449,831,929,930,1000],"class_list":["post-1998","post","type-post","status-publish","format-standard","hentry","category-code","category-linux","tag-automation","tag-commands","tag-keys","tag-linux","tag-reference","tag-ssh","tag-ssh-agent","tag-tips"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-we","jetpack-related-posts":[{"id":593,"url":"https:\/\/www.gubatron.com\/blog\/ssh-add-l-cannot-connect-to-your-agent\/","url_meta":{"origin":1998,"position":0},"title":"ssh-add -l -> Cannot connect to your agent.","author":"gubatron","date":"September 21, 2007","format":false,"excerpt":"keychain not working for ya... you run ssh-agent but ssh-add won't add the keys. This is probably because your SSH_AGENT_PID and SSH_AUTH_SOCK variables are incorrect... so I recommend you put something like this on your .bashrc to initialize your ssh-agent correctly: export SSH_AGENT_PID= export SSH_AUTH_SOCK= #make sure no old agents\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2722,"url":"https:\/\/www.gubatron.com\/blog\/add-ssh-identities-to-your-ssh-agent-when-you-start-your-bash-session\/","url_meta":{"origin":1998,"position":1},"title":"add ssh identities to your ssh agent when you start your bash session","author":"gubatron","date":"April 28, 2012","format":false,"excerpt":"Put this somewhere on your .bash_profile [bash] function addSSHIdentities() { pushd ~\/.ssh #add all your keys here ssh-add some_private_key ssh-add some_private_key_2 ssh-add some_private_key_3 ... ssh-add some_private_key_N popd } function startSSHAgent() { SSH_AGENT_PROCESSES=`ps aux | grep ssh-agent | grep -v grep | wc -l` if [ $SSH_AGENT_PROCESSES -gt 0 ] then\u2026","rel":"","context":"In \"posix\"","block_context":{"text":"posix","link":"https:\/\/www.gubatron.com\/blog\/tag\/posix\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4122,"url":"https:\/\/www.gubatron.com\/blog\/screw-configuring-gpg-to-sign-git-commits-do-it-with-your-same-ssh-key-like-this\/","url_meta":{"origin":1998,"position":2},"title":"Screw configuring GPG to sign git commits, do it with your same SSH key like this","author":"gubatron","date":"January 30, 2025","format":false,"excerpt":"GPG gives a lot of shit on macos for some reason. It's best to just add the same SSH authentication key you have on github as a \"Signing Key\" in your github account signing configuration. Go to Settings > SSH and GPG Keys You can then configure your github client\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2025\/01\/ssh_sign.jpg?fit=736%2C441&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2025\/01\/ssh_sign.jpg?fit=736%2C441&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2025\/01\/ssh_sign.jpg?fit=736%2C441&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2025\/01\/ssh_sign.jpg?fit=736%2C441&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3150,"url":"https:\/\/www.gubatron.com\/blog\/how-to-add-an-existing-git-repository-to-github\/","url_meta":{"origin":1998,"position":3},"title":"How to add an existing GIT repository to github.","author":"gubatron","date":"August 31, 2013","format":false,"excerpt":"Most of the times, it makes more sense to start working on something that slowly transforms into the beginning of a project that deserves to be on github. This post is about creating a local repository and putting it on github. 1. First we must convert the main local folder\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":481,"url":"https:\/\/www.gubatron.com\/blog\/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified\/","url_meta":{"origin":1998,"position":4},"title":"svn: Can&#8217;t create tunnel: The system cannot find the file specified.","author":"gubatron","date":"March 15, 2007","format":false,"excerpt":"I was trying to checkout a project from a subversion repository using Eclipse's Subversive, and I was having problems with a subversion url that starts with \"svn+ssh:\/\/\" This means all the transport has to be done using a \"ssh\" agent. Eclipse's Subclipse plugin was giving me the error: svn: Can't\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1457,"url":"https:\/\/www.gubatron.com\/blog\/map-commands-to-servers-via-ssh\/","url_meta":{"origin":1998,"position":5},"title":"Quick N Dirty way to Map Commands to remote servers via ssh","author":"gubatron","date":"October 10, 2009","format":false,"excerpt":"You may be running several independent but similar servers at the same time and wasting time by executing commands in all of them one by one. Wouldn't it be nice to send a command to all of them at once? or to monitor all of them at once. The following\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/1998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=1998"}],"version-history":[{"count":0,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/1998\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}