LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-20-2012, 11:04 AM   #1
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Rep: Reputation: Disabled
/etc/init.d/script.sh permission denied for normal user?


I have a script in /etc/init.d (some distros call it /etc/rc.d) where all the other scripts for the runlevels reside. (It minimizes power consumption on a netbook). It gets started during boot all right.

Since not all devices / processes / whatever are up and running I also want to run the script when entering runlevel 5. So I have a link in /home/user/.kde4/Autostart to the original file in /etc/init.d. When I run the script via this link I get "permission denied".

The link has
Code:
lrwxr-xr-x  root root
or
lrwxr-xr-x  me users
and doesn't work.

The script in /etc/init.d has
Code:
-rwxr-xr-x root root
or
-rwxr-xr-x  me users
and doesn't work.

The directories /etc and init.d have "drwxr-xr-x".

No go.

I tried on the script "chmod 1755 script", "chmod 2755 script", "chmod 3755 script", "chmod 5755 script", "chmod 7755 script" -- nothing (as you see, I don't really understand the effects, but I tried).

Why doesn't it work?
 
Old 12-20-2012, 12:37 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by JZL240I-U View Post
Why doesn't it work?
For one because you seem to be doing things without understanding the consequences and that's the way to fsck up your system good. Also system services are run for the system and unprivileged users shouldn't manage those.
- If the service should run in runlevel 5 then use your system management tools (or add a slink) to make it start in runlevel 5.
- If the service restart depends on device availability then check Udev or whatever your system uses to trigger a response.
- If you need the user to run the service anyway then add an entry for the exact command in /etc/sudoers and configure it so the users can execute the exact command though Sudo without it asking for a password for it.
- If you want to do the above but in a less DE-dependent way you could try using pam_script in the PAM stack for GDM, KDM or whatever DMs you have.
 
Old 12-21-2012, 03:21 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
For one because you seem to be doing things without understanding the consequences...
Exactly. An that is what I wrote. But I think the risk is manageable, the machine is not in any net and I reset the permission imediately after the test. I also read up on setuid and guid.

Quote:
Originally Posted by unSpawn View Post
- If the service should run in runlevel 5 then use your system management tools (or add a slink) to make it start in runlevel 5.
That is what I did. And it works. Like I wrote in the first post.

It is not a service in the usual sense but a script which runs just once to minimize power consumption of the system.

Quote:
Originally Posted by unSpawn View Post
- If the service restart depends on device availability then check Udev or whatever your system uses to trigger a response.
It is udev. I know how to write a rule but not how to "check" udev "to trigger a response". Do you have a good source so I can read up on that?

Quote:
Originally Posted by unSpawn View Post
- If you need the user to run the service anyway then add an entry for the exact command in /etc/sudoers and configure it so the users can execute the exact command though Sudo without it asking for a password for it.
Good idea. The reason I did it the way I described in the first post is that I wanted to have only one version of the script in one place (/etc/init.d). And I wanted to start it automatically.

Quote:
Originally Posted by unSpawn View Post
- If you want to do the above but in a less DE-dependent way you could try using pam_script in the PAM stack for GDM, KDM or whatever DMs you have.
Another good idea. But this is a netbook just for taking notes etc. when I'm travelling, so I'll use a DE (KDE). Not to mention the fact that I would have to do an other massive amount of learning .

But ... my original question is not really answered: Why doesn't it work? This is something I'd very much like to understand.
 
Old 12-21-2012, 04:15 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by JZL240I-U View Post
It is not a service in the usual sense but a script which runs just once to minimize power consumption of the system.
...and the actual command(s) the script runs requires root privileges, is the reason why.
 
Old 12-21-2012, 05:58 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Original Poster
Rep: Reputation: Disabled
....ahhh, I see -- and should have seen earlier. Thanks unSpawn.

The script has tons of write operations on files writeable only to root. While I might change all necessary permissions sequentially by hand, I would also have to keep track of them during system updates. That is too much ado. I'll use sudo when there is no connection to the power grid. Issue solved. Thanks again.

P.S.: ...that source to read up on udev triggers?
 
Old 12-21-2012, 06:13 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by JZL240I-U View Post
P.S.: ...that source to read up on udev triggers?
What's that popular search engine called again?

*If it's about a device connect / disconnect thing maybe post some lsusb / lspci / lshal / ls*whatever specs? Else a verbose description of what's happening.
 
Old 12-21-2012, 06:20 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Original Poster
Rep: Reputation: Disabled
Okay, okay, okay . "udev trigger" gives plenty of results, I'll learn from them. I thought you had something special in mind.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
permission denied in crontab -l in RHEL4,as normal user kcmakwana Red Hat 3 03-13-2008 12:37 AM
X no longer working as normal user - permission denied vharishankar Debian 4 07-15-2006 01:36 AM
Submount, "permission denied" when writing to floppy as normal user DaneM Linux - Software 5 02-22-2006 03:05 PM
ssh login with normal user, receive: /dev/null: Permission denied mark78301 Red Hat 3 11-12-2005 10:20 AM
/etc/init.d/cyrus Shell Script 'Permission denied' ServerStorm Linux - Software 3 01-20-2005 12:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration