File server permission
up vote
0
down vote
favorite
I am trying to give 2 users rwx access to a new shared directory i have created that will hold some shared documents. The directory is /srv/shared
The 2 users are Mason and Bill that will be accessing the files. I would like both users to be able to rwx any newly created files/directories by each other.
I have added Bill to the group Mason with sudo usermod -a -G mason bill
I then changed the /srv/shared
ownership to Mason and group Mason with sudo chown mason:mason /srv/shared
I then tried creating a directory in /srv/shared
logged in as bill with mkdir /srv/shared/test
but got access denied. I tried giving the directory chmod 755 permissions but that still gave Bill access denied when creating files. When i gave chmod permissions 777 Bill could then create directories and files without an issue.
Just trying to work out what I have done wrong for this to only work with 777 permissions which is not really what i want to allow?
permissions
add a comment |
up vote
0
down vote
favorite
I am trying to give 2 users rwx access to a new shared directory i have created that will hold some shared documents. The directory is /srv/shared
The 2 users are Mason and Bill that will be accessing the files. I would like both users to be able to rwx any newly created files/directories by each other.
I have added Bill to the group Mason with sudo usermod -a -G mason bill
I then changed the /srv/shared
ownership to Mason and group Mason with sudo chown mason:mason /srv/shared
I then tried creating a directory in /srv/shared
logged in as bill with mkdir /srv/shared/test
but got access denied. I tried giving the directory chmod 755 permissions but that still gave Bill access denied when creating files. When i gave chmod permissions 777 Bill could then create directories and files without an issue.
Just trying to work out what I have done wrong for this to only work with 777 permissions which is not really what i want to allow?
permissions
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to give 2 users rwx access to a new shared directory i have created that will hold some shared documents. The directory is /srv/shared
The 2 users are Mason and Bill that will be accessing the files. I would like both users to be able to rwx any newly created files/directories by each other.
I have added Bill to the group Mason with sudo usermod -a -G mason bill
I then changed the /srv/shared
ownership to Mason and group Mason with sudo chown mason:mason /srv/shared
I then tried creating a directory in /srv/shared
logged in as bill with mkdir /srv/shared/test
but got access denied. I tried giving the directory chmod 755 permissions but that still gave Bill access denied when creating files. When i gave chmod permissions 777 Bill could then create directories and files without an issue.
Just trying to work out what I have done wrong for this to only work with 777 permissions which is not really what i want to allow?
permissions
I am trying to give 2 users rwx access to a new shared directory i have created that will hold some shared documents. The directory is /srv/shared
The 2 users are Mason and Bill that will be accessing the files. I would like both users to be able to rwx any newly created files/directories by each other.
I have added Bill to the group Mason with sudo usermod -a -G mason bill
I then changed the /srv/shared
ownership to Mason and group Mason with sudo chown mason:mason /srv/shared
I then tried creating a directory in /srv/shared
logged in as bill with mkdir /srv/shared/test
but got access denied. I tried giving the directory chmod 755 permissions but that still gave Bill access denied when creating files. When i gave chmod permissions 777 Bill could then create directories and files without an issue.
Just trying to work out what I have done wrong for this to only work with 777 permissions which is not really what i want to allow?
permissions
permissions
edited Nov 25 at 23:44
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked Aug 27 '17 at 10:24
Mason
162
162
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35
add a comment |
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
Add the users mason
and bill
to a new group, lets call them mbshare
. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.
// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill
Now mason
and bill
can create and edit files in /path/to/share
.
The 2
in the 2775
permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.
If you only want mason
and bill
to see the files within the share, use 2770
instead of 2775
.
The advantages of creating a custom group are significant.
- It is easy to add or remove a new user to the group.
- You can quickly see who has access to the group.
- You can remove any user without the need to change any permissions.
- Keeps things very neat and tidy :]
Edit: Corrected a few "from memory" errors.
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thembshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example:internalshare
,groupshare
,projectname
,sharedjunk
. What ever you call the group, substitute that in place ofmbshare
in thechown
.
– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
add a comment |
up vote
0
down vote
It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Add the users mason
and bill
to a new group, lets call them mbshare
. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.
// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill
Now mason
and bill
can create and edit files in /path/to/share
.
The 2
in the 2775
permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.
If you only want mason
and bill
to see the files within the share, use 2770
instead of 2775
.
The advantages of creating a custom group are significant.
- It is easy to add or remove a new user to the group.
- You can quickly see who has access to the group.
- You can remove any user without the need to change any permissions.
- Keeps things very neat and tidy :]
Edit: Corrected a few "from memory" errors.
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thembshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example:internalshare
,groupshare
,projectname
,sharedjunk
. What ever you call the group, substitute that in place ofmbshare
in thechown
.
– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
add a comment |
up vote
1
down vote
Add the users mason
and bill
to a new group, lets call them mbshare
. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.
// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill
Now mason
and bill
can create and edit files in /path/to/share
.
The 2
in the 2775
permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.
If you only want mason
and bill
to see the files within the share, use 2770
instead of 2775
.
The advantages of creating a custom group are significant.
- It is easy to add or remove a new user to the group.
- You can quickly see who has access to the group.
- You can remove any user without the need to change any permissions.
- Keeps things very neat and tidy :]
Edit: Corrected a few "from memory" errors.
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thembshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example:internalshare
,groupshare
,projectname
,sharedjunk
. What ever you call the group, substitute that in place ofmbshare
in thechown
.
– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
add a comment |
up vote
1
down vote
up vote
1
down vote
Add the users mason
and bill
to a new group, lets call them mbshare
. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.
// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill
Now mason
and bill
can create and edit files in /path/to/share
.
The 2
in the 2775
permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.
If you only want mason
and bill
to see the files within the share, use 2770
instead of 2775
.
The advantages of creating a custom group are significant.
- It is easy to add or remove a new user to the group.
- You can quickly see who has access to the group.
- You can remove any user without the need to change any permissions.
- Keeps things very neat and tidy :]
Edit: Corrected a few "from memory" errors.
Add the users mason
and bill
to a new group, lets call them mbshare
. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.
// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill
Now mason
and bill
can create and edit files in /path/to/share
.
The 2
in the 2775
permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.
If you only want mason
and bill
to see the files within the share, use 2770
instead of 2775
.
The advantages of creating a custom group are significant.
- It is easy to add or remove a new user to the group.
- You can quickly see who has access to the group.
- You can remove any user without the need to change any permissions.
- Keeps things very neat and tidy :]
Edit: Corrected a few "from memory" errors.
edited Aug 28 '17 at 8:56
answered Aug 27 '17 at 10:38
Tigger
2,001812
2,001812
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thembshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example:internalshare
,groupshare
,projectname
,sharedjunk
. What ever you call the group, substitute that in place ofmbshare
in thechown
.
– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
add a comment |
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thembshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example:internalshare
,groupshare
,projectname
,sharedjunk
. What ever you call the group, substitute that in place ofmbshare
in thechown
.
– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
– Mason
Aug 27 '17 at 10:42
The
mbshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example: internalshare
, groupshare
, projectname
, sharedjunk
. What ever you call the group, substitute that in place of mbshare
in the chown
.– Tigger
Aug 27 '17 at 10:48
The
mbshare
group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example: internalshare
, groupshare
, projectname
, sharedjunk
. What ever you call the group, substitute that in place of mbshare
in the chown
.– Tigger
Aug 27 '17 at 10:48
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
– Mason
Aug 27 '17 at 10:55
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
@Mason Fixed a number of errors.
– Tigger
Aug 28 '17 at 8:56
add a comment |
up vote
0
down vote
It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.
add a comment |
up vote
0
down vote
It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.
add a comment |
up vote
0
down vote
up vote
0
down vote
It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.
It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.
answered Aug 27 '17 at 12:20
Rengas
1011
1011
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f388629%2ffile-server-permission%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
How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
– ivanivan
Aug 27 '17 at 13:35