mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.

Home Page:https://mailinabox.email/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

owncloud-unlockadmin.sh has incorrect path for mail.py

goop32 opened this issue · comments

I was trying to unlock the Nextcloud admin when I kept running into an error:

root@box:~/mailinabox/tools# ./owncloud-unlockadmin.sh
./mail.py: line 3: management/cli.py: No such file or directory
I am going to unlock admin features for .
You can provide another user to unlock as the first argument of this script.

WARNING: you could break mail-in-a-box when fiddling around with Nextcloud's admin interface
If in doubt, press CTRL-C to cancel.

Press enter to continue.

Not enough arguments (missing: "user").

group:adduser

When mail.py tried to use cli.py, it kept saying there was no such file or directory and wouldn't find my email address. I opened it up and found the path is incorrect and should have a ../ at the beginning. The "management" folder is not kept inside of the tools directory and therefore will not launch the correct script. I fixed this by making it use the path to the file (/root/mailinabox/management/cli.py in my case) but there's probably a better way to do that.

All of the scripts are meant to be launched from the parent directory. From there, it works fine.

You mean run it from /root/mailinabox (parent directory) and do ./tools/owncloud-unlockadmin.sh? That still isn't working for me.
Screenshot 2024-03-21 at 16 49 11

Ah ok the error is in owncloud-unlockadmin.sh then. Thanks, yeah, that's a bug.

I wasn't able to quickly figure out how to variablize the path, so I used $PWD because I saw it was used elsewhere:

ADMIN=$($PWD/mailinabox/tools/mail.py user admins | head -n 1)

and...

$PWD/mailinabox/management/cli.py "$@"

If that's acceptable I'll put together a PR (but I also suspect there must be a better way.)

Confirmed working on latest update, closing.