[S3100-SI]public-key local create rsa   //生成本地RSA密钥对
 
[S3100-SI]local-user h3c

[S3100-SI-luser-h3c]password cipher h3c

[S3100-SI-luser-h3c]service-type ssh level 3   //创建本地用户服务类型为ssh
 
下面用puttygen生成rsa密钥对,将公钥和私钥文件保存,同时将公钥文件名gongyao的文件上传到交换机中,接着进行如下配置
 
[S3100-SI]public-key peer xx import sshkey gongyao  
//从文件gongyao中导入putty生成的公钥且命名为xx
 
[S3100-SI]ssh user h3c assign publickey xx    //设置ssh用户h3c的公钥为xx
 
[S3100-SI]ssh user h3c service-type stelnet   //设置ssh用户h3c登录类型为stelnet
 
[S3100-SI]ssh user h3c authentication-type password-publickey
//设置ssh用户h3c的验证类型为公钥加密码验证
 
此时,打开putty,在其中ssh菜单下的auth中导入之前由puttygen生成的私钥文件,在session选项卡中输入交换机的IP地址,选择类型为ssh即可ssh登录到交换机中。