Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-17-2011, 08:44 AM   #1
LQ Newbie
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
Changing ownership

Why would I need to be root to change the ownership of a file? Example:

I'm logged in as dwadmin and I've created a file:

-rw-rw---- 1 dwadmin dgw 0 Jun 17 07:46 testing.txt

I want to change the ownership to another user, but am getting the following error:

chown 511 testing.txt
chown: changing ownership of `testing.txt': Operation not permitted

511 is a member of dgw group
Old 06-17-2011, 08:58 AM   #2
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,211

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612
Nevermind... I didnt realize you were trying to do this as !root.



ls -alh
and post the output of . and ..


lsattr testing.txt

Last edited by szboardstretcher; 06-17-2011 at 09:00 AM.
Old 06-17-2011, 08:58 AM   #3
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 97
It's a security thing. What if user1 downloaded some inappropriate
files to a public directory and then changed ownership to user2?
It would look like user2 was responsible.

Also, if regular users could change ownership it would defeat the
purpose of disk quotas.
Old 06-17-2011, 09:03 AM   #4
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
An ordinary user cannot change ownership of a file; it's not an error, it's "operation not permitted."

If you think about a little, what havoc could be wreaked if users could willy-nilly do such?

One way around is for another user to copy a file to their own home directory (or any directory they can write in) -- that user will own the copied file.

Hope this helps some.
Old 06-17-2011, 11:31 AM   #5
Registered: Oct 2006
Location: bangalore
Distribution: Fedora, Ubuntu, Debian, Redhat
Posts: 82

Rep: Reputation: 6
It can be compared to giving away your clothes to someone else. But the receiving person is not aware that the used cloths are in his shelf..

So to prevent that only Super User has the privilege to take your clothes and give to someone else..
Old 06-17-2011, 12:28 PM   #6
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,329

Rep: Reputation: 254Reputation: 254Reputation: 254
I remember that it worked in the past, but was disabled when quotas were used anyway (to avoid that you flood someone else’s home directory). Looks like the default behavior changed.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing group ownership rayn0r Linux - Networking 1 11-28-2007 05:35 PM
Changing ownership of vfat mount maamold Linux - Software 2 02-25-2005 03:27 AM
changing the ownership djh Slackware 3 11-08-2004 05:16 AM
Changing ownership of folders Nurfen Linux - Newbie 1 08-01-2004 01:00 PM
changing users and group ownership dkc_ace Linux - General 4 02-03-2003 08:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration