The Definition of Symlink in Unix

Create virtual pointers in Linux

On UNIX-based operating systems, a symbolic link or a symlink is a file in one directory that acts as a pointer to a file in another directory. For example, you could create a link so that all accesses to the file /tmp/foo really act upon the file /etc/passwd.

Creating Symlinks

Linux offers the ln command to create links, with the -s flag specifying a symbolic link. For example:

will create a symbolic link in the /tmp directory to a file located in the user's home directory.

Symlink Security

Athough a non-root user lacks permission to write to administrative files like /etc/passwd, an ordinary user account can create links to them in the /tmp directory or the home directory. SUID — a process where the operating system sets a specific user ID as the executing user when a file is accessed or a command executed — can then be exploited. This is the leading way that local users can escalate their privileges on a system.