diff options
Diffstat (limited to 'man7/symlink.7')
-rw-r--r-- | man7/symlink.7 | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/man7/symlink.7 b/man7/symlink.7 index 5aaaee598..518f9720a 100644 --- a/man7/symlink.7 +++ b/man7/symlink.7 @@ -26,7 +26,7 @@ the same where an inode number is an index into the inode table, which contains metadata about all files on a filesystem. See -.BR stat (2).) +.MR stat 2 .) Changes to a file are independent of the name used to reference the file. Hard links may not refer to directories (to prevent the possibility of loops within the filesystem tree, @@ -37,7 +37,7 @@ and may not refer to files on different filesystems A symbolic link is a special type of file whose contents are a string that is the pathname of another file, the file to which the link refers. (The contents of a symbolic link can be read using -.BR readlink (2).) +.MR readlink 2 .) In other words, a symbolic link is a pointer to another name, and not to an underlying object. For this reason, symbolic links may refer to directories and may cross @@ -65,7 +65,7 @@ so that the user interface can be as consistent as possible. There is a special class of symbolic-link-like objects known as "magic links", which can be found in certain pseudofilesystems such as -.BR proc (5) +.MR proc 5 (examples include .IR /proc/ pid /exe and @@ -78,28 +78,28 @@ access files which cannot be referenced with normal paths (such as unlinked files still referenced by a running program ). .P Because they can bypass ordinary -.BR mount_namespaces (7)-based +.MR mount_namespaces 7 -based restrictions, magic links have been used as attack vectors in various exploits. .\" .SS Symbolic link ownership, permissions, and timestamps The owner and group of an existing symbolic link can be changed using -.BR lchown (2). +.MR lchown 2 . The ownership of a symbolic link matters when the link is being removed or renamed in a directory that has the sticky bit set (see -.BR inode (7)), +.MR inode 7 ), and when the .I fs.protected_symlinks sysctl is set (see -.BR proc (5)). +.MR proc 5 ). .P The last access and last modification timestamps of a symbolic link can be changed using -.BR utimensat (2) +.MR utimensat 2 or -.BR lutimes (3). +.MR lutimes 3 . .P .\" Linux does not currently implement an lchmod(2). On Linux, the permissions of an ordinary symbolic link are not used in any @@ -128,16 +128,16 @@ Using the combination of the and .B O_NOFOLLOW flags to -.BR open (2) +.MR open 2 yields a file descriptor that can be passed as the .I dirfd argument in system calls such as -.BR fstatat (2), -.BR fchownat (2), -.BR fchmodat (2), -.BR linkat (2), +.MR fstatat 2 , +.MR fchownat 2 , +.MR fchmodat 2 , +.MR linkat 2 , and -.BR readlinkat (2), +.MR readlinkat 2 , in order to operate on the symbolic link itself (rather than the file to which it refers). .P @@ -145,7 +145,7 @@ By default (i.e., if the .B AT_SYMLINK_FOLLOW flag is not specified), if -.BR name_to_handle_at (2) +.MR name_to_handle_at 2 is applied to a symbolic link, it yields a handle for the symbolic link (rather than the file to which it refers). One can then obtain a file descriptor for the symbolic link @@ -153,7 +153,7 @@ One can then obtain a file descriptor for the symbolic link by specifying the .B O_PATH flag in a subsequent call to -.BR open_by_handle_at (2). +.MR open_by_handle_at 2 . Again, that file descriptor can be used in the aforementioned system calls to operate on the symbolic link itself. .SS Handling of symbolic links by system calls and commands @@ -209,7 +209,7 @@ Within the dirname component of a pathname, symbolic links are always followed in nearly every system call. (This is also true for commands.) The one exception is -.BR openat2 (2), +.MR openat2 2 , which provides flags that can be used to explicitly prevent following of symbolic links in the dirname component. .IP (2) @@ -229,47 +229,47 @@ Various system calls do not follow links in the basename component of a pathname, and operate on the symbolic link itself. They are: -.BR lchown (2), -.BR lgetxattr (2), -.BR llistxattr (2), -.BR lremovexattr (2), -.BR lsetxattr (2), -.BR lstat (2), -.BR readlink (2), -.BR rename (2), -.BR rmdir (2), +.MR lchown 2 , +.MR lgetxattr 2 , +.MR llistxattr 2 , +.MR lremovexattr 2 , +.MR lsetxattr 2 , +.MR lstat 2 , +.MR readlink 2 , +.MR rename 2 , +.MR rmdir 2 , and -.BR unlink (2). +.MR unlink 2 . .P Certain other system calls optionally follow symbolic links in the basename component of a pathname. They are: -.BR faccessat (2), +.MR faccessat 2 , .\" Maybe one day: .BR fchownat (2) -.BR fchownat (2), -.BR fstatat (2), -.BR linkat (2), -.BR name_to_handle_at (2), -.BR open (2), -.BR openat (2), -.BR open_by_handle_at (2), +.MR fchownat 2 , +.MR fstatat 2 , +.MR linkat 2 , +.MR name_to_handle_at 2 , +.MR open 2 , +.MR openat 2 , +.MR open_by_handle_at 2 , and -.BR utimensat (2); +.MR utimensat 2 ; see their manual pages for details. Because -.BR remove (3) +.MR remove 3 is an alias for -.BR unlink (2), +.MR unlink 2 , that library function also does not follow symbolic links. When -.BR rmdir (2) +.MR rmdir 2 is applied to a symbolic link, it fails with the error .BR ENOTDIR . .P -.BR link (2) +.MR link 2 warrants special discussion. POSIX.1-2001 specifies that -.BR link (2) +.MR link 2 should dereference .I oldpath if it is a symbolic link. @@ -323,9 +323,9 @@ itself. There are some exceptions to this rule: .IP \[bu] 3 The -.BR mv (1) +.MR mv 1 and -.BR rm (1) +.MR rm 1 commands do not follow symbolic links named as arguments, but respectively attempt to rename and delete them. (Note, if the symbolic link references a file via a relative path, @@ -333,15 +333,15 @@ moving it to another directory may very well cause it to stop working, since the path may no longer be correct.) .IP \[bu] The -.BR ls (1) +.MR ls 1 command is also an exception to this rule. For compatibility with historic systems (when -.BR ls (1) +.MR ls 1 is not doing a tree walk\[em]that is, .I \-R option is not specified), the -.BR ls (1) +.MR ls 1 command follows symbolic links named as arguments if the .I \-H or @@ -354,7 +354,7 @@ or .I \-l options are not specified. (The -.BR ls (1) +.MR ls 1 command is the only command where the .I \-H and @@ -363,13 +363,13 @@ options affect its behavior even though it is not doing a walk of a file tree.) .IP \[bu] The -.BR file (1) +.MR file 1 command is also an exception to this rule. The -.BR file (1) +.MR file 1 command does not follow symbolic links named as argument by default. The -.BR file (1) +.MR file 1 command does follow symbolic links named as argument if the .I \-L option is specified. @@ -381,17 +381,17 @@ option is specified. .\"commands follow symbolic links specified on the command line. .SS Commands traversing a file tree The following commands either optionally or always traverse file trees: -.BR chgrp (1), -.BR chmod (1), -.BR chown (1), -.BR cp (1), -.BR du (1), -.BR find (1), -.BR ls (1), -.BR pax (1), -.BR rm (1), +.MR chgrp 1 , +.MR chmod 1 , +.MR chown 1 , +.MR cp 1 , +.MR du 1 , +.MR find 1 , +.MR ls 1 , +.MR pax 1 , +.MR rm 1 , and -.BR tar (1). +.MR tar 1 . .P It is important to realize that the following rules apply equally to symbolic links encountered during the file tree traversal and symbolic @@ -410,7 +410,7 @@ as well as any symbolic links encountered in the tree traversal of .IR directory , because symbolic links may be removed. In no case will -.BR rm (1) +.MR rm 1 affect the file referred to by .IR slink . .P @@ -506,17 +506,17 @@ This is intended to permit you to alias commands to behave one way or the other, and then override that behavior on the command line. .P The -.BR ls (1) +.MR ls 1 and -.BR rm (1) +.MR rm 1 commands have exceptions to these rules: .IP \[bu] 3 The -.BR rm (1) +.MR rm 1 command operates on the symbolic link, and not the file it references, and therefore never follows a symbolic link. The -.BR rm (1) +.MR rm 1 command does not support the .IR \-H , .IR \-L , @@ -526,7 +526,7 @@ options. .IP \[bu] To maintain compatibility with historic systems, the -.BR ls (1) +.MR ls 1 command acts a little differently. If you do not specify the .IR \-F , @@ -534,31 +534,31 @@ If you do not specify the or .I \-l options, -.BR ls (1) +.MR ls 1 will follow symbolic links specified on the command line. If the .I \-L flag is specified, -.BR ls (1) +.MR ls 1 follows all symbolic links, regardless of their type, whether specified on the command line or encountered in the tree walk. .SH SEE ALSO -.BR chgrp (1), -.BR chmod (1), -.BR find (1), -.BR ln (1), -.BR ls (1), -.BR mv (1), -.BR namei (1), -.BR rm (1), -.BR lchown (2), -.BR link (2), -.BR lstat (2), -.BR readlink (2), -.BR rename (2), -.BR symlink (2), -.BR unlink (2), -.BR utimensat (2), -.BR lutimes (3), -.BR path_resolution (7) +.MR chgrp 1 , +.MR chmod 1 , +.MR find 1 , +.MR ln 1 , +.MR ls 1 , +.MR mv 1 , +.MR namei 1 , +.MR rm 1 , +.MR lchown 2 , +.MR link 2 , +.MR lstat 2 , +.MR readlink 2 , +.MR rename 2 , +.MR symlink 2 , +.MR unlink 2 , +.MR utimensat 2 , +.MR lutimes 3 , +.MR path_resolution 7 |