greatmercy
October 9th, 2008, 07:20 AM
Hi,
Am setting up a server to run tomcat automatically at startup. Can do this no problem, but tomcat runs as root.
Am told by the apache community that running tomcat as root is a 'very bad idea' in case it were to get compromised. Also, if i'm not listening on a port below 1024 (and I'm not), then there really is no need to run tomcat with such high privileges.
So, I've set my init script to call tomcat with:
su - myaccount - c "sh tomcat/bin/startup.sh"
When I run the script myself, as sudo, it works fine. But, when running at boot up it doesn't. Why not? I guess because it needs the password for myaccount, and no-one's there to type it in.
Is there a way around this? Or another way to start tomcat with lesser privileges? Or shouldn't I care?
Many thanks,
Am setting up a server to run tomcat automatically at startup. Can do this no problem, but tomcat runs as root.
Am told by the apache community that running tomcat as root is a 'very bad idea' in case it were to get compromised. Also, if i'm not listening on a port below 1024 (and I'm not), then there really is no need to run tomcat with such high privileges.
So, I've set my init script to call tomcat with:
su - myaccount - c "sh tomcat/bin/startup.sh"
When I run the script myself, as sudo, it works fine. But, when running at boot up it doesn't. Why not? I guess because it needs the password for myaccount, and no-one's there to type it in.
Is there a way around this? Or another way to start tomcat with lesser privileges? Or shouldn't I care?
Many thanks,