LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-31-2007, 07:10 PM   #1
tmbrwolf53
LQ Newbie
 
Registered: Sep 2006
Posts: 9

Rep: Reputation: 0
Is a script, run at boot time from init.d, run with root authority?


I have a script that I want to run at boot time. This script needs to 'su' to a specific userid in order to start an application. If I run the script from a command line, (as root) it works. If it runs at boot time, it fails.

From what I can figure, the su command is failing.
Are scripts, run at boot time, run with root authority? If not, how do I get the su command to work at boot time.

Sorry ... I guess I should add that the Linux OS is Red Hat Enterprise Linux V4



Would having the script run from inittab make a difference?

Last edited by tmbrwolf53; 04-02-2007 at 07:16 AM.
 
Old 03-31-2007, 08:13 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Yes, the startup scripts are run as root. How are you doing the su command? In init scripts I usually do:

su user1 -c 'command to run as user1'
 
Old 03-31-2007, 08:15 PM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
If it is owned by root,root, and executable, it should and will run at bootup. For example, all the rc.d scripts are root-owned, and are executable, and root is who boots the machine.
You shouldn't need su/sudo, unless you wanted to change to a lesser user for some reason.
 
  


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
Can't get script to run from symlink in etc/init.d goggyturk Debian 5 12-05-2006 12:34 PM
RH8 - how to automatically run a shell script at boot time nu-B Linux - Newbie 2 11-03-2003 02:47 PM
RH8 - how to automatically run iptables rules shell script at boot time nu-B Linux - General 1 10-29-2003 08:38 PM
init script won't run at log-off dimangi Linux - Newbie 1 10-29-2003 02:19 AM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:22 PM.

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
Open Source Consulting | Domain Registration