Debian Codegraph @

man/fs_perms.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/fs_perms.R
3 \name{fs_perms}
4 \alias{fs_perms}
5 \alias{as_fs_perms}
6 \title{Create, modify and view file permissions}
7 \usage{
8 as_fs_perms(x, ...)
9
10 fs_perms(x, ...)
11 }
12 \arguments{
13 \item{x}{An object which is to be coerced to a fs_perms object. Can be an
14 number or octal character representation, including symbolic
15 representations.}
16
17 \item{...}{Additional arguments passed to methods.}
18 }
19 \description{
20 \code{fs_perms()} objects help one create and modify file permissions easily.
21 They support both numeric input, octal and symbolic character
22 representations. Compared to \link{octmode} they support symbolic representations
23 and display the mode the same format as \code{ls} on POSIX systems.
24 }
25 \details{
26 On POSIX systems the permissions are displayed as a 9 character string with
27 three sets of three characters. Each set corresponds to the permissions for
28 the user, the group and other (or default) users.
29
30 If the first character of each set is a "r", the file is readable for those
31 users, if a "-", it is not readable.
32
33 If the second character of each set is a "w", the file is writable for those
34 users, if a "-", it is not writable.
35
36 The third character is more complex, and is the first of the following
37 characters which apply.
38 \itemize{
39 \item 'S' If the character is part of the owner permissions and the file is not
40 executable or the directory is not searchable by the owner, and the
41 set-user-id bit is set.
42 \item 'S' If the character is part of the group permissions and the file is not
43 executable or the directory is not searchable by the group, and the
44 set-group-id bit is set.
45 \item 'T' If the character is part of the other permissions and the file is not
46 executable or the directory is not searchable by others, and the 'sticky'
47 (S_ISVTX) bit is set.
48 \item 's' If the character is part of the owner permissions and the file is
49 executable or the directory searchable by the owner, and the set-user-id bit
50 is set.
51 \item 's' If the character is part of the group permissions and the file is
52 executable or the directory searchable by the group, and the set-group-id
53 bit is set.
54 \item 't' If the character is part of the other permissions and the file is
55 executable or the directory searchable by others, and the ''sticky''
56 (S_ISVTX) bit is set.
57 \item 'x' The file is executable or the directory is searchable.
58 \item '-' If none of the above apply.
59 Most commonly the third character is either 'x' or \code{-}.
60 }
61
62 On Windows the permissions are displayed as a 3 character string where the
63 third character is only \code{-} or \code{x}.
64 }
65 \examples{
66 # Integer and numeric
67 fs_perms(420L)
68 fs_perms(c(511, 420))
69
70 # Octal
71 fs_perms("777")
72 fs_perms(c("777", "644"))
73
74 # Symbolic
75 fs_perms("a+rwx")
76 fs_perms(c("a+rwx", "u+rw,go+r"))
77
78 # Use the `&` and `|`operators to check for certain permissions
79 (fs_perms("777") & "u+r") == "u+r"
80 }