2

I can't chmod 000 for a folder in Ubuntu 13.10

  • 1
    What happens when you try? – Seth Dec 10 '13 at 2:11
4

There is a manual page for chmod here.

Basically, look at this table on that page:

enter image description here

You can change the tick boxes, so that different people have different permissions.

Owner is the permissions on that file of the owner of the folder - usually the user that has created them - can be changed with chown.

Group is the permissions on that file of the group of the folder - can be changed with the chown or the chgrp commands.

Other is the permissions on that file of everyone who does not fall into the above two categories.

So running chmod 600 /PATH/TO/FILE will change the permissions so that only the owner can read the file, and write to it.

You can also do the same for folders, but by using chmod -R 600 /PATH/TO/FILE so the contents of the folder is the same as well.

The thing is, if you try entering it as 000:

enter image description here

Then no one can access or write to the file, except root, and the owner if they change the permissions again. This can work, but there is not much point to it as:

  • Anyone who is logged in as the owner could remove the file.
  • They could change the permissions back again, either by chmod, or by & Properties
  • If they are not the owner of the file, you do not need to chmod 000 .., just use chmod 600 ..

So if you want to stop people accessing the file, encrypting the file with a password would be the better idea. So to stop people accessing a file or folder, open Archive Manager, and click New - create one that you can encrypt (under Other Options) - I use .7z, as then you can encrypt the file list to. Then type the password you want to use.

enter image description here

Then you can add files:

enter image description here

Then you have an encrypted archive with your files secure inside - though it can still be deleted...

| improve this answer | |
  • Yeah..i want people to stop accessing a particular folder. How to encrypt it with a password? – Muddassir Nazir Dec 9 '13 at 23:10
  • 1
    Updated ridiculously long answer... :-) – Wilf Dec 9 '13 at 23:20
  • The owner does not have to have access, chmod 000 somedir works just fine. As the owner, you can still chmod it back later, or delete it regardless of the permissions. – psusi Dec 10 '13 at 2:59
  • @psusi for the purpose of preventing access to the file, it is better to encrypt it anyway - without permissions you can still see the contents... – Wilf Dec 10 '13 at 11:22
  • @wilf, sure, that's true... if you edit your answer I'll switch my vote. – psusi Dec 10 '13 at 14:34
2

The owner of the folder will always have to have access.

| improve this answer | |
  • This is incorrect. chmod 000 somedir works just fine. – psusi Dec 10 '13 at 2:59
  • 1
    @psusi but it doesn't stop you doing things to the directory. The same user can re-establish permissions or rm the directory, without issue. – Oli Dec 10 '13 at 9:13
  • @Oli - you don't even need to change the permissions - rm -f... (or rm -rf for a directory). – Wilf Dec 10 '13 at 16:51
1

But I am able to do this in my SLES Box

user@DemoBox:/export/home/n/user : ls -l test
ls: cannot access test: No such file or directory

user@DemoBox:/export/home/n/user : mkdir test
user@DemoBox:/export/home/n/user : ls -ld $_
drwx------ 2 user EDC_EOO_OS 6 Dec 10 04:35 test

user@DemoBox:/export/home/n/user : chmod 0000 $_
user@DemoBox:/export/home/n/user : ls -ld $_
d--------- 2 user EDC_EOO_OS 6 Dec 10 04:35 test

user@DemoBox:/export/home/n/user : lsb_release -a
LSB Version:    core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch
Distributor ID: SUSE LINUX
Description:    SUSE Linux Enterprise Server 11 (x86_64)
Release:        11
Codename:       n/a
| improve this answer | |
  • @Nischay.. is this a bug with Ubuntu or Suse?? Any way to do that in Ubntu?? – Muddassir Nazir Dec 9 '13 at 23:19
  • Currently I have no access to any ubuntu box and I never tried it on my ubuntu.I am just curious why you need this permission for any folder, This permission is going to make your folder unusable for everyone. – Nischay Dec 9 '13 at 23:24
  • If you have sudo(root) access on that box and everyone using same account to access machine, just change ownership to root and removed all permissions for group and other.After doing this folder is not going to accessible by anyone except root.You can also rename folder to a leading . like pics to .pics, by this folder is not visible in file manager until someone press ctrl+h. – Nischay Dec 9 '13 at 23:44
0

That way no one will have any access to that folder! You can hide it by adding . at the start of it's name. I believe chmod does not allow you to take all permissions away from the owner.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.