LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 07: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, 07:58 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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 08:00 AM.
 
Old 06-17-2011, 07:58 AM   #3
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
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, 08: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,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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, 10: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, 11:28 AM   #6
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
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



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 04:35 PM
Changing ownership of vfat mount maamold Linux - Software 2 02-25-2005 02:27 AM
changing the ownership djh Slackware 3 11-08-2004 04:16 AM
Changing ownership of folders Nurfen Linux - Newbie 1 08-01-2004 12:00 PM
changing users and group ownership dkc_ace Linux - General 4 02-03-2003 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:16 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
Open Source Consulting | Domain Registration