Wednesday 5 August 2015

CRON job not running marked as UNSAFE - SOLVED

Yesterday I came across strange problem. I created new user on server. Lets call it user12_ABCDE. This user should run certain script periodically for simple FTP transfer. Of course crontab is used. When I run script manually it runs perfectly! When I put it in crontab, nothing happens! I check my  /var/log/messages and find this

Aug  4 16:01:01 server /usr/sbin/cron[27897]: (user12_ABCDE) UNSAFE (user12_ABCDE)

So... I start to google it! On lots of places you can find that it is usually permission issue. I check permission but every thing is OK. 
All other users can run their script in crontab with no problems. UNSAFE error message is only for this user12_ABCDE. 

After some time I run in to this sentence  about cron and UNSAFE

Some O/S restrict the range of characters in a username - some don't. - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpuf
 Some OS restrict the range of character in a username


This put a bug in my ear...
I checked all other user names with this new one. All users have small letters, underscore except this new user that have capital letters in his name. So... I create new user called user12_abcde and try do run crontab. It runs with no problem! Hm... So this cron job not running marked as UNSAFE is only because I have capital letters is my username.  

P.S.
I do not know if this issue is solved on newer Linux distros. I have this issue on SLES 10 kernel 2.6.16.21-0.8-smp.

Some O/S restrict the range of characters in a username - some don't - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpuf
Some O/S restrict the range of characters in a username - some don't - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpufSom
Some O/S restrict the range of characters in a username - some don't. - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpuf
Some O/S restrict the range of characters in a username - some don't. - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpuf
Some O/S restrict the range of characters in a username - some don't. - See more at: http://compgroups.net/comp.unix.admin/cron-fails-with-unsafe-in-log/51152#sthash.mUlmf92A.dpuf