Author Topic: FTP per user basis custom configuration [Solved]  (Read 1740 times)

akhasis

  • Zen Apprentice
  • *
  • Posts: 39
  • Karma: +1/-0
    • View Profile
FTP per user basis custom configuration [Solved]
« on: December 08, 2012, 12:18:36 pm »
Hello,

I want to grant user A no access to FTP, user B should be able to access her home directory, and user C should  be able to access his home and the www directory.

As far as I know, vsftp, the ftp server used by zentyal, allows that configuration by indicating in its config file a directory where the user custom configurations are stored. But any change I make to vsftp config file is overwritten by zentyal, much like happens to th changes made to its web server configuration file.

I know that, in the web server, changes can be made that will not be overwritten: a file can be created at  /etc/apache2/sites-available/user-ebox-[domain] . Is there anything like that for vsftp? Or any other way to be able to configure FTP access for each user?

Thank you!
« Last Edit: December 10, 2012, 05:22:55 pm by akhasis »

stuartiannaylor

  • Zen Monk
  • **
  • Posts: 67
  • Karma: +1/-6
    • View Profile
Re: FTP per user basis custom configuration
« Reply #1 on: December 08, 2012, 01:39:57 pm »
You need to edit the .mas file in /usr/share/zentyal/[zentyal-module-name] (Check the naming structure)

I also want to access /var/www and /srv/www.

I have tried and the settings to limit the user or change settings doesn't seem to work for me though.

« Last Edit: December 08, 2012, 01:46:26 pm by stuartiannaylor »

Marcus

  • Forum Moderator
  • Zen Samurai
  • *****
  • Posts: 395
  • Karma: +12/-0
    • View Profile
    • Professional IT Service
Re: FTP per user basis custom configuration
« Reply #2 on: December 08, 2012, 01:54:38 pm »
Hello akhasis,

> and user C should  be able to access his home and the www directory
You'll have to:
1) install suPHP
2) copy&mod the zentyal configuration file (as explained lower and in the previous reply)
2a) comment the web root folder from the main conf file (e.g. #DocumentRoot <% $docRoot %>/<% $vHostName %>)
2b) create a custom vhost file with the new http root
e.g.
Code: [Select]
echo "DocumentRoot /home/<user>/public_html/" > /etc/apache2/sites-available/user-ebox-[domain]/www-root

** While beeing there - you may also want to change the following to the main "vhost.mas" file:

Webmaster email (not sure why it's not already this way):
ServerAdmin webmaster@<% $hostname %>
to
ServerAdmin webmaster@<% $vHostname %>

Error log:
Comment the Errorlog line:
#ErrorLog /var/log/apache2/<% $vHostName %>-error.log
and making a new custom entry for each webmaster:
Code: [Select]
sudo mkdir /home/<user>/logs && chown user:user /home/<user>/logs
Code: [Select]
echo "ErrorLog /home/<user>/logs/<% $vHostName %>-error.log" > /etc/apache2/sites-available/user-ebox-[domain]/ErrorLog"
Custom log:
Comment the CustomLog line:
#CustomLog /var/log/apache2/<% $vHostName %>-access.log combined
and making it available for each webmaster:
Code: [Select]
echo "ErrorLog /home/<user>/logs/<% $vHostName %>-error.log" > /etc/apache2/sites-available/user-ebox-[domain]/CustomLog"
> any change I make to vsftp config file is overwritten by zentyal
You must:
a) copy the original "
e.g.
Code: [Select]
cp /usr/share/zentyal/stubs/<modulename>/<filename>.mas" files to "/etc/zentyal/stubs/<module name>/<filename>.masb) make your mods in the new files
c) restart the service
e.g.
Code: [Select]
sudo /etc/init.d/zentyal <service>
I'm not sure about all the rest...

Best,

Marcus

stuartiannaylor

  • Zen Monk
  • **
  • Posts: 67
  • Karma: +1/-6
    • View Profile
Re: FTP per user basis custom configuration
« Reply #3 on: December 08, 2012, 02:01:52 pm »
I am the same Marcus why hostname is used instead vhostname.

Also you might want to add a server alias ServerAlias www.<% vhostname %>

I always find in confusing with the default website being in /var/www and virtual-hosts in /srv/www

This is due to Zarafa where I like to lock access to a particular domain.

 

akhasis

  • Zen Apprentice
  • *
  • Posts: 39
  • Karma: +1/-0
    • View Profile
Re: FTP per user basis custom configuration
« Reply #4 on: December 10, 2012, 09:33:03 am »
Thank you stuartiannaylor/Marcus. I'll let you know when I try what you suggested.

akhasis

  • Zen Apprentice
  • *
  • Posts: 39
  • Karma: +1/-0
    • View Profile
Re: FTP per user basis custom configuration
« Reply #5 on: December 10, 2012, 05:22:27 pm »
Thank you, it worked