에 새 파일 만들기 /usr/share/polkit-1/actions/
sudo nano /usr/share/polkit-1/actions/FlashTool.policy
아래 줄을 추가하십시오.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.run-FlashTool">
<description>Run FlashTool</description>
<message>Authentication is required to run FlashTool</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/home/natasha/FlashTool/FlashTool</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
</action>
</policyconfig>
그런 다음 새 파일을 작성하십시오. /home/natasha/FlashTool/
nano /home/natasha/FlashTool/flashtool-pkexec
아래 줄을 추가하십시오.
#!/bin/sh
pkexec "/home/natasha/FlashTool/FlashTool" "$@"
파일 Exec
에서 아래 줄을 사용하십시오 desktop
.
Exec=/home/natasha/FlashTool/flashtool-pkexec
다음 파일을 사용하여 내 시스템 Ubuntu 15.04 GNOME에서 테스트 했습니다.
$ cat /usr/share/applications/gedit.root.desktop
[Desktop Entry]
Name=Gedit as root
GenericName=Text Editor
X-GNOME-FullName=
Comment=
Exec=gedit-pkexec
Icon=gedit
Terminal=false
Type=Application
Categories=GNOME;System;Filesystem;Settings;
StartupNotify=true
X-Ubuntu-Gettext-Domain=gedit
$ cat /usr/share/polkit-1/actions/gedit.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.run-FlashTool">
<description>Run FlashTool</description>
<message>Authentication is required to run FlashTool</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gedit</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
</action>
</policyconfig>
$ cat /usr/bin/gedit-pkexec
#!/bin/sh
pkexec "gedit" "$@"