Monit runs with root, but i don't want to start my processes as root.. like mysql, mongrel, apache..
Asked
Active
Viewed 2.7k times
4 Answers
61
check process tomcat with pidfile /var/run/tomcat.pid
start program = "/etc/init.d/tomcat start"
as uid nobody and gid nobody
stop program = "/etc/init.d/tomcat stop"
# You can also use id numbers instead and write:
as uid 99 and with gid 99
if failed port 8080 then restart
![](../../users/profiles/5724.webp)
crb
- 7,928
- 37
- 53
1
i have found a answer.. i could do a: start_program = "su -c 'command here' USERiWANTtoUSE".. :)
![](../../users/profiles/15619.webp)
Guilherme
- 711
- 2
- 7
- 8
-
2or can use a option 'as uid USERNAME and gid GROUPNAME'. For ex: start_program = "command" as uid USER and gid GROUPNAME – Guilherme Aug 05 '09 at 21:40
-
3it's better if you edit your answers with this information. – shingara Apr 07 '10 at 13:05
0
You can do this to run as another user a specific command
exec /bin/su - userName -c "/usr/bin/nginx start"
This will run that command " "
as the user you defined
![](../../users/profiles/226504.webp)
Pian0_M4n
- 178
- 1
- 6
-1
What operating system / distro are you using? How did you install Monit? Most dsitros 'do the right thing' and make sure things don't start as root.
![](../../users/profiles/8950.webp)
Amandasaurus
- 30,211
- 62
- 184
- 246
-
i'm using debian sarge.. i've installed with apt-get.. i don't think monit can be started as other user than root.. by the way it can?.. :) – Guilherme Aug 07 '09 at 15:18
-