Linux File System Guide (RedHat distros)

SUBJECT

The following is an in depth guide to the file system on an InterWorx-CP web server.

AUDIENCE

It is intended for intermediate to advanced users, but new users will find parts of it valuable as well.

OVERVIEW

Topics covered in this document are the user’s home directory and it’s contents, the location of common system configuration files, and the InterWorx home directory.

Since many of the problems encountered in the Linux environment deal with file ownership and permissions, this document will list the correct file ownership and permissions using the following formula

swuser.swuser 644
owner, group, permission

 swuser refers to the SiteWorx system user for each account

Last Updated: InterWorx 3.0.2 -- updating in progress.

File System Overview

The Chroot directory

InteWorx uses chrooting (aka “jailed” shells) to limit the access a user has to the file system of the server. A jailed shell is a shell user with limited access to the file system.

The benefit of this is that it allows the system administrator to assign ssh and sftp users a special shell “jk_chrootsh” that has limited access to the servers file system for security reasons.

This is a security precaution, and highly recommended because with normal ssh access the user will have access to complete file system and will be able to access anything that does not have permissions that specifically preclude it.

For example, this means that the user can read configuration files from PHP scripts with password info in them (unless permissions on them were manually changed post install) and install things in directories chmod’d to 776 / 777 like temporary directories.

 Only users assigned the jk_chrootsh shell will have limited access. Those assigned bash or one of the other shells will continue to have full access to the servers file system.

The jailed shell deliberately has a limited amount of commands one can run.

If you deem that your users need access to another command you use the jk_cp command from the root shell to add the command you want to enable for example.

jk_cp /chroot /usr/bin/command-you-want-to-install

 Use this with caution as most of the commands which were excluded were done so as a security precaution!

What this does is create a symlink (shortcut for the Windows oriented) to the original binary in /chroot directory.

The Home Directory

The /home directory (/chroot/home for servers deployed with version 1.9 of InterWorx or later or which were manually updated to this configuration) is the location of the home directories of most of the system users on the system with the following exceptions

  • root which is located in /root
  • iworx (appears in /home but is actually a symlink to /usr/local/interworx)
  • voopmail (appears in /home but is actually a symlink to /var/lib/vpopmail)

The SiteWorx home directories

When you create a SiteWorx account, the InterWorx-CP creates a Linux system user for the account. The system user is the first eight characters of the default domain name for the account (excluding periods and dashes). For example if you created a SiteWorx account using the domain dummysite.tld the Linux user name would be dummysit. If the domain contains a number, the number is spelled out. For example 3wishes.com becomes threewis.

 Throughout this document I will use to refer to the user and to refer to the domain name.

InterWorx-CP allows users to create SiteWorx accounts using subdirectories as well as fully qualified domain names (FQD) for example typo3.dummysit.tld In the event that the domain in question has a number in it the number is spelled out. The user for typo3.dummysite.tld would be typothre.

In some cases a webmaster may have more than one similar domain which may qualify for the same system user name. When this happens, each additional user added has the last digit of the username is replaced with a number.

On a Linux computer each system user has it’s own home directory under the main home directory. For example, home directory of dummysit is /home/dummysit/ The home directory of typothre is /home/typothre/

Inside the home directory ( dummysit for example) of a user are the following:

  1. /home/<user_name>/backups
  2. /home/dummysit/backups (directory -- InterWorx-CP 1.9.0 and later)
  3. backups is a subdirectory that contains SiteWorx generated backups of the account (or just web data or just email or just databases). (This directory does not exist until the first backup is made.)
  4. /home/<user_name>/<domain_name>
  5. /home/dummysit/dummysite.tld <domain_name> (directory)
  6. <domain_name> (the full name of the domain name used housed in the SiteWorx account) is the location of your web files and will be discussed more in a minute.
  7. /home<user_name>/<user>.ini
  8. /home/dummysit/dummysit.ini (file)

 .ini is a configuration file used by the backup system which should not be edited or deleted.

  1. /home/<user_name>/public_html/
  2. /home/dummysit/public_html/ (symlink -- InterWorx-CP 1.9.0 and later)
  3. public_html is a symlink (shortcut) to the domain.tld/html/ directory where your html files are located. This directory is needed to allow users access to their home directory and web files if their domain is not yet resolving to the server. For example:
http://<ip_address>/~username/ or http://<ip_address>/~dummysit/
/home/<user_name>/var/
/home/dummysit/var/   (directory containing configuration files)

The var directory contains a series of subdirectories containing email, logs, and other configuration files. A detailed explanation of this is beyond the preview of this document, but can be found in the InterWorx-CP File System Guide.

The <domain_name> directory contains one subdirectory entitled html. This is where you put your web documents and images. This directory contains one directory by default cgi-bin. This is where you put your cgi (perl) scripts if you use them.
You may use any directory structure that you like inside the html directory, but cgi scripts should go into the /home/username/domainname.com/html/cgi-bin directory. Most people put pictures in the images directory. When SiteWorx creates a subdomain, a directory with the same name as the subdirectory will be created in the html directory. All files from the subdomain need to go into a directory with the same name as the sub domain.

  Do not confuse SiteWorx created subdomains with NodeWorx created subdomains. Subdomains created from NodeWorx are treated the same as any other fully qualified domain name and receive their own system user and home directory file system. With InterWorx 3.0 and later you can create subdomains as secondary domains in SiteWorx. These get their own html and cgi-bin directories, but are under the ownership of the user and group of the master domain in the SiteWorx account.

It is advisable to use all lower case letters for directories. Domain names may not be case sensitive, but the document names and directory names ARE.

The reason for this rather long path to your web data is that in the near future the developers intended to support multiple domains per SiteWorx account from the very beginning and in InteWorx 3.0 this became a reality.

 Some web servers put your web files in the /var/www/html/ directory; however InterWorx does NOT use this convection. The only thing that is located here is a the generic html file that loads when you load your IP or hostname in a browser window when a domain is not assigned to that IP.

The InterWorx directory

The InterWorx home directory is licated inside /usr/local/interworx. This is the home directory of the iworx system user and all of the files that InterWorx itself uses are located here.

The Web Server -- Apache (httpd)

The MTA -- Qmail

The MDA -- vPOPmail

The sFTP Server -- ProFTPD

Yellowdog Updater Modified -- YUM

InterWorx uses YUM to keep InterWorx and the other software on your computer up to date. It is possible to use other utilities such as up2date to do this as well, but YUM is integrated into InterWorx.

The binary is located here:

/usr/bin/yum

The main configuration file here:

/etc/yum.conf

The cache here:

/var/cache/yum/

Logs

Other Important Files

InterWorx is installed in

/home/interworx/

The InterWorx configuration file is located

/home/interworx/worx.ini

This is the file where the most of your InterWorx settings are located. DO NOT edit this file unless you know exactly what you are doing.

The InterWorx license key is located

/home/interworx/.license

This file is generated by the goiworx.pex script after you install InterWorx.

Your main apache configuration file is located

/etc/httpd/conf/httpd.conf

Each domain on the server (virtual host) has it’s own configuration file located in the following directory:

/etc/httpd/conf.d/

The php.ini file is located

/etc/php.ini

The httpd (apache) logs are located:

/var/log/httpd/

Individual SiteWorx domain access logs are located:

/home/<user_name>/var/<domain_name>/logs/error.log

NOTE: Save Access Logs must be turned ON in both NodeWorx (on the SiteWorx account edit screen) and SiteWorx (on the Preferences screen) for anything older than today’s log to be present.

Your MySQL database are stored:

/var/lib/mysql

[NOTE: An InterWorx server uses a special naming scheme to differentiate databases belonging to specific SiteWorx accounts. When you type a database name into the Create Database form in SiteWorx, the name f the SiteWorx user is appended to the front of it. for example if you are creating the database dbase for the typothre user the real name of the database is typothre_dbase.]

The Apache Controller

/usr/sbin/apachectl

InterWorx Conf

/etc/httpd/conf.d/interworx.conf

This file controls all of the redirects used by InterWorx and the integrated software -- phpMyAdmin, Webmail clients, etc. (EDIT WITH CARE)

Perl is located

 /usr/bin/perl
 /etc/httpd/conf.d/perl.conf
/etc/proftpd.conf
COPYRIGHT © InterWorx L.L.C. 2004-2008 PRIVACY POLICYEULA