Subscribe to Email Updates

    | 2 min read

    Permission denied when deleting folders in Container

    After having mounted a Container with the command "mount.cifs", the user is unable to delete some folders and the answer to the command line is "Permission denied" message.

    The user can see in the folders in the Terminal:

    drwxr-xr-x 2 root root 0 Feb 23 2019 002_0238
    drwxr-xr-x 2 root root 0 Feb 23 2019 005_0131
    drwxr-xr-x 2 root root 0 Feb 23 2019 034_0142
    drwxr-xr-x 2 root root 0 Feb 23 2019 001_0144

     

    Problem :

    The problem is related to the linux permission itself.

    Explanation :

    The user which is used to mount the container has its own permission and the credendtial used to mount the container use also specific user. 

    Furthermore, you can see the permission is 755 (rwxr-xr-x), this means that there no body else than root has the right to write data into these folders. And then delete/create file in the directory.

    Solution 1 :

    From the client , in mount.cifs command, these parameters : dir_mode=0777, file_mode=0777 can be specified when mounting the container.

    The parameter dir_mode=077 and file_mode=0777 will force the permission on all file and directory mounted . Be careful this can bring all permission from the client.

     
    # sudo mount.cifs //nodeum/archive /mnt/testmnt -o user=johndoe,pass="secret",file_mode=0777,dir_mode=0777

     

    Solution 2 :

    When accessing the container, and write data through the container, it is the user and group specified in the mount.cifs command that will be use as ownership.

    But something you can discover that sometimes some files and folders have wrong ownership assignment. Then the solution is to change the ownership of the directory in the Nodeum file system to a user known by “nodeum”.

    # chown user1:group1 ./folder1

     

      

    Related Categories

    You may also like:

    Let Us Know What You Thought about this Post.

    Put your Comment Below.

    Learn and grow with award-winning support and a thriving community behind you.

    Get the free version