View previous topic :: View next topic |
Author |
Message |
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Sat Dec 14, 2002 2:41 pm Post subject: Running java as UID != 0 from init |
|
|
An Open Source project of mine (LlamaChat, http://www.42llamas.com/LlamaChat/ ) has a server portion and has been in an init script running as root. I woud like this to run as a different user for security reasaons.
/etc/init.d/llamachat Code: | #!/sbin/runscript
depend() {
need net
}
start() {
ebegin "Starting LlamaChat Server"
/home/httpd/htdocs/LlamaChat/server/startServer.sh &
echo $! > /var/run/llamachat.pid
eend $? "Failed to start LlamaChat Server"
}
stop() {
ebegin "Stopping LlamaChat Server"
start-stop-daemon --stop --quiet --pidfile /var/run/llamachat.pid
eend $? "Failed to stop LlamaChat Server"
} |
startServer.sh Code: | #!/bin/bash
cd /home/httpd/htdocs/LlamaChat/server/
exec java -server -jar LlamaChatServer.jar |
Ay help would be greatly appreciated _________________ - Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/ |
|
Back to top |
|
|
ghost_o Tux's lil' helper
Joined: 10 Jul 2002 Posts: 119
|
Posted: Sat Dec 14, 2002 3:05 pm Post subject: |
|
|
You can
Code: |
su <user> -c "command"
|
in the init script to get that effect
-G |
|
Back to top |
|
|
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Sat Dec 14, 2002 9:46 pm Post subject: |
|
|
Is there any other way?
That wont work with my apache user because there is no shell, which is the account i would prefer to use. I tried w/ a user account, but ran into problems of not having java in the path. _________________ - Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/ |
|
Back to top |
|
|
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Sat Dec 14, 2002 10:45 pm Post subject: |
|
|
Thanks ghost_o
I got it working with a regular user. Now I dont have to stay up all night worrying about my possibly insecure server running as root being compremised _________________ - Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/ |
|
Back to top |
|
|
|