标签:ssh
Stelnet服务器的配置
# 生成RSA密钥对
[DeviceB] public-key local create rsa
# 生成DSA密钥对
[DeviceB] public-key local create dsa
#使能SSH服务器功能
[DeviceB] ssh server enable
#配置接口ip地址
#设置stelnet客户端登陆用户界面的认证方式为scheme
[DeviceB]line vty 0 63
[DeviceB-line-vty0-63]authentication-mode scheme
#创建本地用户client001,并设置密码为明文aabbcc,服务类型为SSH,用户角色为network-admin。
[DeviceB]local-user client001 class manage
[DeviceB-luser-manage-client001] password simple aabbcc
[DeviceB-luser-manage-client001]service-type ssh
[DeviceB-luser-manage-client001] authorization-attribute user-role network-admin
[DeviceB-luser-manage-client001]quit
# 显示服务器端DSA公钥内容。
[DeviceB] display public-key local dsa public
Stelnet客户端的配置
# 配置接口GigabitEthernet2/0/2的IP地址,客户端将通过该地址连接Stelnet服务器。
[DeviceA] interface GigabitEthernet 2/0/2
[DeviceA-GigabitEthernet2/0/2] ip address 192.168.1.56 255.255.255.0
[DeviceA-GigabitEthernet2/0/2] quit
# 指定服务器端的主机公钥名称为key1,并进入公钥视图。
[DeviceA] public-key peer key1
Enter public key view. Return to system view with "peer-public-key end" command.
# 在客户端配置服务器端的主机公钥(由于客户端缺省采用DSA主机公钥认证服务器,因此这里输入的是在在服务器端通过display public-key local dsa public命令显示公钥内容。)
[DeviceA-pkey-public-key-key1]308201B73082012C06072A8648CE3804013082011F02818100D757262C4584C44C211F18BD96E5F061C4F0A423F7FE6B6B85B34CEF72CE14A0D3A5222FE08CECE65BE6C265854889DC1EDBD13EC8B274DA9F75BA26CCB987723602787E922BA84421F22C3C89CB9B06FD60FE01941DDD77FE6B12893DA76EEBC1D128D97F0678D7722B5341C8506F358214B16A2FAC4B368950387811C7DA33021500C773218C737EC8EE993B4F2DED30F48EDACE915F0281810082269009E14EC474BAF2932E69D3B1F18517AD9594184CCDFCEAE96EC4D5EF93133E84B47093C52B20CD35D02492B3959EC6499625BC4FA5082E22C5B374E16DD00132CE71B020217091AC717B612391C76C1FB2E88317C1BD8171D41ECB83E210C03CC9B32E810561C21621C73D6DAAC028F4B1585DA7F42519718CC9B09EEF03818400028180077F06B3E343CAE9988F4BE3F76FACBAB565AB73D4BA295C52BA92428B1F2DA1E6DD652413DD3AFE0C5A4FCF365100CBE34CECA55A2C30A2A9FF7E899628557E39CE8FC615F53193A7E200B4B1CB21E3F1091D595716D229DDED6872061F9B4B08301ADC81F7EC1501FFB863C0009536596CCB508596C3325892DC6D8C5C35B5
# 退出公钥视图,并保存用户输入的公钥。
[DeviceA-pkey-public-key-key1] peer-public-key end
[DeviceA] return
验证配置
# 建立到服务器192.168.1.40的SSH连接,并指定服务器端的主机公钥key1。输入正确的用户名和密码之后,即可成功登录到Device B上,用户角色为network-admin。
<DeviceA> ssh2 192.168.1.40 publickey key1
login as: client001
client001@192.168.1.40‘s password:
******************************************************************************
* Copyright (c) 2004-2014 Hangzhou H3C Tech. Co., Ltd. All rights reserved. *
* Without the owner‘s prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<DeviceB>
退出ssh服务
[deviceA]undo ssh server enable
本文出自 “赵鼎keystone” 博客,请务必保留此出处http://zddkeystone.blog.51cto.com/10388617/1664172
使用SSH(Secure Shell,安全外壳)功能实现安全的远程访问或文件管理的典型配置
标签:ssh
原文地址:http://zddkeystone.blog.51cto.com/10388617/1664172