Chmod equivalence of +x and 0755
up vote
6
down vote
favorite
Just curious, are these two completely equivalent?
chmod +x file
chmod 0755 file
bash shell
migrated from stackoverflow.com Mar 25 '12 at 14:20
This question came from our site for professional and enthusiast programmers.
add a comment |
up vote
6
down vote
favorite
Just curious, are these two completely equivalent?
chmod +x file
chmod 0755 file
bash shell
migrated from stackoverflow.com Mar 25 '12 at 14:20
This question came from our site for professional and enthusiast programmers.
2
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
Just curious, are these two completely equivalent?
chmod +x file
chmod 0755 file
bash shell
Just curious, are these two completely equivalent?
chmod +x file
chmod 0755 file
bash shell
bash shell
edited Dec 19 '16 at 22:10
DavidPostill♦
102k25218254
102k25218254
asked Mar 25 '12 at 13:06
rluks
2801312
2801312
migrated from stackoverflow.com Mar 25 '12 at 14:20
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com Mar 25 '12 at 14:20
This question came from our site for professional and enthusiast programmers.
2
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55
add a comment |
2
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55
2
2
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55
add a comment |
4 Answers
4
active
oldest
votes
up vote
7
down vote
accepted
chmod 0755 file
is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies default special modes (see comment below). See wikipedia for more info (including tables describing u,g,o,a and r,w,x,s,t,).
So in other words: No, they're not equivalent since 0755 contains more flags.
See also: chmod man page
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
add a comment |
up vote
6
down vote
Chmod number sets the permissions to exactly that number. Chmod relative only changes the requested bits. A file whose permissions were 000 before chmod +x
will now be 111. Conversely, a file whose permissions were 0775 before (read+write+execute for owner and group; read and execute for others) will be unchanged by chmod +x
, whereas setting the mode to exactly 0755 will change the 020 bit (remove write access for group).
add a comment |
up vote
3
down vote
No, because chmod 755
also sets various read and write flags.
add a comment |
up vote
0
down vote
Assuming your file was already chmod 644, then, yes, they are effectively equal. It's better to explicitly list the bits you want to set though, using something like a+x
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
chmod 0755 file
is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies default special modes (see comment below). See wikipedia for more info (including tables describing u,g,o,a and r,w,x,s,t,).
So in other words: No, they're not equivalent since 0755 contains more flags.
See also: chmod man page
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
add a comment |
up vote
7
down vote
accepted
chmod 0755 file
is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies default special modes (see comment below). See wikipedia for more info (including tables describing u,g,o,a and r,w,x,s,t,).
So in other words: No, they're not equivalent since 0755 contains more flags.
See also: chmod man page
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
chmod 0755 file
is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies default special modes (see comment below). See wikipedia for more info (including tables describing u,g,o,a and r,w,x,s,t,).
So in other words: No, they're not equivalent since 0755 contains more flags.
See also: chmod man page
chmod 0755 file
is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies default special modes (see comment below). See wikipedia for more info (including tables describing u,g,o,a and r,w,x,s,t,).
So in other words: No, they're not equivalent since 0755 contains more flags.
See also: chmod man page
edited Jul 28 '14 at 14:22
answered Mar 25 '12 at 13:10
keyser
1865
1865
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
add a comment |
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
That's not accurate. The 0 specifies set UID (4), get GID (2) and sticky bit (1) in the first of the 4 numbers. If omitted, it assumes a padded 0 on the front.
– iandouglas
Mar 25 '12 at 13:12
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
@iandouglas But "if omitted, it assumes a padded 0 on the front", should then mean that 0 is the default? So in other words, you're just saying that it should say "no special special modes" ?
– keyser5053
Mar 25 '12 at 13:26
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
To my knowledge, yes, 0 is an implied default, so "755" should be the same as "0755"
– iandouglas
Mar 25 '12 at 13:54
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
@iandouglas post edited
– keyser5053
Mar 25 '12 at 13:57
add a comment |
up vote
6
down vote
Chmod number sets the permissions to exactly that number. Chmod relative only changes the requested bits. A file whose permissions were 000 before chmod +x
will now be 111. Conversely, a file whose permissions were 0775 before (read+write+execute for owner and group; read and execute for others) will be unchanged by chmod +x
, whereas setting the mode to exactly 0755 will change the 020 bit (remove write access for group).
add a comment |
up vote
6
down vote
Chmod number sets the permissions to exactly that number. Chmod relative only changes the requested bits. A file whose permissions were 000 before chmod +x
will now be 111. Conversely, a file whose permissions were 0775 before (read+write+execute for owner and group; read and execute for others) will be unchanged by chmod +x
, whereas setting the mode to exactly 0755 will change the 020 bit (remove write access for group).
add a comment |
up vote
6
down vote
up vote
6
down vote
Chmod number sets the permissions to exactly that number. Chmod relative only changes the requested bits. A file whose permissions were 000 before chmod +x
will now be 111. Conversely, a file whose permissions were 0775 before (read+write+execute for owner and group; read and execute for others) will be unchanged by chmod +x
, whereas setting the mode to exactly 0755 will change the 020 bit (remove write access for group).
Chmod number sets the permissions to exactly that number. Chmod relative only changes the requested bits. A file whose permissions were 000 before chmod +x
will now be 111. Conversely, a file whose permissions were 0775 before (read+write+execute for owner and group; read and execute for others) will be unchanged by chmod +x
, whereas setting the mode to exactly 0755 will change the 020 bit (remove write access for group).
edited Nov 23 at 15:12
answered Mar 25 '12 at 14:24
tripleee
1,72832130
1,72832130
add a comment |
add a comment |
up vote
3
down vote
No, because chmod 755
also sets various read and write flags.
add a comment |
up vote
3
down vote
No, because chmod 755
also sets various read and write flags.
add a comment |
up vote
3
down vote
up vote
3
down vote
No, because chmod 755
also sets various read and write flags.
No, because chmod 755
also sets various read and write flags.
answered Mar 25 '12 at 13:10
Oliver Charlesworth
937510
937510
add a comment |
add a comment |
up vote
0
down vote
Assuming your file was already chmod 644, then, yes, they are effectively equal. It's better to explicitly list the bits you want to set though, using something like a+x
add a comment |
up vote
0
down vote
Assuming your file was already chmod 644, then, yes, they are effectively equal. It's better to explicitly list the bits you want to set though, using something like a+x
add a comment |
up vote
0
down vote
up vote
0
down vote
Assuming your file was already chmod 644, then, yes, they are effectively equal. It's better to explicitly list the bits you want to set though, using something like a+x
Assuming your file was already chmod 644, then, yes, they are effectively equal. It's better to explicitly list the bits you want to set though, using something like a+x
answered Mar 25 '12 at 13:14
iandouglas
1092
1092
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f404592%2fchmod-equivalence-of-x-and-0755%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
No, because +x just adds x to the current mask for everybody, not influencing rw, while 0755 changes the whole mask.
– Ondrej Kupka
Mar 25 '12 at 13:07
-1 You would have found this out if you read the man page for chmod and possibly the wpedia page for Filesystem permissions.
– Eroen
Apr 19 '12 at 15:55