Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am completely new to Unix. I want to access my friends file whose ls -l gives:

-r--r----- 1 root filename

Note that I am not the root user and just a normal user. My question is how to read this file? I tried to change the ownership by using chown and change the permission using chmod but it gives Operation not permitted.

Outputs of variuos commands :

$ ls -l 
total 4
-r--r----- 1 root abacus 373 Nov 12 19:19 abacus
$ groups
Wayne
$ cat abacus
abacus: Permission Denied 
share|improve this question

migrated from stackoverflow.com Nov 17 '12 at 23:55

This question came from our site for professional and enthusiast programmers.

1  
You can't. You don't own the file and the permissions don't give access to anything other than the user and group who own it. –  Joe Nov 17 '12 at 18:49
    
Is there some command by which I can know the group which I belong to ? –  Wayne Rooney Nov 17 '12 at 18:52
    
If your friend really agrees with you then he will apply other permissions to the file. Currently permission for you has been explicitly denied. There might be a reason for this. Ask him, if you agree that you should be able to read that file he might change the permissions. –  arkascha Nov 17 '12 at 18:53
1  
@you can find out your groups woth the command groups. –  arkascha Nov 17 '12 at 18:53
    
@arkascha :Using the groups command lists me in the group ..So I should be able to read the file, but I cant –  Wayne Rooney Nov 17 '12 at 18:55
show 6 more comments

2 Answers 2

up vote 1 down vote accepted

Based on the information given, it looks like you won't be able to read the file. The owner is root, and the group abacus; the file is set to be readable only by the owner and group. And it looks like you are not in the group; you are only in the group Wayne.

Unless your friend was asking you to try hacking his system (for instance, if he had left the /etc/group file world writeable, so you could add yourself to the abacus group), then you should not be able to read that file.

share|improve this answer
add comment

You cannot change the ownership of the file because you are not the superuser (root), and you do not already own the file. If you could change the ownership/permissions on files you do not own, it would completely nullify the whole purpose of the permissions/ownership mechanism, which is computer security.

If you were operating a multiuser system, would you want your users to be able to muck about with files they do not own? Would you like other users to modify your files without your permission?

share|improve this answer
    
Actually , we have had a bet on this.. He tells me that I can read the file , but I tried my best only to fail.. I am not trying to hack his system in anyway.. –  Wayne Rooney Nov 17 '12 at 18:58
    
That means you must be a member of the group called abacus; Seeing from the directory listing r--r--- I can see that the owner, and group members have read permissions -- no other permissions have been granted for this file. The `groups' command will tell you all the groups to which you are currently a member... –  vyudh Nov 17 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.