Search code examples
linuxcommand-lineterminalsudolinux-mint

Linux Users adding to Directory


I have to create a shared folder under a directory, after that I have to create 2 users with their equally named home directories. It is required that the user can use the sudo command and both users should be able to edit each other's documents in the shared folder.

Can someone help me out with this? or give me the code, I tried adding users to the directory and stuff but I am stuck and also don't really understand the full exercise.

thank you


Solution

  • Creating the shared directory and common group

    $ sudo mkdir -p /var/test
    $ sudo groupadd test 
    

    Add the two user to the group

    $ sudo usermod -a -G test user1
    $ sudo usermod -a -G test user2
    

    Set the permission to directory

    $ sudo chgrp -R project /var/test/
    $ sudo chmod -R 2775 /var/test/