chown problem
Hi
I want to create files then change the ownership so a group of users (webdevelopers) can access them. Should be simple but I get "Operation not permitted" if I do the chown as myself. I can chown as root but I don't want to. I own both the dir the files are in and the files so what's the issue? Thanks if you can help. [ann@localhost tom]$ rm test [ann@localhost tom]$ ls -l test ls: cannot access test: No such file or directory [ann@localhost tom]$ touch test [ann@localhost tom]$ ls -l test -rw-rw-r-- 1 ann ann 0 2008-04-10 14:26 test [ann@localhost tom]$ chown ann:webdevelopers test chown: changing ownership of `test': Operation not permitted [ann@localhost tom]$ ls -ld ../tom/ drwxrwxr-x 3 ann webdevelopers 4096 2008-04-10 14:26 ../tom/ [ann@localhost tom]$ |
The directory in which you are doing this might have the sticky bit set. Do this from the same location where you have this chown problem:
Code:
ls -ld . *ANOTHER EDIT* Well, do my command anyway. Maybe your prompt is mis-leading. Also, do this to see the filesystem type and mount options: Code:
mount |grep $(df -k . |tail -n 1 |awk '{ print $1 }') |
Also, do this:
Code:
lsattr -d . |
Try chgrp instead to change the group ownership.
Or you could use acl's instead and add that group to the read list. Code:
example: PPS. I was wrong about not being able to change a group with chown if the owner stays the same. |
Doh, I am silly. You're quite right. So you can switch to root first using su, or you can run using sudo if you have the right permissions.
|
I tried some of those but they don't enlighten me any.
I'm creating these files with a perl script, to chown as root I'd have to run the script as root which I'd rather not do. I'll investigate the acl's. In the mean time is there a shell command that will let you set the owner:group as you create the file? Thanks Code:
[ann@localhost tom]$ chgrp webdevelopers test |
No, you need root permissions to do this, as jschiwal said. Forget my posts. I have a hang over :)
|
Just to make sure you didn't miss the obvious..
You are logged in as user "ann" right? She needs to be a member of "webdevelopers" if she's going to chown files to that group's ownership. The error message ("Operation not permitted") is exactly the message you'd get if ann lacks group membership. (Yes, I noticed that the current directory was owned by ann:webdevelopers, but you might have not have gotten the Operation not permitted message if you chown'ed that directory as root) |
Yeah, ann's a member of webdevelopers group.
I find it really strange that you have to be root to chown on a file you own but you can setfacl on the same file as yourself!? Anyway, thanks jschiwal setfacl was exactly what I needed once I'd worked out what it was. :) |
All times are GMT -5. The time now is 08:01 PM. |