Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

checkUserIsSuperUser aborting archive.sh #1699

Closed
anonymous-piwik-user opened this Issue · 11 comments

3 participants

@anonymous-piwik-user

Initial Ticket was closed without chance to correct initial report.

The last two errors from the referenced bug report were just other examples of issues that were showing up. I know we can change the script and the user which is needed to work. However even after bash is installed and the script is run as root using bash there is still the initial error from the previous bug report when running the script.

Error:
Using /usr/local/bin/bash misc/cron/archive.sh
""
Starting Piwik reports archiving...
Reports archiving finished. Starting Scheduled tasks...
Error: You can't access this resource as it requires a 'superuser' access.Finished Scheduled tasks.""

It is not running any reports at all. There are about 12 websites in there. Its just throwing errors about access. Is there a cause for this that I am missing?

@robocoder

Sorry, looks like I jumped the gun.

I can't reproduce the initial error. In core/Access.php's checkUserIsSuperUser(), can you replace the method with this ... maybe it'll tell us where the privilege check is occurring.

        public function checkUserIsSuperUser()
        {
                if(!$this->isSuperUser())
                {
                        debug_print_backtrace();
                        throw new Piwik_Access_NoAccessException(Piwik_TranslateException('General_ExceptionPrivilege', array("'superuser'")));
                }
        }
@anonymous-piwik-user

I changed the code to match and here is the output.
####
Using sh it is throwing this message:

sh misc/cron/archive.sh
Starting Piwik reports archiving...

Reports archiving finished.
Starting Scheduled tasks...

#0 Piwik_Access->checkUserIsSuperUser() called at [/usr/local/www/piwik/core/Piwik.php:1233]
#1 Piwik::checkUserIsSuperUser() called at [/usr/local/www/piwik/plugins/CoreAdminHome/API.php:36]
#2 Piwik_CoreAdminHome_API->runScheduledTasks()
#3 call_user_func_array(Array ([=> Piwik_CoreAdminHome_API Object (),1 => runScheduledTasks), Array ()) called at [/usr/local/www/piwik/core/API/Proxy.php:151]
#4 Piwik_API_Proxy->call(Piwik_CoreAdminHome_API, runScheduledTasks, Array ([=> 7a9205a66ed1cb755f1b52356ebdc352,-- => ,[=> API,method => CoreAdminHome.runScheduledTasks,[=> csv,convertToUnicode => 0,[=> 50)) called at /usr/local/www/piwik/core/API/Request.php:117
#5 Piwik_API_Request->process() called at [/usr/local/www/piwik/plugins/API/Controller.php:27]
#6 Piwik_API_Controller->index()
#7 call_user_func_array(Array ([=> Piwik_API_Controller Object ( => API,[=> , => ,[=> 0, => ),[=> index), Array ()) called at /usr/local/www/piwik/core/FrontController.php:126
#8 Piwik_FrontController->dispatch() called at [/usr/local/www/piwik/index.php:60]
Error: You can't access this resource as it requires a 'superuser' access.Finished Scheduled tasks.

####
If I use bash -e then it shows this:

bash -e misc/cron/archive.sh
Starting Piwik reports archiving...

Nothing is updated in either case. Very odd. I apologize for the hassle, but this is driving me crazy. :)

Would it be better to attach the output in a separate file?

@anonymous-piwik-user

Attachment: Piwik output on archive.sh run
piwik output.txt

@anonymous-piwik-user

I'm not sure why this is, but the token auth as showing in the above output (7a9205a66ed1cb755f1b52356ebdc352) does not match the token assigned to any user in the system. That exact string does not exist in the database at all.

@anonymous-piwik-user

Well, at the risk of sounding like a idiot I think I figured out the problem. This install is from .04 or 5 that has been continuously upgraded. I noticed on a clean install that it does not allow for spaces in the administrator user name.

I edited the config.ini.php to remove the space from my admin login name on my old install and the script now works as expected.

I can't imagine nobody else has run into this. I must have missed the memo.

Thank you for your help

@mattab
Owner

Someone ran into this issue before which is we now forbid spaces in passord. However we didn't deal with existing SU passords containing spaces (as you were probably only 2 users affected by this..)

@anonymous-piwik-user

In my case it was a space in the user name not the password. In any case, I'm confirming it fixed by removing the space from my user name.

@robocoder

(In [3154]) fixes #1699 - add an update warning if superuser login is no longer a valid format

@mattab
Owner

vipsoft, I thought the issue was also with the SU password containing spaces? The patch deals with username only. thanks:)

@robocoder

matt: even if so, there's no way to determine that since we only save a hash

@mattab
Owner

indeed, thanks for following up

@anonymous-piwik-user anonymous-piwik-user added this to the Piwik 1.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.