Sharing a directory with other account users on the same computer using Ubuntu
Introduction
This is a short tutorial about sharing a common directory under the Linux Operating System environment between account users on the same computer. It is assumed you have at least one user installed on your system and that also the current user has admin (sudo) account privileges. This tutorial has been created with the server environment in mind but should be transferable to the Desktop environment of the Linux OS without any changes as because all the changes are made using the command line. For the purpose of this tutorial we are using the "vim" editor but this can be substituted with any text editor you feel comfortable with.
Source - Shared DirectoriesFile modifications
The "/etc" directory holds many configurable files that if altered can effect how your computer does or does not operate. If you make changes to any files in this area whether an experience user or not, backup the file before you edit it - you have been warned. That said provided you stick to the commands and instructions defined below you should not have a problem with the workings of your Linux OS system.
Step 1 - Create the folder you want to share
You need to consider where you intend to share your folder. In this regard there are several trains of thought, for example you could place your share within your home directory or even share your own home directory with your colleagues. Whilst this may satisfy the needs of the share it fails in the respect of keeping anything private. A better way is to create a folder that can be shared between you leaving home directories for files that can only be edited and modified by yourself, and for the other account holders, home accounts for themselves. In Linux you can have user accounts with as many or as few group memberships as are required. So it is possible to set up a directory structure that can cater for many workgroup directories, we will only concern ourselves with one directory and one workgroup.
Create your shared directoryWhere in this case "public" (you can name this anything you like) is the name of the new folder being created which will reside in the "home" directory, this is a sensible place to add a shared folder, but by no means the only place. We needed to use "sudo" with this command as normal users are prevented from writing files or folders outside our own "/home/user" account directories. This however means we as users cannot write to this directory until permissions are changed on the folder, or anyone else for that matter, only root has access.
Step 2 - Create a new group
We need to create a group account which account users share in common with one another, so if we have three user accounts and we wanted two of these users to share a common group called "share", share would be the group name assigned with two of the users who could use that group. The following shows an example snippit of the "/etc/group" folder with an example share directory added at the bottom.
root:x:0: daemon:x:1: bin:x:2: sys:x:3: share:x:1005:user1,user2 user1:x:1000: user2:x:1001: user3:x:1002:The above can be added manually editing the "/etc/group" file directly thus:
You can replace vim with your preferred chosen editor if you wish. Add your new group entry similar to the share stipulated above, pay careful attention to double colons delimiters and syntax, be sure to use a high value number not currently used by any other other group name. Once you have completed your changes save the edited file.
The "/etc/group" file has a shadow file associated with it so you need to use the following command to convert it.
Step 3 - Alter the permissions of the shared folder
This next step requires two recursive changes to the selected folder, the first sets the owner and the group of the folder to be shared.
The second command defines the read and write access to the folder the sticky bit value "2" alters the directory so more than one account user can use it. "user1" and "user2" can now not only share this directory but add and alter its contents as required. They can also share and edit each others files and folders.
This completes this tutorial if you have any comments or suggestions please add them below.

