nagios-4.0.6新增用户并设置只能查看所有主机和服务,不能修改任何主机和服务的配置
1. 新建一个Nagios管理界面认证用户
[root@Nagios ~]# htpasswd/usr/local/nagios/etc/htpasswd.users yangkuo
New password:
Re-type new password:
Adding password for user yangkuo
2. 配置cgi.cfg文件,黄色为新增内容
[root@Nagios ~]# sed -i '181a authorized_for_read_only=yangkuo'/usr/local/nagios/etc/cgi.cfg
[root@Nagios ~]# sed -n '181,187p'/usr/local/nagios/etc/cgi.cfg #无需重启Apache和Nagios服务
#authorized_for_read_only=user1,user2
authorized_for_read_only=yangkuo #只允许查看,不能管理
# STATUSMAP BACKGROUND IMAGE
此时用户yangkuo已经可以登录Nagios主界面了,但是没有权限看Nagios客户端的任何信息
[root@Nagios ~]# sed -i'156,157s/$/&,yangkuo/g' /usr/local/nagios/etc/cgi.cfg
[root@Nagios ~]# sed -n '153,161p' /usr/local/nagios/etc/cgi.cfg #无需重启Apache和Nagios服务
# to authorize any user who hasauthenticated to the web server.
authorized_for_all_services=wangning,yangkuo
authorized_for_all_hosts=wangning,yangkuo
# GLOBAL HOST/SERVICE COMMAND ACCESS
此时可以查看任何主机和服务了,但是不能配置
本文转自 茁壮的小草 51CTO博客,原文链接:http://blog.51cto.com/wn2100/1954577,如需转载请自行联系原作者