![]() Registered Member ![]()
|
KDE Frameworks 5.71.0
Qt 5.12.7 (built against 5.12.7) The xcb windowing system Opensuse 15.3 ------------------------------------------ Hello. I have found on internet, that we can start a .desktop file with 'gtk-launch'. I have tried on these installed in '/usr/share/applications'. Some start, some does not. gtk-launch calc is ok. but gtk-launch: no such application KEncFS-Plasma. I have a script that need elevated privilege. It fail to run from a console, but succeed if started from a .desktop file ( in /home/user/Desktop ) with run as user root ticked. If it should work, where to store the desktop file ( in any case not in '/home/user' ) I have also read that it should work on some distro and not on other. Any help is welcome. |
![]() Registered Member ![]()
|
Hi!
The default location for user .desktop-files is `$HOME/.local/share/applications`. What exactly do you try to run? Do you get those privileges with sudo, pkexec or similar? You can try `kioclient5 exec /path/to/file.desktop` to run it. |
![]() Registered Member ![]()
|
I have a script to configure a new computer from 'ONE-CLICK'. The script is on usb stick. The script is eventually run by a few other peoples which knows the root passwords. This script install minimal software, then configure preferences for 2 initial users : user1 (which has run the leap installer) and user2 The script must have write access to /etc, /usr/share, /root, /home/user1, /home/user2 The script is run in graphical mode. The operator may have to edit configuration files in /etc, /usr/share, /root, /home/user1, /home/user2 The process is simple : insert the usb stick, open dolphin, double click on the program icons, then type the root password each times it is asked. If sometimes things go wrong, as already said, the operator may have to edit configuration files in /etc, /usr/share, /root, /home/user1, /home/user2 During the test of my program, i run into some problems with root privileges and kate. I discover a workaround by using a .desktop file in my account. So my idea is to put a specific .desktop file in the same folder than the running script, and call it within the script. Any help is welcome. |
![]() Registered Member ![]()
|
Then you can use the kioclient exec call for your desktop-file.
If the user knows the password and is able to type it more than one time you could open the file with `kate /etc/file1 /etc/file2` as PolicyKit asks for the password if permissions do not match. Another approach would be to split the script into root- and user-stuff and start it with `su/sudo/pkexec ./myscript` and call the user-stuff with su/sudo/pkexec -u username/uid from within the root-script. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]