Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Putty tools backup

hi, im trying to backup my ironport using the below putty (plink) script:
Rem ### Mail Configs for Each to me@mydomain.com
plink 192.168.1.1 -l admin -i private.ppk "mailconfig me@mydomain.com Y”

But getting the following message:
Unable to use key file "private.ppk" (unable to open file)

Can anyone advise what needs to be done exactly on the ironport cli?

6 REPLIES
Community Member

Re: Putty tools backup

well... can you logon using the provided user/key combination?

"unable to open file" seems more a Windows error than an Ironport error.

Steven

Community Member

Re: Putty tools backup

hi and thanks for reply.. ive never done this before, so im not quite sure what the provided key is .. how do i clarify this, or setup a new one.. and how would i test this.. should it also fit into the above syntax somewhere??
cheers.. :)

Community Member

Re: Putty tools backup

Hi Dave,

On http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html you can find a good description on how to generate your key for ssh authentication and how to use it.
For your purpose there are a few remarks:

1) Since you want the stuff to run unattended I suggest you do not assign a passphrase (may God curse me for this advice) :oops:

2) To connect the key to your Ironport user you should do a manual logon with that user or use an Administrator role user to log on to the command line of your MGA. Type the command "sshconfig" and switch to cluster mode if needed.
If you logon using another user than you are assigning the key for, use the "USER" option to switch to the correct user and after that, use "NEW" to assign the new key to your Ironport user. (Always use the public part of your key pair for storing on the remote system you want to logon to).
Commit your changes and startup a new putty session to test your new configuration. (Keep your current session active, which gives you the possibility to make modifications if something went wrong)

I hope this helps!

Best regards,
Steven

Community Member

Re: Putty tools backup

great, thanks for your time steve :)

Community Member

Re: Putty tools backup

Using expect with SSH keys can do this for you as well. This is what I use below.


#!/usr/bin/expect -f
set password [lrange $argv 0 0]
set ipaddr [lrange $argv 1 1]
set scriptname [lrange $argv 2 2]
set arg1 [lrange $argv 3 3]
#set timeout -1
spawn ssh -p 22 expect@$ipaddr $scriptname $arg1
match_max 100000
expect "*?assword:*"
send -- "$password\r"
# send blank line (\r)
#send -- "\r"
expect eof


Put the above into a expect script and run a daily or weekly cron

/usr/bin/expect /tmp/ironlogin.exp hostip mailconfig emailaddress

Community Member

Re: Putty tools backup

Using expect with SSH keys can do this for you as well. This is what I use below.


#!/usr/bin/expect -f
set password [lrange $argv 0 0]
set ipaddr [lrange $argv 1 1]
set scriptname [lrange $argv 2 2]
set arg1 [lrange $argv 3 3]
#set timeout -1
spawn ssh -p 22 expect@$ipaddr $scriptname $arg1
match_max 100000
expect "*?assword:*"
send -- "$password\r"
# send blank line (\r)
#send -- "\r"
expect eof


Put the above into a expect script and run a daily or weekly cron

/usr/bin/expect /tmp/ironlogin.exp hostip mailconfig emailaddress

514
Views
0
Helpful
6
Replies
CreatePlease to create content