|
|
[[_TOC_]]
|
|
|
## Sharing directories
|
|
|
|
|
|
When a group of user need to share directories/files (files from now on) on a server, they need first need to have a common group that we will call *project* in this example. Then they need to set the group and permission of those files according to the intended level of sharing (read/write/exec).
|
|
|
|
|
|
### Having a common group
|
|
|
|
|
|
If the group is not already setup, [ask DSI](https://ent.oca.eu) for it creation. You will be asked a list of member that can be adjusted later on.
|
|
|
|
|
|
To know the group information of a given user you can use the **id** command:
|
|
|
```
|
|
|
[alainm@zztop ~]$ id alainm
|
|
|
uid=34105(alainm) gid=401(sit) groups=401(sit),517(galilee),485(gspspec), 109(project)...
|
|
|
```
|
|
|
### Setting the user group
|
|
|
|
|
|
In the example above, user *alainm* has a group *sit* (**gid**) and is a member of groups *sit*, *galilee*, *project* and *gspspec*. In order to share conveniently files inside the group project, you need to have that as your group (not just be part of that group).
|
|
|
|
|
|
Either your group is already *project*:
|
|
|
```
|
|
|
[alainm@zztop ~]$ id alainm
|
|
|
uid=34105(alainm) gid=109(project) groups=401(sit),517(galilee),485(gspspec), 109(project)...
|
|
|
```
|
|
|
|
|
|
or you need to start a new shell session with that group through the **newgrp* command:
|
|
|
```
|
|
|
[alainm@zztop ~]$ id alainm
|
|
|
uid=34105(alainm) gid=401(sit) groups=401(sit),517(galilee),485(gspspec), 109(project)...
|
|
|
[alainm@zztop ~]$ newgrp project
|
|
|
[alainm@zztop ~]$ id alainm
|
|
|
uid=34105(alainm) gid=109(project) groups=401(sit),517(galilee),485(gspspec), 109(project)...
|
|
|
```
|
|
|
That change is specific to the current session.
|
|
|
|
|
|
**DO NOT** use the **newgrp** command in you shell config script, as that command start a new shell. You can **ask** support to make that group your default gid if you want.
|
|
|
|
|
|
From now own, the files you will be creating will have the group project:
|
|
|
```
|
|
|
[alainm@zztop ~]$ touch znort
|
|
|
[alainm@zztop ~]$ ls -l znort
|
|
|
-rw-r--r-- 1 alainm project 0 Feb 10 12:33 znort
|
|
|
[alainm@zztop ~]$
|
|
|
```
|
|
|
|
|
|
### Setting new files permissions
|
|
|
|
|
|
If you want to share files inside a group, you might want to allow group members to read, write or execute those file. Use the the **umask** command to automatically set the permissions of the files you create. Here:
|
|
|
```
|
|
|
[alainm@zztop ~]$ umask 0007
|
|
|
[alainm@zztop ~]$ umask
|
|
|
0007
|
|
|
[alainm@zztop ~]$
|
|
|
```
|
|
|
Group member will have the same permissions as you for your newly created file, while other user won't have any permissions.
|
|
|
|
|
|
## [Sharing Directories](Storage/Sharing Directories)
|
|
|
How to share files and directories inside a group of users.
|
|
|
## Tips & tricks
|
|
|
* [Knowing the footprint of your directories](Storage/Knowing the footprint of your directories) |