What is this folder /run/user/1000?

What is this folder: /run/user/1000 on my Fedora system and what does it do?

~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.2G   20K  1.2G   1% /run/user/1000

EDIT: 7 june 2019.

My two answers don’t agree on what directory or where the files stored in this place were:

Patrick:

Prior to systemd, these applications typically stored their files
in /tmp.

And again here:

/tmp was the only location specified by the FHS which is local,
and writable by all users.

Braiam:

The purposes of this directory were once served by /var/run. In
general, programs may continue to use /var/run to fulfill the
requirements set out for /run for the purposes of backwards
compatibility.

And again here:

Programs which have migrated to use /run should cease their usage of
/var/run, except as noted in the section on /var/run.

So which one is it that is the father of /run/user/1000, why is there no mention in either answer of what the other says about the directory used before /run/user.

According to the latest draft of FHS (File Hierarchy Standard), /run:

This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process.

The purposes of this directory were once served by /var/run. In general, programs may continue to use /var/run to fulfill the requirements set out for /run for the purposes of backwards compatibility. Programs which have migrated to use /run should cease their usage of /var/run, except as noted in the section on /var/run.

Programs may have a subdirectory of /run; this is encouraged for programs that use more than one run-time file. Users may also have a subdirectory of /run, although care must be taken to appropriately limit access rights to prevent unauthorized use of /run itself and other subdirectories.

In the case of the /run/user directory, is used by the different user services, like dconf, pulse, systemd, etc. that needs a place for their lock files and sockets. There are as many directories as different users UID’s are logged in the system.

Answered By: Braiam

/run/user/$uid is created by pam_systemd and used for storing files used by running processes for that user. These might be things such as your keyring daemon, pulseaudio, etc.

Prior to systemd, these applications typically stored their files in /tmp. They couldn’t use a location in /home/$user as home directories are often mounted over network filesystems, and these files should not be shared among hosts. /tmp was the only location specified by the FHS which is local, and writable by all users.

However storing all these files in /tmp is problematic as /tmp is writable by everyone, and while you can change the ownership & mode on the files being created, it’s more difficult to work with.

So systemd came along and created /run/user/$uid. This directory is local to the system and only accessible by the target user. So applications looking to store their files locally no longer have to worry about access control.
It also keeps things nice and organized. When a user logs out, and no active sessions remain, pam_systemd will wipe the /run/user/$uid directory out. With various files scattered around /tmp, you couldn’t do this.

Answered By: phemmer