Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-12-2009, 04:56 PM   #1
LQ Newbie
Registered: Apr 2008
Posts: 7

Rep: Reputation: 0
Run a (service) command as a normal user during start up

I have found so many ways for root user to execute commands in so many possible path locations - but having difficulties on executing commands as normal user - during start up.

This is what i've got for /etc/rc.d/rc.local script:

su -l user && (/bin/sh &)
But the command doesn't run at all... any better idea than above?

(this thread sort of a continued question of this: -thread-)
Old 10-12-2009, 05:14 PM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Originally Posted by mycoolwater View Post
su -l user && (/bin/sh &)
But the command doesn't run at all... any better idea than above?
A few ideas. What's that -l option on the su command? According to the man page (on Slackware 13) there's no such option. Secondly, how will /bin/sh find It would have to be in the current directory for it to work and what is the current directory when the boot scripts are running? /? You could try giving the full path to Finally the su command will complete and if it completes successfully, after it has exited, the command line will run /bin/sh & as root. Maybe this is closer to doing what you want to do:
(su - user -c /bin/sh <full path to>/ )&
Is there any particular reason for using /bin/sh rather than /bin/bash?

EDIT: as the command is going to be backgrounded and is a single command, the suggested command is pointlessly complex and can more simply be
su - user -c /bin/sh <full path to>/ &

Last edited by catkin; 10-12-2009 at 05:17 PM. Reason: Prettification
Old 10-13-2009, 05:59 PM   #3
LQ Newbie
Registered: Apr 2008
Posts: 7

Original Poster
Rep: Reputation: 0


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 a normal user run KDE? morphynoman Linux - Newbie 10 11-17-2008 08:09 PM
How to run root privileged Linux command as normal user via shell shell tcegrid Linux - Newbie 1 06-23-2008 04:38 PM
run command as normal user at boot time julot Slackware 2 01-28-2007 11:27 AM
how to run root command having normal user permission ravi.patil Linux - Newbie 7 05-21-2006 03:21 PM
Service won't start unless run as root user gauge73 Linux - General 3 05-07-2005 11:37 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:12 AM.

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