分类: 系统运维
2012-11-27 13:24:39
1. Automatically SSH login to Solaris 11.1 from a Windows Client1. Generate public and private key for automatic login on the client.2. Import Public key to the server.3. Enable Public key authentication for SSH on the server.
Preparation:
Please download Putty, PuTTYgen and Pageant from Here:
Generate public and private key for automatic login on the client:
Lanuch the PuTTYgen application :
Default key generation parameters are fine to use. Generally SSH-2 RSA keys at 1024 or 2048 bit encryption is recommended.
Click 'Generate'. You will then need to move the cursor around a bit to generate randomness:
Save your private key. Before you click “Save private key”, I recommended you select a passphrase for better security. Otherwise, other people with access to your private key can use it freely:Copy and save the public key as "authorized_keys" manually. ( The public key saved by clicking "Save public key" used a different style which will cause server to refuse your private key)Import Public key to the server:Login in to your Solaris 11.1 server either locally or remotely through SSH and copy "authorized_keys" to your ".ssh" folder :
Make sure sshd service is online:点击(此处)折叠或打开
- mkdir ~/.ssh
- cp authorized_keys ~/.ssh/
- chmod 700 ~/.ssh
- dhmod 600 ~/.ssh/authorized_keys
If not online:点击(此处)折叠或打开
- svcs ssh
- STATE STIME FMRI
- online 15:49:10 svc:/network/ssh:default
Since Solaris 11.1 has enabled Public key authentication by default, the configurations on server side is done.点击(此处)折叠或打开
- sudo svcadm enable svc:/network/ssh:default
Prepare windows client to be ready for automatically SSH login:
Lanuch Pageant application:
Click "Add Key" to add the private key saved previously, if you added a passphrase for the private key, you will be prompted to enter the passphrase.Use putty to login:
The server won't ask you for password any more, as long as Pageant is running in the background.点击(此处)折叠或打开
- d:\App\PuTTY\putty.exe deamen@192.168.1.103
Further more:
To launch Pageant and load your private key each time windows startup:
Create a file named "AutoPageant.cmd" with the following command:点击(此处)折叠或打开
- D:\App\PuTTY\pageant.exe d:\ssh_key\private.ppk
Put "AutoPagent.cmd" into your startup folder and then reboot.