SUMMARY -su to user id from a script

From: Mark_Conroy@em.fcnbd.com
Date: Wed Jan 27 1999 - 14:51:15 CST


Mark Conroy
01/27/99 12:57 PM

Subject: SUMMARY -su to user id from a script

To the billions who have replied. - THANKS.

The overwhellming response - about 99% was:

To su to a user id from a script:

su - <username> -c <command>

And this works - TWO good. I say TWO because it will startup two
processes. under my userid.

I created a link in /etc/rc3.d called S99test, and it points to my script
in my home directory called /home/mconroy/mytest. I reboot the system, and
issue a ps -ef | grep mconroy and see two "mytest" jobs running:
one is running /bin/sh /home/mconroy/mytest
one is running -sh -c /home/mocnroy/mytest

The link in /etc/rc3.d is just a link with nothing else. The job in
/home/mconroy is:

#!/bin/sh
command
command
command

I am not sure where the process -sh -c /home/mconroy/mytest is coming from.
Thanks again.

Mark Conroy

---------------------- Forwarded by Mark Conroy/IL/CDN on 01/27/99 12:41 PM
---------------------------

From: <mark_conroy@em.fcnbd.com> AT INTERNET on 01/22/99 02:33 PM

To: <sun-managers@sunmanagers.ececs.uc.edu> AT INTERNET@ccmail
cc: (bcc: Mark Conroy/IL/CDN)
Subject: su to user id from a script

question for the group,

I want to set up a link in /etc/rc3.d to point to a users home directory to
run a job when the system boots up. However, the job starts up, but is
owned by root. I need to have the user the owner. I have tried,
unsuccessfully, setting
a script that will su to
the user id, then run the job. Does the job need to be located in
/etc/init.d or can it be run from the users home directory.

I am running solaris 2.6 on a sparc 1000.

Any thoughts would be appreciated.

Mark Conroy





This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:14 CDT