Article ID: 3183, created on Nov 30, 2007, last review on Jun 28, 2016

  • Applies to:
  • H-Sphere

Resolution

Ftp Server

H-Sphere FTP is based on ProFTPd server and installed on Web boxes as hsphere-ftp-<proftpd_version>-<package_build> package, where <ftp_version> is ProFTPd version, and <package_build> is this package's build number. See list of packages installed with different H-Sphere versions on supported operating systems.

ProFTPd binary is /hsphere/shared/sbin/proftpd

There are two kinds of FTP:

  • User FTP: When a new user account is created, its user is provided with the FTP account and thus may download/upload files from/to the user's home directory (/hsphere/local/home/{user_name}) by FTP using his name and password.

  • Virtual (anonymous) FTP: a service provided only for dedicated IP accounts, enables to create virtual accounts to download/upload files from/to virtual account directories that are located within the account home directory, and provides anonymous access to the public directory.
 

User FTP

Log File

/hsphere/local/var/proftpd/logs/xferlog is the FTP log file. When a user uploads or downloads data, the corresponding record is made in the log file.

Configuration

FTP configuration directory is /hsphere/shared/config/ftpd.

/hsphere/shared/config/ftpd/proftpd.conf - FTP configuration file.

/hsphere/shared/config/ftpd/proftpd.conf.shared - FTP subaccounts configuration file.

Download/Upload Permissions

User can download and upload files from his document root directory (/hsphere/local/home/{user_name}/{domain_name}) after he logs in by FTP entering his login name ({user_name}) and password:
ftp user_name@domain_name

User FTP Traffic Calculation

Cron runs the /hsphere/shared/scripts/cron/ftp_anlz_user.pl script on everyday basis for collecting user FTP traffic.

ftp_anlz_user.pl parses the /hsphere/local/var/proftpd/xferlog FTP log file and writes FTP traffic statistics into the /hsphere/local/var/statistic/dd.mm.YYYY.gst.txt statistics files.

The TrafficLoader Java class utility is launched by cron to process FTP traffic statistics and load it to the system database. TrafficLoader also calls the /hsphere/shared/scripts/xfer_cat.pl to gzip outdated statistics files and move them into the loaded directory where they are stored as dd.mm.YYYY.gst.txt.gz archives.

 

Virtual FTP

Log File

For each virtual account, its own configuration file is located in the /hsphere/local/var/proftpd/logs/ directory. File format: {vhost_id}.ftp.log.

For example, wwwuser has virtual FTP enabled for the test.psoft virtual host, and vhost_id=1208 is the virtual host identifier. When the virtual FTP user test3 connects by FTP to the virtual host (ftp test3@test.psoft), he would be allowed to download and upload (if permissions to write are set to that virtual host) from /hsphere/local/home/wwwuser/1208 directory for downloads and /hsphere/local/home/wwwuser/1208/incoming directory for uploaded files. The log records would be added to /hsphere/local/var/proftpd/logs/1208.ftp.log

The same is true for anonymous FTP account. If this option is enabled for the test.psoft virtual host, any user may connect by FTP using anonymous login and any email as a password, and all his downloads would go to /hsphere/local/home/wwwuser/1208 directory, uploads to the /hsphere/local/home/wwwuser/1208/incoming subdirectory.

Configuration

Configuration directory is /hsphere/local/config/ftpd.

The sites subdirectory contains configuration files {vhost_id}.conf. These files are generat ed by H-Sphere when the new virtual FTP server is created, by parsing the /hsphere/local/home/cpanel/shiva/shiva-templates/common/ftp/ftp.config template where the structure of virtual host configuration is set.

The sites/index.conf file contains the inclusions of the {vhost_id}.conf files.

The sites/{vhost_id}.passwd files contain information on the following accounts:

- {web_user_name} - name of the web user under which account this virtual host is enabled. Thus, user may log on by his name and password to connect by FTP to the virtual host FTP directory.
- {anonymous} - if anonymous FTP is switched on, anonymous connection may be installed by the outsider.
- the list of virtual FTP users with their base64-encoded passwords.

/hsphere/local/config/ftpd/proftpd.conf - configuration file. It includes the user FTP configuration file and sites/index.conf file.

Virtual FTP Traffic Calculation

Cron runs the /hsphere/shared/scripts/cron/ftp_anlz.pl script daily to collect virtual FTP traffic statistics.

The script parses the virtual FTP log files and writes traffic statistics into the timestamp-named /hsphere/local/var/statistic/dd.mm.YYYY.ftp.txt statistics files.

The TrafficLoader Java class utility is launched by cron to process anonymous FTP traffic statistics and load it to the system database. TrafficLoader also calls the /hsphere/shared/scripts/xfer_cat.pl to gzip outdated statistics files and move them into the loaded directory where they are stored as dd.mm.YYYY.ftp.txt.gz archives.


f213b9fa8759d57bee5d547445806fe7 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF
© 1999-2016 Ingram Micro Inc. All rights reserved. Odin and the Odin logo are trademarks of Ingram Micro Inc.