Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User not recognized #282

Closed
50Wliu opened this issue Jan 29, 2015 · 8 comments
Closed

User not recognized #282

50Wliu opened this issue Jan 29, 2015 · 8 comments

Comments

@50Wliu
Copy link

50Wliu commented Jan 29, 2015

I edited /etc/msm.conf to change the default user to "mcservers" and all the default paths to point to /home/mcservers instead of /opt/msm (the moving directories does not apply specifically to this problem-it occurs regardless of where the server folders are located). Now the problem is whenever I try to execute a command (such as, let's say, msm server create example), the following gets outputted:

Creating server directory... This command must be executed as the user "" or "root".

Yet the command still executes. This is the part that really confuses me. I took a quick peek at the source code, and whoami returns mcservers as expected. It looks like MSM isn't detecting my custom username in the config correctly.
USERNAME="mcservers" and DEFAULT_USERNAME="mcservers".
If you need the entire config file let me know.

@ormanya
Copy link

ormanya commented Feb 16, 2015

I am having the same problem using Minecraft Server Manager 0.8.16 Beta

@ghandye
Copy link

ghandye commented Jul 18, 2015

I've been a MSM user for about 2 hours now, and just encountered this problem and found this issue via Google.

Looking through the code, this is a (mostly cosmetic) bug in 0.8.16 in line 1217 of the main msm script. To fix, open etc/init.d/msm in a text editor and change line 1217 from this:

as_user "$USERNAME" "echo \"MSM requires all your worlds be moved into this directory.\" > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WORLD_STORAGE_PATH/readme.txt'"

to this:

as_user "$SETTINGS_USERNAME" "echo \"MSM requires all your worlds be moved into this directory.\" > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WORLD_STORAGE_PATH/readme.txt'"

The error you see is actually coming from the as_user function. This function compares the value passed to it (in this case, the erroneously empty variable $USERNAME instead of the properly populated $SETTINGS_USERNAME) with the output from 'whoami' and triggers this error if the two don't match (line 92):

error_exit INVALID_USER "This command must be executed as the user \"$1\" or \"root\"."

This bug simply prevents some text guidance from being displayed to the end user (about MSM requiring worlds to be moved into a certain directory). It doesn't affect the actual functionality of the created server.

@renderorange
Copy link
Contributor

@ghandye - Thanks for commenting. If you wouldn't mind creating a pull request for this, I'd be happy to test and approve your commit. I should have time to do this tomorrow either way, if you don't have time to create the pull request. Thanks again.

@ghandye
Copy link

ghandye commented Jul 19, 2015

Thanks! I have to confess that I have never contributed to a project via
git pull request before - I think this is a good learning opportunity to
figure that out, but I doubt I'll beat you to it!

-Andy

On Sat, Jul 18, 2015 at 2:56 PM, Blaine Motsinger notifications@github.com
wrote:

@ghandye https://github.com/ghandye - Thanks for commenting. If you
wouldn't mind creating a pull request for this, I'd be happy to test and
approve your commit. I should have time to do this tomorrow either way, if
you don't have time to create the pull request. Thanks again.


Reply to this email directly or view it on GitHub
#282 (comment).

@renderorange
Copy link
Contributor

@ghandye - I did a bit of research this evening into this. It appears this issue was previously addressed and can be seen in the following:
https://github.com/msmhq/msm/blob/master/init/msm#L1218
My apologies for not catching this before. This evening, I pushed a new version to the latest tag, which contained a number of commits since early 2013.
I do hope you continue to contribute to this project, both issues or changes via pull request.

@ghandye
Copy link

ghandye commented Jul 20, 2015

I see the fix in master (on line 1308 now, but things do change).

I think I've figured out git fork/pull for next time. Thanks!

@renderorange
Copy link
Contributor

My apologies on the link, L1308 is the correct one.

@50Wliu
Copy link
Author

50Wliu commented Jul 20, 2015

Closing this then since it seems to be fixed ✨.

@50Wliu 50Wliu closed this as completed Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants