Problem with logs.php - script change ownership of user webs to root:root

Discussion in 'Installation/Configuration' started by SupuS, Feb 25, 2011.

  1. SupuS

    SupuS Member HowtoForge Supporter

    Hi all,

    today my logs.php script change ownership of all directories and files in /var/www to root:root. It did even more. It created 18 directories in /var/www and 2 in /root with weird names as:

    Code:
    drwxr-xr-x  2 root root 4096 Feb 25 00:30 ?@
    drwxr-xr-x  2 root root 4096 Feb 25 00:30 ?y?????b??n6?Jc+???`??S?K
    drwxr-xr-x  3 root root 4096 Feb 25 00:30 ???W?s??iq?_Cp??c??%?????-Z?-?
    I don't know where is the problem. Script is from original installation and it worked well until today midnight.

    For this time I can remove logs.php from crontab but it is not optimal solution.

    I can partialy repair wrong permissions as till suggested in this post but group of files didn't repair and it is still set to root.

    Question 1) Is there way how to change ownership to proper group?

    Question 2) How I can fix the logs.php? I didn't do anything unusual. I only restored web from another ispconfig box on this server.

    If I run this script it create weird directories and I get a lot of Warning messages:

    Code:
    # /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php
    
    Warning: fopen(/var/www/): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/ŇďŠ3IěaŐRdľŔĂzĽŹÝę>fOáǡ˙): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/y¤äb    n6Jc+Ë`SÍK): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    ČŕűT▒ÇAZ'r): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/1ĆsJ ▒3NĆ8ČĽ
                                        ÇĽ): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/Ösł2Ţ_HĆ9í-Ă´
                                         ćRʧgcqXw?Űi§C▒Yřň?Ú?ĐWNlľAup16ŮvFĆŢáOJć<Cą@ŽćSĺ4ĐÔÉÚľÜOŠ¤zŘ4)ŐZMî§Ô): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/ĎńŚ[éw÷sH°/1ř*Şřvŕi?o▒ĆŔKXÓ,"đOm)ŕaÂÜúT4ľßŠŹŚpOcH
                                                                             WťóëUľÝsM˝Xî**
                                                                                           SŽË`=ý˙): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/Ümfůöş˙): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/@): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/Đ"+ÄŰČúć°|cŹxrËOEđÜeÄMrÇ%ąŘRSćŃ88ť˝ÎQu;ľÓ´víEĆŤy2mga×ńYýz▒@éU{29şv▒gjEáĎçU˛Oj_Ć.*Éěiďv¸úÖxŽijyP&]îůŘG=ŤCíđm): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/;ŘeĘ÷ĄyěQsž6>Ő4r-v^vŻ_z^DXíP}2ińę<ír0pzqvĐM6HŤ&2IůTž): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/褴a5ˇÔH,wąîÇ5ÍxÇYJ76Wńj¸?ÂŮŕőëíI˘°ó÷*ÜŠ{ĽxuŰöâĐĎ
                                                                             {ä^yă˝cMłÁWaeÜACËůÖľćŠUă¸Ö!űGŘqćűĽe
    &óMÔ´űSŻŁKrťĂ.AQéŽ4â)¸7zż$hv2e>wüj=Ť]Ĺ*×pŢšň69): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92jĂęöi1sqOOZĎł´yu;ťKKLv       ;çżçR
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/ă|WoŚÉm▒o2ăaťˇţËźţŔř^<e×ýY): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File name too long in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/=j[dĚŤĎz`
                                     WôČŁ$<vŠ˛{@rk¤đžZÓÍFÚ[Ż5ĎKĺźĘ\WSb-Ń|°▒wškßDŇ6Ň@ż++v¨dĚľlçŽG?*G;Tßj(2šmť6ťěO
                                                                                                                aŔýŮ_ĆŚ6˛`ěvOűACmh$ĎáR
                                                                                                                                      ¸ß-ă\Źw,
                                                                                                                                              [ąüyĽŮ:d´EřÇÔ^K\ąŠí}Ň▒V}Âë°őq]~ľ79_ăëU˘2Ă!>Ă4äÔţyÉN.Úh°\`eńČĹH!ĎßüŞźF#ý`Ćh7
    ¸áxŁ˝Bń,ŹPěů"▒Š+U>ÚÖ6ü)ĎŠFŮb˛u;OÔ[Bş-ÎČ): failed to open stream: File name too long in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/Ř<7ePţUüŔą-˛Ć9ĺŔ§ĽáŘ.Ŕ/ć!Ď2Weńn): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/íČăÓ˙): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: mkdir(): File exists in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    
    Warning: fopen(/var/www/M9ŹČt;  _Ä÷§ZĎŚY*ÔO     y;d ý=TŇŻuÓçł[6¸ľD9_ÄT-
                                                                           j÷ů/$▒MŐťi÷ d:qľbCŽ[č{ kyíÜňłĘő˙): failed to open stream: Is a directory in /root/ispconfig/scripts/shell/logs.php on line 92
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: fclose(): supplied argument is not a valid stream resource in /root/ispconfig/scripts/shell/logs.php on line 108
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/\322\215\357\2513I\354a\004\325R\025d\265\004\006\300\303\003\237z\245\254\335\352': No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: unexpected EOF while looking for matching ``'
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: unexpected EOF while looking for matching ``'
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/1\306sJ\005': No such file or directory
    chown: cannot access `\032\024\0363N\3068\310\245\v\307\245': No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: syntax error near unexpected token `)'
    sh: -c: line 0: `chown -R root:root /var/www/Ösł2Ţ_HĆ9í-Ă´
                                                              ćRʧgcqXw?Űi§C▒Yřň?Ú?ĐWNlľAup16ŮvFĆŢáOJć<Cą@ŽćSĺ4ĐÔÉÚľÜOŠ¤zŘ4)ŐZMî§Ô'
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/l\343W0.4\031\017\205\222\366\373YRY\263\345\260-\371': No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: unexpected EOF while looking for matching ``'
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: unexpected EOF while looking for matching `"'
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/\232': No such file or directory
    sh: 2IůTž: command not found
    sh: ír0pzqvĐM6HŤ: No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: unexpected EOF while looking for matching `''
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: e×ýY: No such file or directory
    chown: cannot access `/var/www/\343': No such file or directory
    
    Warning: readlink(): File name too long in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: mkdir(): File name too long in /root/ispconfig/scripts/lib/classes/ispconfig_file.lib.php on line 175
    sh: -c: line 0: unexpected EOF while looking for matching ``'
    sh: -c: line 1: syntax error: unexpected end of file
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: 7ePţUüŔą-˛Ć9ĺŔ§ĽáŘ.Ŕ/ć!Ď2Weńn: No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/\226\365\022W\356s\266\023iq\331_Cp\251\347c\021\356%\211\366\a\024\353-Z\332-': No such file or directory
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    chown: cannot access `/var/www/M9\254\310\022t': No such file or directory
    sh: _Ä÷§ZĎŚY*ÔO: command not found
    sh: d: command not found
    
    Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125
    sh: -c: line 0: syntax error near unexpected token `)'
    sh: -c: line 0: `chown -R root:root /var/www/ńŠíłu4fbI@HcŮĹ}-đÚĆkŔşMĹĚjć5)řćwww.piercingstyle.cz/log &> /dev/null'
    
    Warning: asort() expects parameter 1 to be array, null given in /root/ispconfig/scripts/shell/logs.php on line 172
    
    Warning: Invalid argument supplied for foreach() in /root/ispconfig/scripts/shell/logs.php on line 173
    Any help welcome.

    SupuS
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you change the log format of Apache's access log?

    What's the output of
    Code:
    ls -la /var/www/
    ?
     
  3. SupuS

    SupuS Member HowtoForge Supporter

    Hi falko,

    I didn't change log format. On this box is Ubuntu 9.10 and it is production server so I don't test any new features on this server only standard upgrades and new hostings through ISPConfig.

    Output of ls -la /var/www/ is:

    Code:
    # ls -la /var/www/
    total 744
    drwxr-xr-x 181 root                root 20480 Feb 25 12:24 .
    drwxr-xr-x  17 root                root  4096 Aug 17  2010 ..
    -rw-r--r--   1 root                root    45 Oct 31  2009 index.html
    drwxr-xr-x   3 root                root  4096 Nov  2  2009 localhost
    drwxr-xr-x   2 root                root  4096 Oct 31  2009 sharedip
    drwxr-xr-x   9 zs10username         root  4096 Feb 25 02:18 web10
    drwxr-xr-x   9 zs100username          root  4096 Feb 25 02:19 web100
    drwxr-xr-x  10 zs102username      root  4096 Feb 25 02:19 web102
    drwxr-xr-x   9 zs103username       root  4096 Feb 25 02:19 web103
    ....
    ....
    ....
    lrwxrwxrwx   1 root                root    14 Jun  1  2010 www.domain.tld -> /var/www/web65
    lrwxrwxrwx   1 root                root    14 Jul 18  2010 www.domain.tld -> /var/www/web78
    lrwxrwxrwx   1 root                root    14 Dec 13  2009 www.domain.tld -> /var/www/web28
    lrwxrwxrwx   1 root                root    14 Jul 11  2010 www.domain.tld -> /var/www/web74
    lrwxrwxrwx   1 root                root    14 Jan 17  2010 www.domain.tld -> /var/www/web49
    ....
    ....
    ....
    users web is now owned by regular users thanks to til post as I wrote in previous post but after last logs.php run all was owned by root. I also removed directories with "strange" names.

    SupuS
     
    Last edited: Feb 25, 2011
  4. falko

    falko Super Moderator Howtoforge Staff

    Can you check if you have these two lines in your Apache configuration?

    Code:
    LogFormat "%v||||%b||||%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig
    CustomLog "|/root/ispconfig/cronolog --symlink=/var/log/httpd/ispconfig_access_log /var/log/httpd/ispconfig_access_log_%Y_%m_%d" combined_ispconfig
    Did you update Apache recently? Maybe it has something to do with such an update...
     
  5. SupuS

    SupuS Member HowtoForge Supporter

    Yes these lines are in apache2.conf. Last upgrade of apache was at the last year so I don't think it is related.
     
    Last edited: Feb 26, 2011
  6. SupuS

    SupuS Member HowtoForge Supporter

    I reenabled logs.php and it works fine. I suppose there was problem in log file but log files are about 500 MB size so I don't know where exactly.

    Now remain only one problem and it is wrong group permission on clients directories and files. Group permissions are set to root but it should be set to clients group permission.

    Is there the way to do it automaticaly through ISPConfig?

    Thanks for help.

    Edit: a used script from this post so my problem is solved.

    SupuS
     
    Last edited: Mar 11, 2011

Share This Page