
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create a Shared Directory for All Users in Linux
When multiple users need access to the same set of directories of files then we need to create shared folders to be used by the users. In Linux there is concept of users and groups which can be given certain level of permissions that will enable them to share the data. Below are the steps how to create the shared folders where users can and update the files individually.
Step 1 − Create the folder to be shared
Assuming we are setting up the shared folder from scratch, lets create the folder. The -p will create the directory and would ignore any errors if the directory already exists.
sudo mkdir -p /bigproject/sharedFolder
Step 2 − Create a user group
Next, we create a user group that will be used by users requiring access to this folder.
sudo groupadd SharedUsres
Step 3 − Create a user group
Next we create a user group which will be used by users requiring access to this folder.
sudo groupadd SharedUsres
Step 4 − Give permissions
Now we assign the new group to become owner of the shared folder and give them appropriate permissions which can also be inherited by the subdirectories.
sudo chgrp -R SharedUsers /bigproject/sharedFolder sudo chmod -R 2775 /bigproject/sharedFolder
Step 5 − Add users to the group
Now we add usernames to this group show that they can use the shared folder.
useradd -D -g SharedFolder user1 useradd -D -g SharedFolder user2