Shared folder

I am trying to make a shared folder that every user on a single computer can use, at the moment everyone can access the folder but they cannot save an edited file. i couldn’t find a built in shared folder, however being new to linux i may not have looked in the right place.

Change the permissions of the folder like so:

chmod -R 777 /path/to/folder

Replace /path/to/folder with the path of the folder. Then everyone should be able to use it.

Hi, thanks for the response, however that still only changes the permissions of the folder. Any new files created in this folder still cannot be edited by other users. the file permissions of the folder are ‘drwxrwxrwx’. I need the shared folder to resemble windows public folder, where anyone who is logged in can access and change documents in the folder.

You need ACLs for this due to the inheritance required. First of all the filesystem must be mounted with the acl,user_xattr options before proceeding.

Next you put all the users you want to grant access in a particular group. The group users is already predefined in openSUSE, but you can also create a secondary group, e.g. in /etc/group you have:

editors:!:1000:alice,bob,carol

You can use YaST to create this entry, you don’t have to use the CLI.

The next step uses the CLI, maybe it can be done in YaST, I haven’t looked.

mkdir /some/shared/directory
setfacl -d -m g:editors:rwx /some/shared/directory

This sets the default ACL on that directory.

getfacl /some/shared/directory

will show that the editors group has rwx permission. Now you can create a file there.

touch /some/shared/directory/file
getfacl /some/shared/directory/file

will show that the file has rw permission for everybody in the editors group.

PS: Mode 777 is bad advice. It’s hardly ever needed.

OK i tried this, it says
getfacl: Removing leading ‘/’ from absolute path names

file: home/shared

owner: root

group: root

user::rwx
group::r-x# group: root
other::r-x
default:user::rwx
default:group::r-x
default:group:Staff:rwx
default:mask::rwx
default: other::r-x

other users cannot open or save to the folder at all now, i’m thinking it has something to do with “# group: root”.

any more help you can give would be appreciated.

Edit: added a space the last default line because it kept becoming a smilie

The line that matters is staff. Are your users in this group? If you have just added them to this group, they need to logout and login again; groups are instantiated per session. The command

groups

will show what groups their current session is in. Also group names should normally be lowercase.

The groups were made a few weeks ago, and i haven’t changed them since. i just tried with a different account, other accounts can now edit and save a file in this folder but cannot save a new file there. i’m begining to wonder why a shared folder hasn’t been included by defualt.

I think I forgot to mention to do this:

chgrp editors /some/shared/directory
chmod g+w /some/shared/directory

On 2010-11-03 14:41, Damo990 wrote:
>
> Hi, thanks for the response, however that still only changes the
> permissions of the folder. Any new files created in this folder still
> cannot be edited by other users. the file permissions of the folder are
> ‘drwxrwxrwx’.

You need to make this directory group SUID. Then all files created will
inherit the group settings.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

This post was really useful to me.

I did


# chmod g+s
# setfacl -d -m g:my_group:rwx /some/shared/directory

and all the new files belong to the group and inherits the group permissions.

Thanks a lot,

Pancho