Author Topic: [SOLVED] Running command as root on KDE user login?  (Read 1560 times)

Online muungwana

  • Hero Member
  • *****
  • Posts: 6214
Re: Running command as root on KDE user login?
« Reply #15 on: June 11, 2011, 01:45:12 PM »

your problem seem to be you dont want a module called "rt61pci" to be loaded? right?

A proper thing to do was to present a problem and ask for how to solve it, not to come up with a solution on your own and then ask people for help on working out the solution you have chosen for yourself.

if you do not want this module to be loaded at boot time, you can

1. Block the kernel from loading it by adding it in "/etc/modprobe.d/blacklist". Just add "blacklist rt61pci" in the text file and reboot and the kernel wont load it.

2. If you want any command to run with root's privileges just before the GUI starts, then add the command in "/etc/rc.local" script. Anything in the script will run with root's privileges just before the GUI starts. If you want to go with this route, then just add "modprobe -r rt61pci" and that module will be unloaded just before the GUI starts.

3. The most secured way to run one command with root's privileges without being asked for root's password is by using "sudo". The first two suggestions above should suffice for your need and hence this last one is unnecessary at the moment.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline CJ

  • Sr. Member
  • ****
  • Posts: 454
Re: Running command as root on KDE user login?
« Reply #16 on: June 11, 2011, 02:33:48 PM »
your problem seem to be you dont want a module called "rt61pci" to be loaded? right?
Nearly. What happens is that when I remove the module, the OS (?) re-starts it itself right after, and things work.

A proper thing to do was to present a problem and ask for how to solve it, not to come up with a solution on your own and then ask people for help on working out the solution you have chosen for yourself.
I respectfully disagree to how you picture the events, and thus me. You should be the first to know - as you were the one trying to help me on the other, initial post, for which I thank you - I fail to see what harm can be done by asking - and learning - how to run a command as root upon KDE start. As I also said in the post before this, I am so fed up with this issue by now that I just want it to work. If this helps me, so be it!

1. Block the kernel from loading it by adding it in "/etc/modprobe.d/blacklist". Just add "blacklist rt61pci" in the text file and reboot and the kernel wont load it.
As per above, I do not want it blacklisted. It's a kludge, but it work when it reloads itself.

2. If you want any command to run with root's privileges just before the GUI starts, then add the command in "/etc/rc.local" script. Anything in the script will run with root's privileges just before the GUI starts. If you want to go with this route, then just add "modprobe -r rt61pci" and that module will be unloaded just before the GUI starts.
I did try that, but it seems to be run too early in the process for it to work its magic. I need it to kick in after KDE starts up fully (alas, per Autostart).

3. The most secured way to run one command with root's privileges without being asked for root's password is by using "sudo". The first two suggestions above should suffice for your need and hence this last one is unnecessary at the moment.
See above - maybe this could be the way to go.

Whichever way, I really do appreciate you trying to help.
CJ

Online muungwana

  • Hero Member
  • *****
  • Posts: 6214
Re: Running command as root on KDE user login?
« Reply #17 on: June 11, 2011, 03:45:01 PM »
Quote
A proper thing to do was to present a problem and ask for how to solve it, not to come up with a solution on your own and then ask people for help on working out the solution you have chosen for yourself.
I respectfully disagree to how you picture the events, and thus me. You should be the first to know - as you were the one trying to help me on the other, initial post, for which I thank you - I fail to see what harm can be done by asking - and learning - how to run a command as root upon KDE start. As I also said in the post before this, I am so fed up with this issue by now that I just want it to work. If this helps me, so be it!

My apologies if i came across as being confrontations. I just think it is better to present a problem so that those who want to help you can get a better context of the problem and suitable solutions can be presented. I was just mentioning it, my post wasnt meant, in any shape or form, to be a critic of what you are trying to do or how you presented your problem.

you want to run a command with root's privileges from a normal user account without being asked for root's password. You can not do it without punching a hole in linux's basic security measures and hence your question is not as simple as you think it is.

You can suid set the executable as mentioned in one of the posts above but that has security implications as mentioned. You can set up "sudo" but it has some security implications and it is not very much liked here.

root's commands should be run from root's user space. This should be the first course of action. Others should follow when this one fail, others should not be the first to be considered. Your solution should be among those of last resort.

it looks like you were not around couple of weeks/months ago. Your question can lead to very controversial solutions surrounding punching linux's security holes and hence your question is not as simple as you think.

Can you give context to what the problem is, what does this module do, why do you not want the kernel to block it at boot time but you want to unload it not before the desktop start but after.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Hootiegibbon

  • Hero Member
  • *****
  • Posts: 4151
Re: Running command as root on KDE user login?
« Reply #18 on: June 11, 2011, 04:04:24 PM »
Cj,

I am struggling to see what you are trying to achieve with this, is it that the rt61pci module is causing conflict? or that you do not wish it to load at all?

Running "modprobe -r rt61pci" from within KDE4 as an auto start will fail as you are already in the user environment (ie you will need to su to root to do this)

If you want to kill the module but not permanently then use the blacklist route (or if trying to use the rt61pci try to black list the rt73usb, rt25xx and rt2561 (iirc)  modules as iirc these conflict with the rt61pci.

if you need the module to be probed only at the time of the hardware being 'switched on' and need it loaded on demand then try using modprobe -r rt61pci via rc.local so it is unloaded during the boot process after the hardware is probed

its the last suggestion that I *think* is what you need.

it is all very messy though, there may be a more elegant solution, if only you would elaborate on what it is exactly you wish to do....

Jase


I am Hootiegibbon, undisputed champion fo the typo

My .dotfiles

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: Running command as root on KDE user login?
« Reply #19 on: June 11, 2011, 05:13:48 PM »
Hello All,

the issue CJ is experiencing is explained better here: http://www.pclinuxos.com/forum/index.php/topic,91513.0.html
I have posted there the latest info about new driver module.

AS

Offline CJ

  • Sr. Member
  • ****
  • Posts: 454
Re: Running command as root on KDE user login?
« Reply #20 on: June 12, 2011, 10:56:52 AM »
My apologies if i came across as being confrontations.

No, no, not at all, I would never think that of you! I simply used a bit or rhetoric to try to get my point across. I am sorry if I expressed myself in a disrespectful manner or anyway to make you think that.

You can suid set the executable as mentioned in one of the posts above but that has security implications as mentioned.

I followed as' advice above, but the thing is, I can't get it to work. It is running the command but not as root, thus the modprobe command is rejected.

You can set up "sudo" but it has some security implications and it is not very much liked here.

I fully understand. I am only going to use this as a stop-gap solution for now, as I am planning to re-install in the not to distant future, when the next (2011) image is out and I get some time on my hands.

Can you give context to what the problem is, what does this module do, why do you not want the kernel to block it at boot time but you want to unload it not before the desktop start but after.

I think it better that I keep this to the initial thread (see below).


I am struggling to see what you are trying to achieve with this, is it that the rt61pci module is causing conflict? or that you do not wish it to load at all?

I can't blame you, as I know what I am asking is probably not the best approach, in principle.


All, I see that I have got some further action on the initial wifi-thread, so - unless there are objections - I shall take muungwana's advice and continue any wifi related issues over on that thread (whilst marking this thread as solved, even though it technically isn't.).

In this thread I was simply trying to establish a method to run a command from KDE start-up, with root privileges, etc... whatever that command might be.

Cheers for all you advice and help, it really is much appreciated!
CJ

the issue CJ is experiencing is explained better here: http://www.pclinuxos.com/forum/index.php/topic,91513.0.html
I have posted there the latest info about new driver module.
AS
« Last Edit: June 12, 2011, 11:07:02 AM by CJ »