Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
For some reason, I often run into the problem that I can not change the group for a directory. Can somebody explain why I (as owner and member of the group develop) can not change the group for a directory using chown or chgrp.
Code:
wim@btd-techweb01:~/tacinc/web$ ls -ld ~
drwx--x--x 20 wim users 1688 2007-02-05 16:32 /home/wim/
wim@btd-techweb01:~/tacinc/web$ ls -ld ~/tacinc
drwxr-xr-x 4 wim develop 96 2007-01-18 12:41 /home/wim/tacinc/
wim@btd-techweb01:~/tacinc/web$ ls -ld ~/tacinc/web
drwxr-xr-x 4 wim develop 1128 2007-02-06 07:04 /home/wim/tacinc/web/
wim@btd-techweb01:~/tacinc/web$ ls -ld ~/tacinc/web/files
drwxr-xr-x 2 wim develop 48 2007-02-06 07:04 /home/wim/tacinc/web/files/
wim@btd-techweb01:~/tacinc/web$ chgrp nobody files
chgrp: changing group of `files': Operation not permitted
wim@btd-techweb01:~/tacinc/web$
Both chgrp and chown result in 'operation not permitted'.
Above listing comes from a Slackware 10.1 box and the directory files is empty.
Distribution: At home: Arch, OpenBSD, Solaris. At work: CentOS, Debian, Ubuntu
Posts: 3,558
Rep:
You cannot change a file or directory's group ownership to a group you do not belong to. You are a member of the develop group but not the nobody group I assume.
Distribution: At home: Arch, OpenBSD, Solaris. At work: CentOS, Debian, Ubuntu
Posts: 3,558
Rep:
Actually chgrp works fine as a normal superuser, but you have to be a member of the target group. In addition chown will allow you ro change the group as a normal user, but not the file's owner (only root can do that on Linux -- some *nix systems do allow chowns by a normal user).
@btmiller,
That makes sense. I changed it as root to group 'nobody' and next changed it back (as wim) to group 'develop'. As I'm indeed not a member of nobody, you are right
@Junior
I can run that command as user (see reply to btmiller)
Thanks both for the thoughts.
Last edited by Wim Sturkenboom; 02-06-2007 at 01:40 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.