04 August 2021

Sharing a folder between users on the same Linux machine

This method creates a group named sharedFolder, and a folder on root, which can be used by user1 and user2, for sharing files.

First create the group and folder:

sudo groupadd sharedFolder
sudo mkdir /sharedFolder

 

Now set permissions:

sudo chgrp sharedFolder /sharedFolder
sudo chmod 770 /sharedFolder

Ensure that even subdirectories will have the permissions.
sudo chmod +s /sharedFolder

Add the users to the group:
sudo usermod -a -G sharedFolder user1
sudo usermod -a -G sharedFolder user2


This is especially useful after you've got rid of Windows (really, I've given up on Windows now) and need a way to share files without creating a separate NTFS partition which needs to be mounted to be used.

No comments: