LinuxQuestions.org
Review your favorite Linux distribution.
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 07-04-2011, 03:28 AM   #1
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Rep: Reputation: 0
Why does mv change the owner in one system but not another?


Hi Guys

We have two systems (well we have more but these are the only two I am interested in ) - DEV and PROD.

In DEV we can create a file as the oracle user, eg:

Code:
[root@dev]# touch test.txt
[root@dev]# chown oracle:oinstall test.txt
[root@dev]# chmod 644 test.txt
[root@dev]# ls -lah test.txt
-rw-r--r-- 1 oracle oinstall 11 Jul  4 15:16 test.txt
When we move it to /var/tmp it gets changed to the user moving it:
Code:
[simon.tann@dev ~]$ mv test.txt /var/tmp/
[simon.tann@dev ~]$ ls -lah /var/tmp/test.txt
-rw-r--r-- 1 simon.tann domain users 11 Jul  4 15:16 /var/tmp/test.txt
When do the same thing in our production environment the user stays as the oracle user.

Can anyone tell me why this is happening? Is it something to do with groups or file creation masks?
 
Old 07-04-2011, 03:41 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
A regular user isn't able to create a file owned by another user. If the destination is on the same filesystem, a mv will change the directory entries. The file itself doesn't move. If you move a file to a directory on another file system, you are performing a copy & delete.

I bet that on one system, you either moved the file as root, or /tmp is on the same file system.

Last edited by jschiwal; 07-04-2011 at 03:43 AM.
 
1 members found this post helpful.
Old 07-04-2011, 04:19 AM   #3
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
A regular user isn't able to create a file owned by another user. If the destination is on the same filesystem, a mv will change the directory entries. The file itself doesn't move. If you move a file to a directory on another file system, you are performing a copy & delete.

I bet that on one system, you either moved the file as root, or /tmp is on the same file system.
Hi, thanks for your response.

You were right - in our production system /var is on the / partition whereas on DEV its in its own partition. We have performed some more testing and have confirmed this.

Thanks very much!
 
  


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
chown cannot change owner PMP Linux - Newbie 6 07-07-2009 05:56 AM
How to change 1000 owner Jan Tanjo Linux - Newbie 2 12-24-2008 08:56 PM
Change Owner on many files how to? linchat Linux - General 2 02-23-2006 05:14 PM
Change owner arubin Linux - Newbie 3 04-30-2004 01:23 PM
Change owner juno Linux - General 3 01-08-2003 08:03 AM


All times are GMT -5. The time now is 10:46 AM.

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