maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   [SOLVED]Create desktop icon with root access to my script - some help needed.. (https://talk.maemo.org/showthread.php?t=80743)

Schturman 2011-12-09 03:34

[SOLVED]Create desktop icon with root access to my script - some help needed..
 
Hello
I have script for some my stuff. I created icon with this lines:
Code:

[Desktop Entry]
Type=Application
Name=MYN9QT
Categories=System;
Exec=/usr/bin/meego-terminal -n -e sh /home/user/MyDocs/Modding/N9QuickTweak/MYN9QT
Icon=icon-l-terminal

It's work and it's allow me to access as USER, but most of my commands I need to run as ROOT (devel-su)
What I need to change in this line: /usr/bin/meego-terminal -n -e sh /home/user/MyDocs/Modding/N9QuickTweak/MYN9QT
that allow me to access to my script as ROOT (devel-su) ?
I tried like this:
Code:

/usr/bin/aegis-exec -s -u echo $PASSWORD | devel-su -c -l "/usr/bin/meego-terminal -n -e sh /home/user/MyDocs/Modding/N9QuickTweak/MYN9QT"
, but it's not work at all..

Another question..
When I run my script from Terminal as ROOT (devel-su), I have one command that I need to run as USER:
Code:

cp -r /home/user/MyDocs/.wallpapers/mywall.png /home/user/.wallpapers
and I always need to exit from ROOT and access to my script again as USER..
Is it possible to add something before my command, that will can perform my command without exiting from ROOT ?

Thanks


EDIT: Problem solved..

Niwakame 2011-12-10 22:36

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Would be great if you could share your solution to the community :)

jalyst 2011-12-11 22:41

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Think almedhi gave him some pointers (if im not mistaken) in his n9tweak script thread at forum.meego

Niwakame 2011-12-12 19:53

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Yeah, but it would then be better to link to forum.meego for the solution ^^ I bet someone else will have the same problem again in a few days / weeks.

Schturman 2011-12-13 18:27

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
I will explain later.. Sorry, no time for now..

Schturman 2011-12-14 01:49

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Hi
I got help from one guy (hxka) from Russian forum that explain to me how to do this. Important things are marked in red. For the first:

Code:

[Desktop Entry]
Type=Application
Name=N9 QTweak
Categories=System;
Exec=/usr/bin/meego-terminal -n -e devel-su -c "sh /home/user/MyDocs/N9QTweak/N9QT"
Icon=/usr/share/icons/hicolor/80x80/apps/N9quicktweak80.png

And for the second one:

Code:

devel-su user -c "cd /home/user/MyDocs/.wallpapers && cp -r mywall.png /home/user/.wallpapers"
Enjoy :)

juiceme 2013-11-27 13:30

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
This method launches up a terminal asking for the devel-su password.
How can I achieve the same thing without typing in a password, so that a script is launched with root credentials from a desktop icon.

I tried to set suid bits on the script but it does not seem to elevate my creds.
(and yes, of course this is an Open Mode device as I have no type of devices... :D)

Schturman 2013-11-27 17:23

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Try
Code:

devel-su -c "echo rootme | sh /path/to/script.sh"
rootme = your root pass

juiceme 2013-11-27 21:14

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
Quote:

Originally Posted by Schturman (Post 1389471)
Try
Code:

devel-su -c "echo rootme | sh /path/to/script.sh"
rootme = your root pass

Okay, that did not work really as intended, but then I thought a bit of it and came up with the following which works:
Code:

echo rootme | devel-su -c "sh /path/to/script.sh"

Schturman 2013-11-27 21:36

Re: [SOLVED]Create desktop icon with root access to my script - some help needed..
 
yes, I meant what you wrote. sorry, I'm at work now, no time to think...


All times are GMT. The time now is 23:15.

vBulletin® Version 3.8.8