 |
|
| |
| Introduction
| |
Everything on your VPS — programs, configuration, your web site, your mail — is a file
somewhere in a single tree rooted at / (the root directory). There is no concept of separate
drive letters as on Windows; external storage, if any, is mounted as a directory within this same tree.
Your own files live under your home directory, written ~.
This page is an orientation to that tree: where things live, how to move around, and how file
ownership and permissions work. It applies to both FreeBSD 15 and Rocky Linux 10, with the
differences between the two noted inline. For everyday commands and shell customization, see
The Unix Shell.
| |
| A Tour of the Top-Level Directories
| |
The single most important habit to build concerns where configuration lives, and this is the
one place the two systems differ in spirit:
|
On FreeBSD 15: software the system ships with configures itself under
/etc, while software you add with pkg configures itself under
/usr/local/etc. When this documentation says “edit Apache’s
configuration,” it means a file under /usr/local/etc/apache24/, not /etc.
On Rocky Linux 10: configuration for the base system and for anything you
add with dnf alike lives under /etc — there is no separate
/usr/local/etc tree to remember. Apache’s configuration is under
/etc/httpd/.
|
The major directories under / on a FreeBSD 15 VPS:
| Path |
Contains |
| /bin, /sbin | Essential commands needed even in single-user mode |
| /etc | Configuration for the FreeBSD base system (e.g. /etc/rc.conf, /etc/ssh/sshd_config) |
| /usr | The bulk of the base system: user commands (/usr/bin), manual pages (/usr/share/man)… |
| /usr/local | …everything you install yourself with pkg, including its own etc, bin, and www subdirectories |
| /usr/local/etc | Configuration for installed packages (Apache, Sendmail, Dovecot, Webmin, etc.) |
| /usr/local/www | Default document roots for installed web servers |
| /var | Frequently-changing data: logs (/var/log), mail queues (/var/spool), and more |
| /home (a link to /usr/home) | Personal directories for ordinary user accounts |
| /root | The root account’s home directory |
| /tmp | Temporary files, cleared periodically |
And on a Rocky Linux 10 VPS:
| Path |
Contains |
| /bin, /sbin | Essential commands. On Rocky Linux these are symbolic links into /usr/bin and /usr/sbin (the “usr merge”) |
| /etc | Configuration for the whole system — both the base OS and software you install with dnf (e.g. /etc/ssh/sshd_config, /etc/httpd/) |
| /usr | The bulk of the installed system: programs (/usr/bin, /usr/sbin), libraries (/usr/lib64), and shared data (/usr/share/man) |
| /usr/local | Software you install by hand, outside dnf — empty on a fresh system; dnf packages never use it |
| /var | Frequently-changing data: logs (/var/log), the mail spool (/var/spool/mail), and web content (/var/www) |
| /var/www/html | Apache’s default document root — files here are served at https://example.com/ |
| /home | Personal directories for ordinary user accounts (often its own LVM volume) |
| /root | The root account’s home directory |
| /tmp | Temporary files, cleared on a schedule and on reboot |
| /opt, /srv | Optional add-on software, and site-specific service data, respectively |
| |
| Navigating the File System
| |
A handful of commands cover most day-to-day navigation. Only the example path differs between the two
systems — /usr/local/etc on FreeBSD, /etc/httpd on Rocky Linux:
$ pwd # print working (current) directory
$ cd /usr/local/etc # change directory (on Rocky Linux: cd /etc/httpd)
$ cd ~ # go to your home directory
$ cd .. # go up one level
$ ls # list files in the current directory
$ ls -la # list all files, including hidden ones, with details
Filenames are case-sensitive on both systems (Index.html and index.html are
different files), can contain almost any character, and traditionally avoid spaces — if you must use
one, either quote the whole name ("my file.txt") or escape the space (my\ file.txt).
A leading dot marks a hidden file or directory — for example, .ssh in your home
directory holds your SSH keys and is hidden from a plain ls to reduce clutter, not for security
(use ls -a to see it).
| |
| File Ownership and Permissions
| |
Run ls -l in any directory and you will see output like this:
$ ls -l
-rw-r--r-- 1 youruser youruser 1024 Jun 9 14:02 index.html
drwxr-xr-x 2 youruser youruser 512 Jun 9 14:01 images
-rwxr-xr-x 1 youruser youruser 256 Jun 8 09:11 backup.sh
The first column encodes the file’s type and permissions as ten characters. The first character
is - for a regular file, d for a directory, or l for a symbolic link. The next nine
are three groups of three — permissions for the owner, the group, and
everyone else — each being r (read), w (write), and x (execute), or
- if that permission is not granted. So -rw-r--r-- is a regular file the owner can read and
write and everyone else can only read; drwxr-xr-x is a directory the owner can read, write, and
enter, and everyone else can read and enter but not modify.
The third and fourth columns are the file’s owner and group. The web server reads (and, for
upload directories, writes) your site’s files, so those files often need to be owned by or readable
by the account it runs as: on FreeBSD 15 that is the www user, and on
Rocky Linux 10 it is the apache user and group.
|
Rocky Linux note: you will see a trailing . after the nine permission
characters (for example -rw-r--r--.). That dot signals that the file carries an
SELinux security
context; a + in its place would mean a POSIX access-control list (ACL) is set. Ordinary
permissions still work exactly as described — the dot is just telling you SELinux is
also in the picture.
|
| |
| Changing Permissions and Ownership
| |
You change permissions with chmod and ownership with chown (the latter is root only):
$ chmod 644 index.html # owner: read/write; group & others: read
$ chmod 755 backup.sh # owner: read/write/execute; group & others: read/execute
$ chmod -R 755 images/ # apply recursively to a directory and its contents
# chown youruser:youruser file.txt # change owner and group (root only)
The numeric form of chmod adds up read (4), write (2), and execute (1) for each
of owner / group / other. 644 is therefore “owner can read and write (4+2=6), everyone else
can only read (4)” — the standard permission for a web page. 755 is the equivalent for
something that needs to be executable: a script, or a directory you need to be able to enter.
|
TIP: A directory needs its execute bit set for anyone to cd into it or reach
files inside it by name, even if those files are themselves readable. If a web page exists but
visitors get “Forbidden,” check the permissions on every directory in its path, not
just the file. On Rocky Linux, also check the file’s SELinux context — a
second, independent reason Apache can be denied access to a file whose ordinary permissions
look correct.
|
| |
| Where Your Web Files Go
| |
The directory Apache serves your site from — its document root — lives under
/usr/local/www on FreeBSD 15 and at /var/www/html on Rocky Linux 10. The
usual permission pattern for web content is directories 755 and files 644, owned by you and
readable by the web-server account above. The
Apache page shows the exact
chown and find commands for setting this, hosting
multiple domains places each
site in its own directory, and your access and error
logs live under /var/log.
| |
| Documentation
| |
The layout above is documented on the server itself: man hier describes the file-system
hierarchy, and every command has its own manual page — man ls, man chmod,
man chown. The same pages are published online at
www.gsp.com/support/man/; on the VPS,
man <command> is always the authoritative copy for the exact version you have installed.
|
Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.
|