Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i can use this command in cron job

 cat /etc/passwd 

its send my an email about all users info
how i can see allowed command? like cat !
can i use service httpd restart? ( i test it and i cant)
so whats command i allowed?
can i copy on other users file? with cp command? how safe /etc/passwd now?
i use cpanel and im just member of that cpanel not admin

share|improve this question
(1) You are asking too many questions within one question. (2) This is not the appropriate forum since you are not the admin - suggest UNIX SE group, (3) for each question, you are going to have to greatly expand the description and provide a lot more information before anybody might help, (4) have you googled for any of this information you desired? – mdpc Jan 3 '13 at 18:35
up vote 1 down vote accepted

All commands on which you have permission, can execute with cron. You need to use full path of command and which depends upon the PATH settings.


/sbin/service http restart will work

share|improve this answer
so all users can stop apache right? – masih arastooyi Jan 3 '13 at 18:15
@masiharastooyi: No. /sbin programs are only allowed for root (usually), and this program wouldn't work from a non-root users crontab. The permission requirements are the same for cron as for normal sessions. – Sven Jan 3 '13 at 18:16
As I said above, all commands on which user have permission can execute the same using cron also. – Suku Jan 3 '13 at 18:17
so where can i see whats command i allowed? or what is default permission for normal user? in cpanel? – masih arastooyi Jan 3 '13 at 18:19
Via cPanel, you can't execute, almost, any commands (other wise you need to have root access). php is a command which you can execute using cPanel. – Suku Jan 3 '13 at 18:23

In principle, you can use all commands in a cron job, but since usually you don't have a full user environment, it's sometimes necessary to give the full path for a command, e.g. like this:

 /sbin/service httpd restart

Also, naturally, you have to consider that not all commands make sense to be run in a cron job, e.g. if they require interactive input from the user.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.