Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

It appears I still miss some things about the way permissions work. I am on a debian 7 system btw. just now I have this file of which I downloaded and it belongs to myuser:myuser, that is both user and group are set to me. It also resides in my $HOME directory since that is where I downloaded it to.

So far so good. Now I want to share this file with some other users of the pc and for that I want to switch the group ownership of the file to group "users". however that fails:

nass@quarx:~/xmas_carol$ chgrp -R users * 
chgrp: changing group of movie.mov': Operation not permitted

And the contents of the folder are:

-rwxr-xr-x 1 nass nass 2482411461 Feb  6 03:57 movie.mov

I am fuzzy about what is going on with the permissions. Can someone explain

share|improve this question
    
is /xmas_carol samba/nfs mount ? –  Rahul Patil Feb 6 at 2:21
add comment

2 Answers

up vote 4 down vote accepted

Your user is probably not a member of the users group, so you don't have the right to give a file to that group. To illustrate:

$ groups
terdon sudo netdev fuse vboxsf vboxusers

$ ls -l file
-rw-r--r-- 1 terdon terdon 604 Feb  6 03:04 file
$ chgrp users file
chgrp: changing group of ‘file’: Operation not permitted
$ chgrp vboxusers file
$ ls -l file
-rw-r--r-- 1 terdon vboxusers 604 Feb  6 03:04 file

On Debian, you can only change the group ownership to groups that your user belongs to. This is not true of some other systems.

share|improve this answer
add comment

It might be because the immutable bit is set. Get the list of file attributes running

lsattr /path/to/your/file

if i appears, then the immutable attribute is set and no one can modify the file (even root).

To remove the attribute you must run as root

chattr -i /path/to/your/file

To see more file system attributes read the man pages

man chattr
man lsattr
share|improve this answer
add comment

Your Answer

 
discard

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

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