{"id":48,"date":"2008-11-24T15:19:25","date_gmt":"2008-11-24T20:19:25","guid":{"rendered":"http:\/\/xux.in\/blog\/?p=48"},"modified":"2021-06-19T19:45:02","modified_gmt":"2021-06-20T01:45:02","slug":"cpanel-535-incorrect-authentication-data","status":"publish","type":"post","link":"http:\/\/xux.in\/blog\/post\/cpanel-535-incorrect-authentication-data\/","title":{"rendered":"cpanel 535 Incorrect authentication data"},"content":{"rendered":"<p>I ran into a small issue when migrating some sites to a <a href=\"http:\/\/www.cpanel.net\">cPanel<\/a> server, tried a few &#8220;tricks&#8221; (\/scripts\/* &#8211;force hehe) without luck till I found a great <a href=\"http:\/\/forums.cpanel.net\/showthread.php?t=66410\">post<\/a> which pointed me the solution, and it is as simple as that!<\/p>\n<p>Since I&#8217;m a very lazy guy, I wrote a tiny script which does what <a href=\"http:\/\/forums.cpanel.net\/showpost.php?p=323248&amp;postcount=3\">Jerry<\/a> (from <a href=\"http:\/\/forums.cpanel.net\">cPanel forums<\/a>) said\/explained. Copy the code, save it and execute it. By default it won&#8217;t do anything but show the directories and files current state and how they should be. If you see something is not as it should be then you should change the $debug var to false in order to allow the script to do the job. After that everything should be fixed and if not don&#8217;t blame me, you can always do that manually \ud83d\ude09<\/p>\n<pre lang=\"php\">#!\/usr\/bin\/php -q\n&lt;?\n\/\/ file: fix_auth_perms.php\n\/\/ turn it off if you want to fix them\n\/\/ based on http:\/\/forums.cpanel.net\/showpost.php?p=323248&amp;postcount=3\n$debug = true;\n\n$maps = file(\"\/etc\/domainusers\");\nif (!is_array($maps)) die(\"No users found!\\n\");\n\nforeach ($maps as $map) {\n  list($user,$domain) = explode(\": \",trim($map));\n  if (!$user || !$domain) continue;\n  echo \"\\nChecking $domain ...\\n\";\n  _file_fix(\"\/home\/$user\/etc\",$user,\"mail\");\n  _file_fix(\"\/home\/$user\/etc\/$domain\",$user,\"mail\");\n  _file_fix(\"\/home\/$user\/etc\/$domain\/shadow\",\"\",\"mail\",\"0640\");\n  \/\/exit;\n}\n\n\/\/ $file = full dir\/file path\n\/\/ $nuser = desired user name\n\/\/ $ngroup = desired group name\n\/\/ $perms = desired permissions in octal mode (0640)\nfunction _file_fix($file=\"\",$nuser=\"\",$ngroup=\"\",$perms=\"\") {\n  global $debug;\n  $uname_array = posix_getpwuid(fileowner($file));\n  $gname_array = posix_getgrgid(filegroup($file));\n  $file_perms = substr(sprintf('%o', fileperms($file)), -4);\n  echo \"  $file owned by $uname_array[name].$gname_array[name] ($file_perms)\\n\";\n    \/\/wrong ownership, fixing it now!\n  if (!$debug) {\n    if ($nuser &amp;&amp; $nuser != $uname_array[name]) {\n      if (!chown($file, $uname_array[name])) echo \"  couldn't change file owner to $nuser\\n\";\n      else echo \"  changed file owner to $nuser\\n\";\n    }\n    if ($ngroup &amp;&amp; $ngroup != $gname_array[name]) {\n      if (!chgrp($file, $gname_array[name])) echo \"  couldn't change group owner to $ngroup\\n\";\n      else echo \"  changed group owner to $ngroup\\n\";\n    }\n  }\n  if ($perms &amp;&amp; $perms != $file_perms) {\n    if (!$debug) {\n      if (!chmod($file,octdec($perms))) echo \"  couldn't change file mode to $perms\\n\";\n      else echo \"  changed file mode to $perms\\n\";\n    }\n  }\n  \/\/making a nice output :P\n  if (!$nuser) $nuser = $uname_array[name];\n  if (!$ngroup) $ngroup = $gname_array[name];\n  if (!$perms) $perms = $file_perms;\n  echo \"  $file should now be owned by $nuser.$ngroup ($perms)\\n\";\n}\n\n?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I ran into a small issue when migrating some sites to a cPanel server, tried a few &#8220;tricks&#8221; (\/scripts\/* &#8211;force hehe) without luck till I found a great post which pointed me the solution, and it is as simple as that! Since I&#8217;m a very lazy guy, I wrote a tiny script which does what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,8,1,5],"tags":[13,27,33,15,16],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-code","category-linux","category-lostfound","category-software","tag-centos","tag-cpanel","tag-linux","tag-php","tag-snippet"],"_links":{"self":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":3,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":150,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions\/150"}],"wp:attachment":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}