1

We have a server with many vsFTPd FTP users saved in /etc/vsftpd/users/* and /etc/vsftpd/passwd.db. As me made a new server to split the load, we have to move some of the users to the new server.

Copying the user file should be simple but how can we move the password hash so the user can log in with his credentials to the new machine?

We don't want to copy everyone over so we can't move that entire thing, just move some selected users to the other server without resetting their passwords.

Thank you!

5
  • This fully depends on how you configured the user authentication in vsftpd.conf Commented Oct 7, 2021 at 11:44
  • I can't find any authentication option in the /etc/vsftpd.conf so I think it's on default but I found these lines if that helps: # allow virtual users: guest_enable=YES virtual_use_local_privs=YES user_config_dir=/etc/vsftpd/users We have a management system that manages the creation of ftp users so I never had to manage vsFTPd itself or touch the configs.
    – BDevGW
    Commented Oct 7, 2021 at 11:48
  • ... well, if you have a management system for users, then that is what you need to understand to know how to back up users, right? Commented Oct 7, 2021 at 11:50
  • 1
    Well they are stored in the passwd.db file and the users folder so backing these up would mean they can be put back. The problem is that I don't know how I can read the hashes of single users from the passwd.db or how I can change the users hash on the other server later.
    – BDevGW
    Commented Oct 7, 2021 at 11:53
  • ah, sorry, I completely missed the point of your question there! Commented Oct 7, 2021 at 11:57

1 Answer 1

1

your .db file is (if I'm not completely mistaken) a Berkeley DB, and while I'm not really a fan nor very experienced with these, you should be able to open that database file using a berkeley db driver for your favourite scripting language.

For Python, that'd be berkeleydb.

6
  • oof i'm writing in powershell, lets see what I can do! Thanks!
    – BDevGW
    Commented Oct 7, 2021 at 12:20
  • Ok I wasn't able to find anything, time to learn python then :/
    – BDevGW
    Commented Oct 7, 2021 at 12:25
  • I think you'll find powershell can be pretty limited for things that involved checking lists of strings against each other, anyway :) Luckily, if you're good with powershell, python will not be hard, I guess. Commented Oct 7, 2021 at 12:27
  • Honestly, though, these ancient key/value databases are kind of annoying to work with – in any language. Commented Oct 7, 2021 at 12:28
  • 1
    you need to "create db; db.open(db_file); db.do_something(...); db.close()" to put it in pseudocode. It's not really complex, but it's not a oneliner, either. It's not a database server (like say MySQL) that you connect to, it's an embeddable database, a very rudimentary one. Commented Oct 7, 2021 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .