[Share Experiences] deepin使用root权限打开桌面应用
Tofloor
poster avatar
wangxinyu
deepin
2022-02-25 20:02
Author

以putty为例(不以root打开,无法使用serial port)

1, 在Exec增加sudo

2, 增加Terminal=true

3, 注释掉 #X-Deepin-AppID=putty

X-Deepin-AppID这个字段的具体含义是啥呢? 待研究,不注释掉会有问题。

这样会增加一个terminal的终端,不美观。

而所论坛中有朋友说的pkexec, 虽然弹出了提示输入密码的输入框,但输入后也打不开应用程序,原因未知 。

[Desktop Entry]
Version=0.74
Name=PuTTY
GenericName=PuTTY
Comment=Connect to an SSH server with PuTTY
Type=Application
Exec=sudo /opt/apps/org.chiark.putty/files/bin/putty
Icon=putty
Keywords=ssh;connect;
Categories=GTK;Network;
X-Deepin-CreatedBy=com.deepin.dde.daemon.Launcher
#X-Deepin-AppID=putty
Terminal=true
Reply Favorite View the author
All Replies
wangxinyu
deepin
2022-02-25 20:32
#1

沙发

Reply View the author
tsic
deepin
2022-02-25 21:06
#2

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY

Reply View the author
lanxing0821
deepin
2022-02-26 07:25
#3

Exec=bash -c 'PASSWORD=$(zenity --password --title="请输入你的用户密码") && echo "$PASSWORD" | sudo -S /opt/apps/org.chiark.putty/files/bin/putty'

Reply View the author
lanxing0821
deepin
2022-02-26 07:44
#4

有kdialog的话可以换成kdialog,感觉kdialog比zenity好看得多了。

Exec=bash -c 'PASSWORD=$(kdialog --password "请输入你的用户密码" --title "用户密码" 2> /dev/null) && echo "$PASSWORD" | sudo -S /opt/apps/org.chiark.putty/files/bin/putty'

Reply View the author
wangxinyu
deepin
2022-02-26 21:39
#5
lanxing0821

Exec=bash -c 'PASSWORD=$(zenity --password --title="请输入你的用户密码") && echo "$PASSWORD" | sudo -S /opt/apps/org.chiark.putty/files/bin/putty'

除了安全性,用着很赞

Reply View the author
zhangqf
deepin
2022-03-20 08:44
#6

在.desktop中写入

Exec=bash -c "echo '用户密码' | sudo -S /opt/apps/doublecmd/doublecmd.sh"

确实可以root身份启动Double Commander,用起来方便多了。谢谢

Reply View the author
虎锅
deepin
2023-09-05 03:34
#7
zhangqf

在.desktop中写入

Exec=bash -c "echo '用户密码' | sudo -S /opt/apps/doublecmd/doublecmd.sh"

确实可以root身份启动Double Commander,用起来方便多了。谢谢

.desktop在哪个路径下呀?

Reply View the author
zhangqf
deepin
2023-09-14 14:59
#8
虎锅

.desktop在哪个路径下呀?

.desktop文件是系统桌面的快捷方式,保存在/home/用户名/Desktop/目录下。

Reply View the author