Vol. I · No. 46The command line sectionSat, 10 Oct 2026
Configuration and changing data

/srv

data this host serves to others

/srv is for the data a server hands out. The files of a web site, an FTP area, a shared repository — whatever this machine exists to serve. The standard sets it aside for that purpose, though many distributions leave it empty and use /var/www instead.

The data the machine serves, kept apart from the machine itself.

Holds
Served data
Web, FTP and file-share content
On disk
Yes
Empty on most desktop systems
Who writes
The administrator
Its layout is yours to choose
Name
Service
Data for services

Why it exists

Every directory at the top of the tree is there for a reason. This is the problem /srv solves.

Site data in a known place

An administrator arriving at an unfamiliar server can look in one directory to find what it serves, without reading every service’s configuration.

Simple to back up

Programs can be reinstalled; the site’s content cannot. With the content in one tree, the backup is one path.

What you find inside

Not everything, but the entries worth recognising. Each is marked as a directory, a file, a link or a device.

/srv
  • wwwdirectoryWeb site files, where the administrator has chosen /srv for them.
  • ftpdirectoryThe files an FTP server offers.
  • gitdirectoryRepositories shared from this host.
  • nfsdirectoryDirectories exported to other machines over NFS.

At the terminal

Four commands that show what this directory is doing on a real machine.

ls /srv

See whether this machine keeps served data here at all.

sudo mkdir -p /srv/www/example

Create a directory for a site’s files.

du -sh /srv

Show how much data the host is serving.

grep -r "root" /etc/nginx/sites-enabled/

Find where a web server is actually told to serve from.

Handle with care

What goes wrong here, and what someone securing or attacking the machine looks at.

Anything here may be public

A file under a web root is one request away from the internet. Backups, .git directories and files holding passwords do not belong in it.

Give services only what they need

The web server should be able to read the site and write only where uploads go. A site writable throughout can be rewritten by whoever breaks in.

Read alongside