linux permission conflicts

3

3

I'd like to ask you something that's bothering me for the last couple of days. On my system I keep a folder called myscripts under my usual home folder.

What I tried to do is

chmod 500 myscripts

and pressed enter. After that I did

ls -l ~ 

to confirm and I got

dr-x------  2 Konos5 people    2048 Jun 21 22:51 myscripts

From what I understand I now should not be able to write anything within the myscripts folder. However if I type

touch ~/myscripts/hello.txt

the file hello.txt is normally created. How is that happening and what happened to the "no write" permission bit?

And one last thing. Before I change the permissions of that folder I had already kept the infamous youtube-dl script with -rwx- permissions. If I now run the script it will automatically download a youtube video and write it on my disk (within myscripts folder). Again, how is that possible since the folder's permissions are -rx- only?

Thank you in advance

kstratis

Posted 2012-06-21T22:08:26.630

Reputation: 159

1Are you probably root? Please add the output of whoami or echo $UID. – speakr – 2012-06-21T22:15:58.103

I am Konos5. Not root. That's why I am confused. – kstratis – 2012-06-21T22:32:50.807

Answers

4

Since you mentioned that you're using your school's server, I suspect your home directory is on AFS. AFS does not respect Unix permissions on directories at all, but there are AFS-specific permissions you can use instead. For example, see here for details.

jjlin

Posted 2012-06-21T22:08:26.630

Reputation: 12 964

I was just about to mention that. Indeed the server runs of AFS. If that's the case however then shouldn't we worry about security? – kstratis – 2012-06-21T22:49:57.057

Not necessarily. It's not like AFS has no permissions system at all. It just happens to have its own system, and mostly ignores the Unix permission bits. See my link for details. – jjlin – 2012-06-21T22:53:24.707

1

If your home is not on a file system which doesn't respect unix file permissions (like ASF, see this answer), you are most probably root.

Otherwise, you wouldn't be able to write to the myscripts folder even if you were logged in as the owner Konos5. The only exception is the root user who "has always access to everything".

However, as owner you can always change back the access rights and give yourself write access again.

speakr

Posted 2012-06-21T22:08:26.630

Reputation: 3 379

I am not root. I am using my school's server. – kstratis – 2012-06-21T22:31:33.540

Is the folder a symlink? – speakr – 2012-06-21T22:32:16.050

@speakr ls -l would have shown that, wouldn't it? – Darth Android – 2012-06-21T22:32:53.193

@DarthAndroid Right, I missed that. – speakr – 2012-06-21T22:36:04.500

-1

You will always have access to the folder (of which you are owner) <= that was wrong, it should be "if you are root".

Andrew Smith

Posted 2012-06-21T22:08:26.630

Reputation: 105

This is not correct, please see here.

– speakr – 2012-06-21T22:30:58.110