- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Automating ssh-agent/ssh-add
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 03:15 AM
11-04-2004 03:15 AM
Automating ssh-agent/ssh-add
I'm attempting to setup automatic ssh agency using the good old snail book. At present, I have the user runing ksh. The .profile runs
#ssh-agent $SHELL $HOME/.profile2.
$HOME/.profile2 contains a .shrc call and the .shrc performs the ssh-add.
When I log in, I'm prompted to enter my passphrase (ssh-add) but when I do the entire shell seems to close and I'm back to the original login shell. Can anyone point me in the right direction?
Thanks,
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 03:19 AM
11-04-2004 03:19 AM
Re: Automating ssh-agent/ssh-add
If so, read the doc I'm attaching. If not, I don't understand the goal and you may wish to clarify.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 03:24 AM
11-04-2004 03:24 AM
Re: Automating ssh-agent/ssh-add
Thanks. I have already configured the host based authentication but am now experimenting with enforcing a passphrase for the key generation. To take the anoyance of typing it in for each ssh operation I want to start an ssh-agent and add an identity as soon as a user logs in (Chap 6 in the O'Reily book).
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 12:04 PM
11-04-2004 12:04 PM
Re: Automating ssh-agent/ssh-add
eval `ssh-agent`
ssh-add
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 12:32 PM
11-04-2004 12:32 PM
Re: Automating ssh-agent/ssh-add
A little trick. Create a script say 'mysshadd' with the following:
ssh-agent > /home/user/.ssh/ssh-agent.conf
chmod 600 /home/user/.ssh/ssh-agent.conf
. /home/user/.ssh/ssh-agent.conf
ssh-add /home/user/.ssh/id_dsa
echo "Run . /home/user/.ssh/ssh-agent.conf now"
First time, run this script and it will prompt for the passphrase. Once it is done it will be copied into memory. Put the following line in your .profile
. /home/user/.ssh/ssh-agent.conf
Subsequent windows you open will use the ssh-agent started in the first session.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 08:07 PM
11-04-2004 08:07 PM
Re: Automating ssh-agent/ssh-add
I have already got this working fine with the single-shell method but I specificall want to use the sub-shell method as discussed in the book.
Cheers,
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2004 02:35 AM
11-05-2004 02:35 AM
Re: Automating ssh-agent/ssh-add
That's not for single shell. You run 'mysshadd' only in the first shell and startup ssh-agent. For rest of the sessions, you simply 'source in' ssh-agent.conf. It won't ask you for password because you don't really run 'ssh-add' later. Try it and see if it is not what you wanted.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2004 10:22 AM
11-07-2004 10:22 AM
Re: Automating ssh-agent/ssh-add
Put the following at the end of your $HOME/.profile.
ENV=$HOME/.shrc; export ENV
exec ssh-agent $SHELL
And in your $HOME/.shrc have
ssh-add
On exit from the shell ssh-agent will be terminated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2004 05:54 AM
11-15-2004 05:54 AM
Re: Automating ssh-agent/ssh-add
If you need to use passphrases (or want to), check out "keychain". "keychain" makes the ssh-agent/passphrase stuff pretty convenient.
http://www-106.ibm.com/developerworks/library/l-keyc.html
Then, when you add the following to your ".profile", you'll be asked to enter your passphrase. You won't need to enter your passphase untill the machine is rebooted. (Note: $USERLOCAL should be replaced with whatever directory the keychain stuff located.)
$USERLOCAL/keychain-2.4.2.1/keychain id_rsa
host=`uname -n`
[ -f $HOME/.keychain/$host-sh ] && \
. $HOME/.keychain/$host-sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2004 08:21 AM
11-15-2004 08:21 AM
Re: Automating ssh-agent/ssh-add
I think the reason that your ssh-agent dies is because ssh-agent needs to be run as "eval ssh-agent..." and not just executed.
# Make sure ssh-agent1 and ssh-agent2 die on logout
trap '
test -n "$SSH_AGENT_PID" && eval `/usr/local/bin/ssh-agent -k` ;
test -n "$SSH2_AGENT_PID" && kill $SSH2_AGENT_PID
' 0
# If no agent is running and we have a terminal, run ssh-agent and ssh-add.
# (For SSH2, change this to use SSH2_AUTH_SOCK, ssh-agent2 and ssh-add2.)
if [ "$SSH_AUTH_SOCK" = "" ]
then
eval `/usr/local/bin/ssh-agent`
/usr/bin/tty > /dev/null && /usr/local/bin/ssh-add
fi