Sharing Files on Unix

Here’s a task I’ve had to do many times and I’m always looking one or two (or all) of the commands up on the interwebz.

Sharing is caring - Oasis 21

How to setup file sharing between two unix users.

1
2
3
4
5
6
7
8
9
10
11
12
$ groupadd new_group

# add both users to the new group  
$ sudouseradd -G new_group user1
$ sudouseradd -G new_group user2

# update the folder's group to be the new_group and make it sticky
$ chgrp -R new_group folder_to_share
$ chmod g+w folder_to_share
$ chmod g+s folder_to_share

# verify the umask setting for the user ensures group files are readable (this is normally the default)