superjamie / minecraft-init-script

An initscript to start Minecraft or CraftBukkit on CentOS, Fedora, and Ubuntu
GNU General Public License v3.0
65 stars 31 forks source link

Password Twenty Times For Commands? #30

Closed ghost closed 10 years ago

ghost commented 10 years ago

This init script works really nice, except I can't open up the console. I do "minecraft console" and I get in return "Cannot open your terminal '/dev/pts/0' - please check." Is this me or the script?

It also seems to make me type in my password so many times for any command, but that might be my fault.

ghost commented 10 years ago

I fixed that issue and it works fine for me exept that every time I leave SSH and come back, I have to type the command that makes it work, but I can deal with it for now I guess... I just still don't know why I have to type my password so many times for any command on this script.

Backups seem to not work because of this issue. (Permission Being Denied)

EDIT: I think the cause is because of the visudo edit. The one you provided doesn't work, I looked on google and used "minecraft ALL=(ALL) NOPASSWD: /etc/init.d/minecraft" and that doesn't work either. (And my user instead of bukkit is minecraft because im running a vanilla server.) I still have no clue how to fix this. :(

superjamie commented 10 years ago

I think I will put the /dev/pts/0 thing into the readme. As you can see, this isn't the first time that question has come up.

I agree with the rest, it sounds like a sudo thing. What distro are you using? Are you logged in as your minecraft user when you're doing this, or are you logged in as another user like logan? You'll need to be either root or the minecraft user.

You could also try running the script itself as root insted by using sudo service minecraft start or actually becoming the root user (su - or sudo su -) then running service minecraft start.

ghost commented 10 years ago

Ubuntu 14.04.1

Yes I am logged in as the user "logan" and the script runs under "minecraft". There is another account called "teamspeak3" but that shouldn't mean anything.

I'll try those out.

superjamie commented 10 years ago

The script is not designed to be run directly from a third account, like logan. You can run it as root, or you can run it as minecraft. Though I expect you'll be able to run it from logan by using sudo service minecraft start and so on.

ghost commented 10 years ago

"sudo service" makes it so I don't have to type my password every time, but it still can't make a backup because of permission being denied.

My server doesn't like me. :(

superjamie commented 10 years ago

Try running as either root or the minecraft user. You might get backups working from your logan account by running sudo chmod -R ugo+rw /home/minecraft (ie: allow all other users of the system to access minecraft's home directory) but this is definitely not the way to run a secure system.

ghost commented 10 years ago

Ok thanks, that made it work! Thanks for the awesome script and your help with this!

I am learning from this script and creating my own version of this because for some reason I have an interest in this...

superjamie commented 10 years ago

No worries, having a try yourself and learning is what open source is all about :)

Here's a couple of links you might find useful for bash scripting:

For init scripts in particular:

And if you want to learn more about Linux, such as the permission thing we talked about above, start with the concepts outlined in the Red Hat Certified System Administrator certification. Here's some blogger's study guide to that cert.

Enjoy!