用户/命令权限配置

1
R1(config)#username wy1 privilege 14 password 0 111       //创建一个用户名为wy1 密码为111的用户,将他的权限设为14
R1(config)#username wy2 privilege 7 password 0 222         //权限为7
R1(config)#username wy3 privilege 2 password 0 333         //权限为2
R1(config)#line con 0
R1(config)#login local                          //在con接口启用本地数据库,使用用户名,密码登录该接口
如今进行验证
User Access Verification
Username: wy1                         //使用用户名wy1登录
Password:                                 //密码为111

R1# sh privilege                       //登录成功并用 sh privilege查看当前用户的优先级
Current privilege level is 14       //输出显示为14
不一样级别的用户之间能够互相切换,首先来看从高级别用户向低级别用户切换的状况
R1#sh privilege
Current privilege level is 14
R1# en 7                                   //登陆到优先级为7的用户上
R1#sh privilege
Current privilege level is 7
R1# en 2                                   //登陆到优先级为2的用户上
                               
R1#sh privilege
Current privilege level is 2
经过验证,能够看到从高级别向低级别切换时能够直接切换
如今来看从低往高的状况
R1#sh privilege
Current privilege level is 2
R1# en 7
no password set            //咱们看到显示说密码没有设置
因此从低级别用户向高级别用户切换时须要密码,这也不难理解,下面来设置切换密码;
R1(config)#enable secret  level  7  cisco  //设置到级别7用户的切换密码为cisco,注:这个密码与wy2的登录密码无关
下面进行验证;
R1#sh privilege
Current privilege level is 2
R1#en 7
Password:                                 //密码为cisco
R1#sh privilege
Current privilege level is 7
配置密码后,低级别用户能够成功登录到高级别用户
3 目前3个权限的用户都没法进入全局模式,如今要让他们都能进入,而且只有权限14的用户能够用show 命令查看。下面进行配置,并进行验证。
R1(config)#privilege exec level 2 config t   //设置用户权限大于或等于2时,能够使用configure t命令
R1(config)#privilege exec level 14 show    //设置用户权限大于或等于14时,能够使用show命令

R1#en 2
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#                        //权限2的用户已经能够进入全局模式了
R1(config)#?
Configure commands:      //进入全局模式后只有几条默认的命令,那是由于其余全部的命令都不在这个权限下
  default  Set a command to its defaults
  end      Exit from configure mode
  exit     Exit from configure mode
  help     Description of the interactive help system
  no       Negate a command or set its defaults
R1#sh ?
% Unrecognized command        //权限2 下没法使用show
R1#en 7
Password:
R1#sh ?
% Unrecognized command        //权限7下也没法使用show
R1#en 14
Password:
R1#sh ?                                       //权限14就能够使用
  access-lists    List access lists
  adjacency       Adjacent nodes
  aliases         Display alias commands
  arp             ARP table
  async           Information on terminal lines used as router interfaces
  backup          Backup status
  buffers         Buffer pool statistics
  cca             CCA information
  cdapi           CDAPI information
 原文地址 [url]http://blog.chinaunix.net/u1/36438/showart.php?id=289770[/url]
相关文章
相关标签/搜索