When running scripts from the windows environment, it is sometimes helpful to be able to automate commands on the Zimbra server. Plink is a utility that allows you to do this. This shows how to set up your windows server so it can execute the remote commands on the Zimbra Server.

Here is an example of running plink to execute commands on a remote zimbra server.

c:\> plink -l zimbra -m test-commands.txt

test-commands.txt contains

zmprov -l gaa

The results returned to the windows box are:

On the Windows Server:

Download Putty, PuTTYgen, Pageant, and plink from the putty download website to your windows server.

Launch PuTTYgen and click "Generate" to create a public/private key pair. Use the default SSH-2 RSA setting. Move your mouse in the designated area to create the randomness required to create the unique key.

Key Generation

When the key generation is completed, enter a Key Passphrase and confirm your entry.

Click “Save Private Key” and save your private key file.

Click “Save Public Key” and save your public key file.

Highlight the information in the top field (“Public key for pasting into OpenSSH authorized keys file:”) and Copy (CTRL-C).

Launch Putty

Enter the Hostname, and a label for a Saved Session.

Select the “Data” element under “Connection” and enter “zimbra” in the “Auto-login username” field.

PuTTy Data Setting

Expand the SSH category and select the Auth Category. Next to “Private Key File for Authentication”, click Browse and select the Private key file you saved earlier.

PuTTy Auth Setting

Select the Session item Category, and click Save to save your session settings.

Launch Pageant. A small icon will appear in the System Tray. Right mouse click on the icon and select “Add Key”.

Select the Private Key you previously generated and click Open. Enter your passphrase and click OK.

On the Zimbra Server:

Connect to your Zimbra Server and su – zimbra to get to the zimbra user.

Change directory to /opt/zimbra/.ssh

Use your favorite editor to add the key to the authorized_keys file. (With vi, click o for open, and right mouse click to paste the previously copied key).

Adding Keys to Zimbra

You should be able to launch Putty and connect to the Zimbra Server with your saved session and no password.

Jump to: navigation, search