Menu

"KeyError: 'getpwnam(): name not found: dchu"

Help
William
2005-06-17
2013-03-27
  • William

    William - 2005-06-17

    Hi, I just downloaded Py-DCHub, read the readme and tried to install it. So, like the readme said, I typed in "python DCHub.py" in the terminal. It didn't work. This is the log of the terminal;

    "tsuki@meatball:~/py-dchub-0.2.0 $ python DCHub.py
    Traceback (most recent call last):
      File "DCHub.py", line 2024, in ?
        run()
      File "DCHub.py", line 2010, in run
        dchub = Hub(**options)
      File "DCHub.py", line 236, in __init__
        self.setuphub()
      File "DCHub.py", line 1024, in setuphub
        self.unixconfig()
      File "DCHub.py", line 1156, in unixconfig
        self.uid = pwd.getpwnam(self.username)[2]
    KeyError: 'getpwnam(): name not found: dchub'"

    Any idea of what could be wrong?

     
    • Jeremy Evans

      Jeremy Evans - 2005-06-17

      My guess is that the account dchub does not exist on the system.  To fix this, you should create a system account named dchub and invoke the hub as root (it'll chroot and drop privileges by default). 

      Alternatively, you can set changeuidgid in the conf file to 0, and the hub with the same privileges of the user who invoked it (you'll need to change the port to above 1024 if you are running as non root).  I'd recommend creating the system account though, as that is the most secure method.

      This should have been documented in the README.  Also, since this is a potentially common mistake, I should probably catch the exception and print a more intelligent error message.  There's also a bug where it will still attempt to change users even if it is not invoked as root (which will fail with a slightly different traceback).   I'll make sure to fix these issues before the release of the next version.  Thanks for alerting me.

      Please post and let me know if that fixes the problem.  Thanks.

       
    • William

      William - 2005-06-19

      Thanks, it's working now.

      But I have another, question, how the hell do you reload the settings? I can't find any information about that.

       
    • Jeremy Evans

      Jeremy Evans - 2005-06-20

      In terms of sending it a signal and having it reload it's configuration file, there isn't a way to do that by default.  If you are running PythonBot, you can use that to change any of the hub settings while it is running.  There isn't really any way to administer the default DCHub without PythonBot or something similar.  With PythonBot, sending it hub.loadconfig() will reload the settings in the conf file.  However, that doesn't mean things will be changed right away.  Obviously you won't be able to change the port or IP will it is running.  Other things like the user limits are per user, with the setting in the conf file being the default, so reloading the conf file will change the values for future users but not for present ones.

      If you need more information, please let me know. 

       
    • William

      William - 2005-06-20

      I'm sorry, but YnHub has made me very spoiled, but how do I send it to the bots? Sending PythonBot this, "hub.loadconfig()",  in PM, or any other command doesn't seem to work. And, if you could do it that way, my OP's could do the same thing. And that leeds to another question, why only two user profiles? OP and user. It's not enough. When I ran my hub with YnHub I had like 8-or-so profiles. But then again, I guess it wouldn't be that hard adding some by yourself, but I have no knowlage about Python. ^^;;

      // Spoiled, and very tierd.

       
    • Jeremy Evans

      Jeremy Evans - 2005-06-20

      Because PythonBot can control any aspect of the hub, it's limited to users who have PythonBot in the args for their account (so not just any op can use it).  Edit the accounts file so the line for your account contains PythonBot in the args.  The example account in the conf file shows how to do this.

      The philosophy behind py-dchub is to have the bare minumum in the base hub (DCHub.py), with extra functionality added in a subclass based on the hub operator's specific needs.  AdvancedDCHub.py is an example of this, with a full user registration system, punishments (banning, silencing), user history, etc..  It only has 3 user profiles (regular user, op, and super op that can execute Python commands), as that was all that was needed by the hub operator.

      If you could describe the needs you have for your 8 profiles (group A can do this, group B can do this, group C can do this, etc.), I might be able to write a hub subclass to take care of them.

       
    • William

      William - 2005-06-20

      Alright, I'm starting to get this, so should I add BanBot too? And, I can do without 8 userprofiles, for now. Smart way to assaign bots to specific users.

      But, when you mention editing the accounts. Does that reload with too when the hubconfig reloads?

      Oh, about my user profiles, I had Owner, Co-owner, OP, User, VIP, SU and two speciall user profiles for two speciall users. One had a OP-ish profile with more rights than a SU, and the other wasn't in the OP-list but had more power than the other speciall user.

      Thanks again. I'll most likely return with more questions later.

       
    • Jeremy Evans

      Jeremy Evans - 2005-06-21

      BanBot is usable by any op, so you don't need to add a string to the args to use it.  PythonBot is special in this regard, simply because it has total control of the hub.  If you want to modify BanBot so that only certain ops can use it, that's a fairly easy change (1 or 2 lines max).

      Accounts can be reloaded using hub.loadaccounts().  Users are associated with their accounts upon login though, so removing an account and reloading will not boot users logged in with that account (you'd have to sent it some code to do that).  But after reloading, users will be able to login under any new accounts that you added before reloading.

      About the user profiles, it depends on whether the command is a hub command or a bot command.  For hub commands, it would probably be easiest to add a function that gets called in loginuser than modifies the available commands based on the user args string.  For bot commands, you just need to add a check at the top of the bot's processcommand method.  I can give you examples of both of these methods if you want.  I'm thinking of adding functions to make modifications similar to the ones you want easier.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.