LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-17-2011, 08:44 AM   #1
cryste
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
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,774
Blog Entries: 1

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

Nevermind.

---Ignore----

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

Also

Code:
lsattr testing.txt

Last edited by szboardstretcher; 06-17-2011 at 09:00 AM.
 
Old 06-17-2011, 08:58 AM   #3
carltm
Member
 
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
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,476

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
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
ssrameez
Member
 
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
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,326

Rep: Reputation: 253Reputation: 253Reputation: 253
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.

NB: http://www.gnu.org/software/coreutil...own-files_003f
 
  


Reply


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


All times are GMT -5. The time now is 08:56 PM.

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