LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2010, 09:15 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
SSH RSA passphrase in script ?


Hello,

when generating RSA public/private key pair, I gave a passphrase to protect the key.

When I now want to use this private key in a script to log on to the remote server via ssh and do something, how can I give the passphrase ??

Alternatively, is it possible to use a different private key without passphrase ? I doubt it, but it doesn't harm to ask.
 
Old 11-08-2010, 10:28 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
What's the task at hand, is it going to be running as cron-job
for a system user?

You could use "expect" to script the pass-phrase, but that's
always a bad idea.

You could generate a new account and have it use a passwordless
key to connect to the same user (you can't -trivially- have
two key-pairs for one user).

You could use ssh-agent & ssh-add for the account in question,
which means you'd have to manually enter the passphrase when the
machine gets rebooted.


Cheers,
Tink

Last edited by Tinkster; 11-08-2010 at 10:30 AM.
 
Old 11-08-2010, 10:34 AM   #3
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by jonaskellens View Post
Hello,

Alternatively, is it possible to use a different private key without passphrase ? I doubt it, but it doesn't harm to ask.
yes, you can use the -i parameter to specify a different identity file
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ssh-keygen -t rsa -b 2048 without a passphrase sycamorex Linux - Security 7 06-10-2010 04:42 PM
SSH no-password authentication: RSA Passphrase Nokao Linux - Server 8 12-28-2009 10:17 AM
passphrase authentication fails using rsa with OpenSSH 5.1p1 (Slackware 12.2) sysfce2 Linux - Newbie 16 11-01-2009 08:21 PM
SSH without a password or passphrase Chocolate Linux - Networking 4 03-04-2007 02:59 AM
ssh / ssh-key -- its always asking for passphrase BaerRS Linux - General 1 01-07-2003 06:21 PM


All times are GMT -5. The time now is 04:19 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration