首页 > 技术文章 > H3C-SW的密码管理和ftp

yizhangheka 2020-06-24 13:13 原文

H3C-SW的密码管理

我不是第一次写类似的记录了,但是好长时间不用,都忘记了,再梳理梳理吧;

关于aux

华三交换机和华为交换机类似,都存在多个虚拟终端,LINUX系统也是这样,交换机的底层就是LINUX系统。

# 查看一个交换机当前的终端 ,发现第一个是aux,余下的是vty0到vty63
<JN-JR-01>dis user-interface 
  Idx  Type     Tx/Rx      Modem Auth  Int          Location
  0    AUX 0    9600       -     P     -            1/0
+ 10   VTY 0               -     P     -            1/0
  11   VTY 1               -     P     -            1/0
  12   VTY 2               -     P     -            1/0
  中间省略……
  72   VTY 62              -     P     -            1/0
  73   VTY 63              -     P     -            1/0

  +    : Line is active.
  F    : Line is active and in async mode.
  Idx  : Absolute index of line.
  Type : Type and relative index of line.
  Auth : Login authentication mode.
  Int  : Physical port of the line.
  A    : Authentication use AAA.
  N    : No authentication is required.
  P    : Password authentication.

通过console线登录的是aux终端,而通过telnet通过就是vty了,当前我是通过telnet登录的,所以vty0左边有一个加号,表示当前活动的。

从上文当中应该可以看出,console和vty不是一个终端 ,其登录用户和密码也可以单独设置。

# 更改console登录的密码
[JN-JR-01]user-interface aux 0
[JN-JR-01-line-aux0]authentication-mode password  #即直接输入密码的方式登录,不用输入用户名
[JN-JR-01-line-aux0]set authentication password simple 123  #这里面设置密码,自动加密为密文

关于telnet

关于telnet的登录值得的一提,常用的大概有两种登录方法.

第一种:telnet之后直接输入密码就可以进入

第二种:telnet之后要输入用户名和密码才可以进入

(1)直接输入密码

//启动telnet服务
telnet server enable
# 更改vty 0 4登录的密码
[JN-JR-01]user-interface vty 0 4
[JN-JR-01-line-vty0-4]authentication-mode password
[JN-JR-01-line-vty0-4]set authentication password simple 123
line vty 0 4
 user-role network-admin
 user-role network-operator
 set authentication password hash $h$6$6+WYNNS3UUSr4lCl$iwsuh7N//L0kAPxYn+EoJu0UA5aotXfCkMm4xmKSrvU5BhlLLBHJfdXzKlef8UZL0RrbGRdmbAxKr1upiwFWXQ==
 protocol inbound telnet

在输入authentication-mode password的时候要注意,认证方式有三种可以选择,第一种即我们使用的那种passwd,就是输入密码之后就可以进入,如果使用这种方式的话下面立马就可以设置密码了.此外还可以选择scheme这个意思就是使用本地用户名和密码进行登录,如果使用这种的话,后续还可以给用户设置密码.

(2)通过用户名密码进行登录

telnet server enable

[H3C]user-interface vty 0 4
[H3C-ui-vty0-4]authentication-mode scheme  

//设置创建本地认证的用户名
[H3C]local-user admin 

//使用命令查看当前配置时,会显示加密后的字符串
[H3C-luser-admin]password cipher 5201351    

//作用于telnet服务,用户级别可单独一行,缺省为级别0
[H3C-luser-admin]service-type telnet level 3  这一行可以被替换为authorization-attribute user-role network-admin
  1. network-admin:具有最高权限,可操作系统所有功能和资源(除安全日志文件管理相关命令外),配置此权限默认会给network-operator权限。
  2. network-operator:可执行系统所有功能和资源的相关display命令(除安全日志等查看命令外,具体大家可以自行查看)。
  3. Level-n(0-15):数值越大,权限越大。level-15相当于network-admin权限。
  4. security-audit:安全日志管理员权限,仅具有安全日志的读、写、执行权限。

快速配置

sys
int vlan 4
ip add 192.168.0.80 22
qu
user-interface aux 0
authentication-mode password
set authentication password simple 123
quit
user-interface vty 0 4
authentication-mode password
set authentication password simple 123
quit
quit
save for

在这里面引用一个别人写的博客:https://www.cnblogs.com/5201351/p/4362222.html

ftp配置

[JN-JR-04]local-user adminftp class manage 
New local user added.
[JN-JR-04-luser-manage-adminftp]password simple cba-123
[JN-JR-04-luser-manage-adminftp]auth
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-ur
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-ro
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-role net
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-role network-ad
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-role network-admin wo
[JN-JR-04-luser-manage-adminftp]authorization-attribute user-role network-admin work-directory flash:/
  [JN-JR-04-luser-manage-adminftp]service-type ftp
[JN-JR-04-luser-manage-adminftp]quit
[JN-JR-04]ftp server enable 


ftp> get startup.cfg

推荐阅读