Esempio n. 1
0
def main():
    authorizer = DummyAuthorizer()
    authorizer.add_user('user', '12345', '.', perm='elradfmw')
    authorizer.add_anonymous('.')
    handler = AntiFloodHandler
    handler.authorizer = authorizer
    ftpd = FTPServer(('', 21), handler)
    ftpd.serve_forever(timeout=1)
Esempio n. 2
0
def main():
    authorizer = DummyAuthorizer()
    authorizer.add_user('user', '12345', '.', perm='elradfmw')
    authorizer.add_anonymous('.')
    handler = AntiFloodHandler
    handler.authorizer = authorizer
    ftpd = FTPServer(('', 21), handler)
    ftpd.serve_forever(timeout=1)
Esempio n. 3
0
        def add_user(self, username, homedir=None, **kwargs):
            """Add a "real" system user to the virtual users table.

             - (string) homedir:
                The user home directory.  If this is not specified the
                real user home directory will be determined (if any)
                and used.

             - (dict) **kwargs:
                the same keyword arguments expected by the original
                add_user method: "perm", "msg_login" and "msg_quit".
            """
            # get the list of all available users on the system and check
            # if provided username exists
            users = [entry.pw_name for entry in pwd.getpwall()]
            if not username in users:
                raise AuthorizerError('No such user "%s".' % username)
            if not homedir:
                homedir = pwd.getpwnam(username).pw_dir
                self._dynamic_home_users.append(username)
            DummyAuthorizer.add_user(self, username, '', homedir, **kwargs)