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