deepin做一些需要root权限的操作不需要输入密码原理是什么?
Tofloor
poster avatar
ibeetv.com
deepin
2014-07-25 20:10
Author
RT.
Reply Favorite View the author
All Replies
Bluek404
deepin
2014-07-25 20:19
#1
可能是新建一个用户然后给予这个用户特定的写入权限?
Reply View the author
MattD
deepin
2014-07-25 20:35
#2
以软件中心为例,查看源代码中的 pkg_manager/apt/dbus_script/com.linuxdeepin.softwarecenter.service这个文件,可以看到其内容如下:
  1. [D-BUS Service]
  2. Name=com.linuxdeepin.softwarecenter
  3. Exec=/usr/bin/deepin-software-center-backend.py
  4. User=root
Copy the Code
因此,是否可以得出这么个结论,软件中心服务其实是以root身份随dbus一起运行的,所以可以不需要用户输入密码认证即可实现包管理。
个人不懂编程,仅是猜测。
Reply View the author
iceyer
deepin
2014-07-25 21:05
#3
基本是这样的.但dbus还要涉及到权限处理, 参考
com.linuxdeepin.softwarecenter.service.policy和com.linuxdeepin.softwarecenter.service.conf文件
在系统启动时都是root权限, 另一种简单的方法是在/etc/rc.local中放入自己运行的服务,这也是用root权限启动的.
Reply View the author
ibeetv.com
deepin
2014-07-25 23:09
#4
基本是这样的.但dbus还要涉及到权限处理, 参考
com.linuxdeepin.softwarecenter.service.policy和com.linuxdeepin.softwarecenter.service.conf文件
在系统启动时都是root权限, 另一种简单的方法是在/etc/rc.local中放入自己运行的服务,这也是用root权限启动的.
哦!他是先让自己的服务易root用户的身份开机启动,之后的关键操作都是它去做,然后就不会弹出认证框了。
Reply View the author
cxbii
deepin
2014-07-26 02:03
#5
以软件中心为例,查看源代码中的 pkg_manager/apt/dbus_script/com.linuxdeepin.softwarecenter.service这个文件,可以看到其内容如下:
  1. [D-BUS Service]
  2. Name=com.linuxdeepin.softwarecenter
  3. Exec=/usr/bin/deepin-software-center-backend.py
  4. User=root
Copy the Code
因此,是否可以得出这么个结论,软件中心服务其实是以root身份随dbus一起运行的,所以可以不需要用户输入密码认证即可实现包管理。
个人不懂编程,仅是猜测。
你的分析是正确的
Reply View the author