解决Gnome面板通知栏里没有Network Manager图标问题
本人的测试服务器安装的是CentOS 6.x,如果用非root用户登录到Gnome桌面时,Network Manager图标就不会出现在面板通知栏里,虽然可以用命令行来管理网络的开关,但既然是图形化操作界面,不能用鼠标点点就能控制网络的话,总觉得是不完美的。对于这个问题其实我很早就发现了,但一直没去研究,今天下决心来解决下这个遗难杂症。
首先Google,发现遇到这个问题的人还是挺多的,给出的解决方案也无非就是检查NetworkManager服务有没有启动,再者就是重置面板,恢复默认设置,但都不能解决问题。然后在一个国外Linux论坛里获得了启发,链接在此。
回头总结了下原因,其实问题出在nm-applet上,Network Manager的面板图标是由该命令启动的,在命令行下运行该命令后出现了以下错误(非sudo):
[terence@centos system.d]$ nm-applet ** (nm-applet:4290): WARNING **: request_name(): Could not acquire the NetworkManagerUserSettings service. Error: (9) Connection ":1.172" is not allowed to own the service "org.freedesktop.NetworkManagerUserSettings" due to security policies in the configuration file
怪不得没法出现在面板上,如果采用sudo启动的话就能出现图标了,看字面意思应该是受到了安全策略的限制导致了启动失败。解决方案很简单,只要修改相应的配置就可以了。
打开/etc/dbus-1/system.d/NetworkManager.conf,找到<policy user="root">节点,然后复制和它一样的一个节点在其下面,修改节点的user属性为你当前登陆的用户名:
<policy user="root"> <allow own="org.freedesktop.NetworkManager"/> <allow own="org.freedesktop.NetworkManagerSystemSettings"/> <allow send_destination="org.freedesktop.NetworkManager"/> <allow send_destination="org.freedesktop.NetworkManagerSystemSettings"/> <allow send_destination="org.freedesktop.NetworkManager" send_interface="org.freedesktop.NetworkManager.PPP"/> </policy> <policy user="terence"> <allow own="org.freedesktop.NetworkManager"/> <allow own="org.freedesktop.NetworkManagerSystemSettings"/> <allow send_destination="org.freedesktop.NetworkManager"/> <allow send_destination="org.freedesktop.NetworkManagerSystemSettings"/> <allow send_destination="org.freedesktop.NetworkManager" send_interface="org.freedesktop.NetworkManager.PPP"/> </policy>
相应的/etc/dbus-1/system.d/nm-applet.conf,也是找到<policy user="root">节点,然后复制和它一样的一个节点在其下面,修改节点的user属性为你当前登陆的用户名:
<policy user="root"> <allow own="org.freedesktop.NetworkManagerUserSettings"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings.Connection"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.DBus.Properties"/> <!-- Only root can get secrets --> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings.Connection.Secrets"/> </policy> <policy user="terence"> <allow own="org.freedesktop.NetworkManagerUserSettings"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings.Connection"/> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.DBus.Properties"/> <!-- Only root can get secrets --> <allow send_destination="org.freedesktop.NetworkManagerUserSettings" send_interface="org.freedesktop.NetworkManagerSettings.Connection.Secrets"/> </policy>
修改完配置文件后重启Gnome桌面就生效了,这下Network Manager图标看你往哪儿跑!当然如果真的是手贱活生生把图标给弄没的话,那就试试重置面板大法吧:
gconftool-2 --recursive-unset /apps/panel
» 转载请注明来源:Terence的窝 » 《解决Gnome面板通知栏里没有Network Manager图标问题》
最新评论