tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* daemon process attached to a user
@ 2002-05-21 10:51 Jaleel Ahmed
  2002-05-23  3:44 ` Summary: " Jaleel Ahmed
  0 siblings, 1 reply; 2+ messages in thread
From: Jaleel Ahmed @ 2002-05-21 10:51 UTC (permalink / raw)


Hi managers
 A programming related question .. i have written a
sockets based server which takes requests from clients
and depending on the requests, forks a process . This
server should run all the time as a daemon. 
 Now this server has to be deployed (init i suppose )
and i want this server to be run attached to a
particular user ,inheriting the environment of that
user. The processes forked ,access database and
populate data. for this purpose the forked processes
should be attached to a particular login.
 I hope i conveyed the problem properly .. it is quite
a simple thing for you all but i couldnt get any thing
on this (attaching the daemon created by init to  a
particuler login )

 Thanks in advance
 

=====
 May Innocence and Joy Prevail 

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Summary: daemon process attached to a user
  2002-05-21 10:51 daemon process attached to a user Jaleel Ahmed
@ 2002-05-23  3:44 ` Jaleel Ahmed
  0 siblings, 0 replies; 2+ messages in thread
From: Jaleel Ahmed @ 2002-05-23  3:44 UTC (permalink / raw)


Hi all
 Thanks to all who responded .. it was quite a simple
thing , i must have read some man pages or documents
before posting a query.
 The original question was

>  A programming related question .. i have written a
> sockets based server which takes requests from
> clients
> and depending on the requests, forks a process .
> This
> server should run all the time as a daemon. 
>  Now this server has to be deployed (init i suppose
> )
> and i want this server to be run attached to a
> particular user ,inheriting the environment of that
> user. The processes forked ,access database and
> populate data. for this purpose the forked processes
> should be attached to a particular login.
>  I hope i conveyed the problem properly .. it is
> quite
> a simple thing for you all but i couldnt get any
> thing
> on this (attaching the daemon created by init to  a
> particuler login )
> 
>  Thanks in advance
>  
> 

The responses are 
 "Stuart Whitby" <swhitby@legato.com>
   Leave the binary in /usr/bin, or wherever.  Create
an rc file which starts the daemon using 
      su - user -c /usr/bin/binary
 and stop by killing the binary (or issuing it a
shutdown).

"Dyer, Steve J." <Steve.Dyer@alcoa.com>

I believe you want to write a bourne shell script that
has a link into 
the
/sbin/rc3.d directory. 

Use a command like this:

# ln -s /usr/myappdir/S99usrapp.sh
/sbin/rc3.d/S99usrapp

Sample S99usrapp.sh below - substitute in your user
and your myapp (the
socket application)

#
# If we're starting up, invoke script with "start"
argument
#
if [ $1 = "start" ]; then
   su - [user]; nohup myapp
fi
#
# If we're shutting down, invoke script with "stop"
argument
#
if [ $1 = "stop" ]; then
#  whatever you want to do when the system is shutting
down
fi


  mcaplin@miami.edu

You'll have to have the daemon do a setuid() and
possibly a setgid().
Since init runs as root, having privilege to change
uid/gid isn't an
issue.  Other-wise, you'd have to have the daemon
owned by root and 
have a
6750 (or similar) permission.

"John Venier" <venier@odin.mdacc.tmc.edu>

/bin/su - <username> -c '<command>'

possibly with nohup in front of it?

Here, <username> should be replaced by the user name
of interest,
linkewise <command> should be replaced by the command
of interest.

"Ann Majeske" <Ann.Majeske@hp.com>

 If all you want to do is fork a process to run as a
specific user you can use the sia_become_user()
routine
followed by setruid().  See the man pages and the
Security manual for more information. 


Thanks again to all
 setuid worked for me
 jaleel










=====
 May Innocence and Joy Prevail 

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-23  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-21 10:51 daemon process attached to a user Jaleel Ahmed
2002-05-23  3:44 ` Summary: " Jaleel Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox