Does anyone know how to run a startup script as user nobody? I always
get confused with how to set chown, chgrp, and chmod.
Im trying to run a Catalina 4.0.3 startup script as nobody using RH7.2.
I've read that the startup scripts should NOT be executed as root.
My startup script is in /etc/rc.d/init.d/ under the filename catalina.
When I execute /etc/rc.d/init.d/cataline restart, I receive the
following message:
Stopping the Catalina Service
This account is currently not available.
Starting the Catalina Service
This account is currently not available.
The error message 'This account is currently not available' comes from
/etc/passwd which executes "/sbin/nologin" for the user's login shell
when my script attemps 'su - nobody -c ...." The nobody entry in
/etc/passwd is:
nobody:x:99:99:Nobody: / : /sbin/nologin
/etc/group filecontains: nobody:x:99:
The startup script below runs fine when I "su - root -c ..." instead of
"su - nobody
-c ...".
The content of the /etc/rc.d/init.d/cataline file is as follows:
--------------------------------------------------
#!/bin/sh
#
# Jakarta-Tomcat 4.0.3 daemon start/stop script.
#
# chkconfig: 5 80 15
# description: Tomcat is a Servlet+JSP Engine
# Source function library
. /etc/rc.d/init.d/functions
export CATALINA_HOME=/usr/local/jakarta-tomcat-4.0.3-LE-jdk14
export JAVA_HOME=/usr/local/java/j2sdk1.4.0
case "$1" in
# Start Daemon
'start')
if [ -f $CATALINA_HOME/bin/startup.sh ]; then
echo "Starting the Catalina Service "
su - nobody -c "$CATALINA_HOME/bin/startup.sh"
fi
;;
# Stop Daemon.
'stop')
if [ -f $CATALINA_HOME/bin/shutdown.sh ]; then
echo "Stopping the Catalina Service "
su - nobody -c "$CATALINA_HOME/bin/shutdown.sh"
fi
;;
'restart')
$0 stop
$0 start
;;
*)
# usage
echo "Usage: $0 {start|stop|restart}"
;;
esac
exit 0
------------------------------------
I also did the following changes:
chmod -R nobody.nobody $CATALINA/logs
chmod -R nobody.nobody $CATALINA/webapps
chmod -R nobody.nobody $CATALINA/work
The directory structure for $CATALINA is as follows:
drwxr-xr-x 2 root root 4096 Apr 15 19:42 bin/
drwxr-xr-x 2 root root 4096 Mar 1 18:04 classes/
drwxr-xr-x 4 root root 4096 Mar 1 18:04 common/
drwxr-xr-x 2 root root 4096 Apr 15 20:50 conf/
drwxr-xr-x 2 root root 4096 Apr 15 19:33 downloads/
drwxr-xr-x 2 root root 4096 Apr 4 22:55 lib/
drwxr-xr-x 2 nobody nobody 4096 Apr 15 14:27 logs/
drwxr-xr-x 4 root root 4096 Apr 15 18:58 server/
drwxr-xr-x 7 nobody nobody 4096 Mar 1 18:04 webapps/
drwxr-xr-x 3 nobody nobody 4096 Apr 4 23:05 work/
Does anyone know how to get this script to work as user nobody? Is my
ownership and group incorrect?
MANY THANKS IN ADVANCE!
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>