This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Help how to please - kde connect run script as su

Tags: None
(comma "," separated)
aperali
Registered Member
Posts
33
Karma
0
Hi,

Im using kde connect in tumbleweed and would like to run a small script which has to be executed as su. It basically contains
Code: Select all
#!/bin/bash
sudo grub2-once 2
sudo reboot

If I execute it from terminal it works perfect but when I execute from kde connect it doesnt.
From terminal I just issue
Code: Select all
/home/myuser/bin/windows.sh

and I copied this command inside an execute it from kde connect. Also I already allowed the script to be executed as su without the need to type a password (visudo)

This already worked before I need to reinstall suse, but unfortunately I did remember what command were used in kde con. As far as I can remember should call konsole but Im not sure.

Could anyone help me please?

Last edited by aperali on Tue Jun 25, 2019 2:53 pm, edited 2 times in total.
aperali
Registered Member
Posts
33
Karma
0
this is my sudo -l
Code: Select all
    (ALL) ALL
    (ALL) NOPASSWD: /home/aperali/bin/windows.sh

as said i can run the script from terminal and everything works. but launching from kde connect neither
Code: Select all
/home/aperali/bin/windows.sh
nor
Code: Select all
konsole -e /home/aperali/bin/windows.sh
works. in the last one konsole pops up a message saying that it is not possible to start the program /home/aperali/bin/windows.sh with the arguments /home/aperali/bin/windows.sh exec format error
i did also try
Code: Select all
konsole --workdir /home/aperali/bin -e windows.sh
but get the same error

EDIT: i've added the
Code: Select all
#!/bin/bash
in the first line of the script and it fixed the error in konsole -e but it keeps asking for
Code: Select all
[sudo] root password:
is it related to kde

Last edited by aperali on Tue Jun 25, 2019 1:49 pm, edited 1 time in total.
aperali
Registered Member
Posts
33
Karma
0
using it
Code: Select all
konsole -e $SHELL -c "/home/aperali/bin/windows.sh"
works but ask for root password! what's wrong here?
aperali
Registered Member
Posts
33
Karma
0
I found the answer. It was my fault. Sorry to bother you guys. :< ;)
I was forgetting to include 'sudo' inside the kde connect command.

Code: Select all
konsole -e sudo /home/aperali/bin/windows.sh


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]