maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   an already "gainrooted" xterm (https://talk.maemo.org/showthread.php?t=40698)

Matjaz 2010-01-15 13:11

an already "gainrooted" xterm
 
Just an idea.
I was bored to type "sudo gainroot" every time I opened the xterm. So I made a shortcut on the desktop, which links to a xterm, which is already "gainrooted", that means: the "sudo gainroot" command has already been typed.
I've found the idea here, a thread about desktop command-shortcuts.
My code is:
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=su-xterm
Exec=/usr/bin/osso-xterm 'sudo gainroot'
Icon=
X-Osso-Type=application/x-executable

just put it into a file called NAMEOFTHEFILE.desktop in /usr/share/applications/hildon/.

This add an application in the menu called su-xterm. You can make a shortcut to this application on the desktop. After running it, verify if you are root by typing:
Code:

whoami
If you want a nice shortcut's icon, check this post.

I suggest to delete the shortcut to the normal xterm (if you have one), so you can't choose the wrong one. Remember: if you open a new terminal by tapping the upper bar in an opened xterm and then "new" button, you will be USER, not root. Just type "sudo gainroot" again and have fun!

(Obviously you need the rootsh package. ;) )

Note: I'm not an expert and this is just a simple idea. Please comment!

chainreaction 2010-01-15 13:13

Re: an already "gainrooted" xterm
 
Umm.. the first comment would be that you should not use this if you happen to use x-terminal in other ways than root. Might not be that bad if you just use the terminal to crack things up, but otherwise this is not the safest idea if you just accidentally forget that you're always automatically root.

codeMonkey 2010-01-15 13:23

Re: an already "gainrooted" xterm
 
Agreed - the extra step to switch to root is imho a good idea - so you're aware of what you're doing.

Matjaz 2010-01-15 13:24

Re: an already "gainrooted" xterm
 
Quote:

Originally Posted by chainreaction (Post 473994)
Umm.. the first comment would be that you should not use this if you happen to use x-terminal in other ways than root. Might not be that bad if you just use the terminal to crack things up, but otherwise this is not the safest idea if you just accidentally forget that you're always automatically root.

That's true.
But I've not yet used the xterminal as user. I need beeing root for the most of the things I set by command-line. :o
For the other things I will use the normal xterminal.

codeMonkey 2010-01-15 13:37

Re: an already "gainrooted" xterm
 
As long as you're aware of the risks :) Happy learning!

dalonso 2010-01-15 13:39

Re: an already "gainrooted" xterm
 
Quote:

Originally Posted by Matjaz (Post 474013)
That's true.
But I've not yet used the xterminal as user. I need beeing root for the most of the things I set by command-line. :o
For the other things I will use the normal xterminal.

If you happen to almost use your xterm as a root, you could also add the gainroot command to your .profile rather than creating two different shortcuts.

Look here:

http://lists.maemo.org/pipermail//ma...ry/000450.html

Matjaz 2010-01-15 13:41

Re: an already "gainrooted" xterm
 
Quote:

Originally Posted by codeMonkey (Post 474042)
As long as you're aware of the risks :) Happy learning!

Thanks!
I know that if you are root and you don't know what are you doing your N900 can explode in your hands :D, but at the moment I'm still a N900b and don't know how to change some complex configuration files or the kernel or something like that....

Thanks again!

Bec 2010-01-17 19:35

Re: an already "gainrooted" xterm
 
How can I launch an app directly after registering as root?

Exec=/usr/bin/osso-xterm 'sudo gainroot' emelfm2
Exec=/usr/bin/osso-xterm 'sudo gainroot emelfm2'
Doesn't seem to work...

Matan 2010-01-17 20:10

Re: an already "gainrooted" xterm
 
Add the application to sudoers by creating a file called
/etc/sudoers.d/emelfm2.sudoers containing:
user ALL = NOPASSWD: /usr/bin/emelfm2
Then use Exec = /usr/bin/sudo /usr/bin/emelfm2
or Exec = osso-xterm "sudo emelfm2"

Bec 2010-01-17 21:01

Re: an already "gainrooted" xterm
 
I have no idea what I'm doing wrong:
/etc/sudoers.d/emelfm2.sudoers

with
user ALL = NOPASSWD: /usr/bin/emelfm2 also tried with (%) in front and with the line in "01sudo"

and the emelfm.desktop with:
Exec = /usr/bin/sudo /usr/bin/emelfm2 => the app processes for a little while than it just quits.
Exec = osso-xterm "sudo emelfm2" => it asks for a password...

i tried sudo gainroot, passwd, set a new password and then replaced the "NOPASSWD" ... didn't work.

What am I doing wrong?


All times are GMT. The time now is 10:39.

vBulletin® Version 3.8.8