How to Start Program at Boot-Time as Normal User
Hi there,
As we know, if I want to start a program after a system reboot, I Could add
a startup script to the system startup files (typically rc.local or a file
in an rc.N directory). But this will start the prgram as root.
What I want is to start the program as a normal user (e.g. ross).
How could I do that?
Thanks in advance,
Ross
Re: How to Start Program at Boot-Time as Normal User
"Ross" <nospam@ross.com> wrote in message
news:Y7ednf21jYSJBbvYnZ2dnUVZ_tydnZ2d@magma.ca
[color=blue]
> As we know, if I want to start a program after a system reboot, I
> Could add a startup script to the system startup files (typically
> rc.local or a file in an rc.N directory). But this will start the
> prgram as root.
> What I want is to start the program as a normal user (e.g. ross).
> How could I do that?[/color]
Instead of merely invoking the command in the script which is run as root,
use
su ross -c "/path/to/script args"
Omit the quotes if no args are required. "man su" for further information.
Re: How to Start Program at Boot-Time as Normal User
On Fri, 6 Oct 2006 13:53:23 -0400, Ross <nospam@ross.com> wrote:
[color=blue]
>Hi there,
>As we know, if I want to start a program after a system reboot, I Could add
>a startup script to the system startup files (typically rc.local or a file
>in an rc.N directory). But this will start the prgram as root.
>What I want is to start the program as a normal user (e.g. ross).
>How could I do that?[/color]
man su
su ross -c "command to execute"
Re: How to Start Program at Boot-Time as Normal User
On Fri, 06 Oct 2006 13:53:23 -0400, Ross wrote:
[color=blue]
> Hi there,
> As we know, if I want to start a program after a system reboot, I Could add
> a startup script to the system startup files (typically rc.local or a file
> in an rc.N directory). But this will start the prgram as root.
> What I want is to start the program as a normal user (e.g. ross).
> How could I do that?
> Thanks in advance,
> Ross[/color]
"sudo -u username" can be used for this.
Re: How to Start Program at Boot-Time as Normal User
On Mon, 09 Oct 2006 00:43:04 -0500, Vaxius <vaxius@nowhere.net> wrote:
| On Fri, 06 Oct 2006 13:53:23 -0400, Ross wrote:
|
|> Hi there,
|> As we know, if I want to start a program after a system reboot, I Could add
|> a startup script to the system startup files (typically rc.local or a file
|> in an rc.N directory). But this will start the prgram as root.
|> What I want is to start the program as a normal user (e.g. ross).
|> How could I do that?
|> Thanks in advance,
|> Ross
|
| "sudo -u username" can be used for this.
This is root becoming another user, so I think that plain "su" would be
more appropriate.
su username -c command_to_execute command_options
--
Reverend Paul Colquhoun, ULC. [url]http://andor.dropbear.id.au/~paulcol[/url]
Asking for technical help in newsgroups? Read this first:
[url]http://catb.org/~esr/faqs/smart-questions.html#intro[/url]
Re: How to Start Program at Boot-Time as Normal User
On Mon, 09 Oct 2006 07:09:04 +0000, Paul Colquhoun had the audacity to
write:
[color=blue]
> On Mon, 09 Oct 2006 00:43:04 -0500, Vaxius <vaxius@nowhere.net> wrote:
> | On Fri, 06 Oct 2006 13:53:23 -0400, Ross wrote:
> |[/color]
- - - - - - - %< - - - - -[color=blue]
> |
> | "sudo -u username" can be used for this.
>
>
> This is root becoming another user, so I think that plain "su" would be
> more appropriate.
>
> su username -c command_to_execute command_options[/color]
The little minus-sign has some significance after all.
IME:
su <user> logs you in as <user> and drops you where you might be
situated in the file-tree at the time of command.
su -<user> logs you in at the home directory of <user> period!
This can have some noticeable differences in some cases!
If I'm not totally mistaken, it also has some significant influence on
what environment you inherit...
--
Jan, OZ1DKE.
Crossposting reduced...
Re: How to Start Program at Boot-Time as Normal User
On Mon, 09 Oct 2006 07:09:04 +0000, Paul Colquhoun wrote:
[color=blue]
> On Mon, 09 Oct 2006 00:43:04 -0500, Vaxius <vaxius@nowhere.net> wrote:
> | On Fri, 06 Oct 2006 13:53:23 -0400, Ross wrote:
> |
> |> Hi there,
> |> As we know, if I want to start a program after a system reboot, I Could add
> |> a startup script to the system startup files (typically rc.local or a file
> |> in an rc.N directory). But this will start the prgram as root.
> |> What I want is to start the program as a normal user (e.g. ross).
> |> How could I do that?
> |> Thanks in advance,
> |> Ross
> |
> | "sudo -u username" can be used for this.
>
>
> This is root becoming another user, so I think that plain "su" would be
> more appropriate.
>
> su username -c command_to_execute command_options[/color]
Oops, guess I made a noobish mistake *flogs himself*, although I was
falling asleep while writing it. Thanks for the correction.
Re: How to Start Program at Boot-Time as Normal User
On 2006-10-09, Jan Sevelsted wrote:[color=blue]
> On Mon, 09 Oct 2006 07:09:04 +0000, Paul Colquhoun had the audacity to
> write:
>[color=green]
>> On Mon, 09 Oct 2006 00:43:04 -0500, Vaxius <vaxius@nowhere.net> wrote:
>> | On Fri, 06 Oct 2006 13:53:23 -0400, Ross wrote:
>> |[/color]
> - - - - - - - %< - - - - -[color=green]
>> |
>> | "sudo -u username" can be used for this.
>>
>>
>> This is root becoming another user, so I think that plain "su" would be
>> more appropriate.
>>
>> su username -c command_to_execute command_options[/color]
>
> The little minus-sign has some significance after all.
> IME:
> su <user> logs you in as <user> and drops you where you might be
> situated in the file-tree at the time of command.
> su -<user> logs you in at the home directory of <user> period!
> This can have some noticeable differences in some cases![/color]
The latter generates a syntax error; it should be:
su - <user>
[color=blue]
> If I'm not totally mistaken, it also has some significant influence on
> what environment you inherit...[/color]
Without the dash, all that is changed is the UID and username;
with it, you are given the user's login environment.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Re: How to Start Program at Boot-Time as Normal User
Ross enlightened us comp.os.linux-(ab)users with:
[color=blue]
> Hi there,
> As we know, if I want to start a program after a system reboot, I
> Could add a startup script to the system startup files (typically
> rc.local or a file in an rc.N directory). But this will start the
> prgram as root. What I want is to start the program as a normal user
> (e.g. ross). How could I do that?[/color]
Another alternative to su examples would be fcron and fcrontab. It does
not only allow time-driven events, but specifications like "once on
startup".
--
vista policy violation: Microsoft optical mouse found penguin patterns
on mousepad. Partition scan in progress to remove offending
incompatible products. Reactivate MS software.
Linux 2.6.17-mm1,Xorg7.1/nvidia [LinuxCounter#295241,ICQ#4918962]