vsftp virtual users configuration

Asked by PIerrick Bignet on 2012-01-25


I want to share a folder which is /home/me/downloads with my mates.

So, I just want to create a virtual user with vsftpd. I could do it with pam , but it seems that if I create a ftp user with ehcp (an admin user, because I want to acces a /home/me directory) a virtual user is created (in /etc/vsftpd-user). So I don't want to mess up the ehcp configuration.

Then I tried to create a admin ftp user via ehcp, and modify its configuration in its configuration file (/etc/vsftpd-user/user). For example adding "readonly=true" (syntax is not correct). It works well ... until I make a change in the ftp configuration using ehcp (for example, if I create a new user). Then, ehcp overwrites everything apparently, and delete my configuration lines.

So, is there a way to do this ?

Question information

English Edit question
Easy Hosting Control Panel for Ubuntu Edit question
No assignee Edit question
Solved by:
PIerrick Bignet
Last query:
Last reply:
ehcpdeveloper (ehcpdeveloper) said : #1

do this way:
go to phpmyadmin, ehcp db, ftpaccounts table
find row with that user,
change homedir to whatever you want

ehcp->options->sync ftp

your user will be with whatever you want, will keep config even if you
re-add some ftp into ehcp again.
ehcp will keep user "homedir", other settings like you said,
readonly=true, will not work this way, only homedir will work.

to make additional change, regarding ftp settings, you need to make
change in classapp.php file, function syncFtp()

Ok, I did it this way, creating user by ; Add ftp Under My ftp
Then changing homedir is working, but the user CAN create directory or delete files, and I don't want this.

So, I went again in the /etc/vsftpd-user/user file, and added my configuration lines...

Then, created another user, and everything has been deleted again.

Hm, seems that the writeoutput2 function use fputs with a w argument, so erase all the file (I'm not a php dev at all).

Using "a" argument won't solve my problem either, duplication of "homedir" parameter each time I use syncFtp function seems not a proper solution.

I suppose I should just code a write function, similar to write output but checking the line with homedir and just replacing this one.

If you can give me a hand on this, it would be awesome ...

Ok, I changed the fopen paramaters (using "a" instead of "w"), but like i said i now have tons of useless lines.

I really think this is a major improvement aera for ehcp, ftp administration is really too simple

ehcpdeveloper (ehcpdeveloper) said : #5

you may also add this to blueprints.. which are feature requests..

ehcpdeveloper (ehcpdeveloper) said : #6

will work on this and let you know, when ready.

Thank you very much. I suppose that making an option "keep paramaters" with a condition to change only the line with "homedir" would be enough.
Sadly, I'm not a php dev at all

So I consider this as solved, sry.