After setting chmod -R 0700 still current user can see and edit the files

I have a folder in my server I am setting this folder rights by

sudo chmod -R 0700 myfolder

when i print rights with ls -l everything is fine nobody has any right except root but i can open the file and even edit with the current user im signed in as .

why the rights doesnt work proper according to chmod i am suposed not to be able to do anything with the contents of the folder

id user and ls -ld folder output i am sharing below

enter image description here

4

1 Answer

As the output of ls -ld node suggests the node directory is owned by user nikos (and group nikos), not by root with a permission of 700. As a result being user nikos you you have read, write, execute permission in that directory.

Also note that sudo chmod -R 0700 myfolder does not change the ownership to root, it simply sets the permission bits as 0700 as user root. If you are the owner of that directory you could do it by chmod -R 0700 myfolder, no need for sudo.

There is a catch though, as we are doing it recursively -R, you need to have the files under myfolder directory owned by you to change their permissions. Otherwise the original permissions of those files will prevail.

Now if you want to make root as the owner of that directory and files under it (recursively):

sudo chown -R root node

If you want to make the owner group as group root too :

sudo chown -R root:root node

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like