LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-12-2007, 09:20 AM   #1
Shay
Member
 
Registered: Sep 2003
Posts: 70

Rep: Reputation: 15
SOLVED: chown or chmod to restore perm. on files moved from another drive by root.


I backed up some files by moving them as root from my home directory to a slave drive. I have now moved those files from the slave drive back into my home directory and want to give them the same permissions/ownership they had before being moved from my home directory to the slave drive.

TIA

Last edited by Shay; 04-12-2007 at 10:03 AM.
 
Old 04-12-2007, 09:33 AM   #2
pbaldera
LQ Newbie
 
Registered: Nov 2005
Location: New York City
Distribution: RHEL3,4,5
Posts: 29

Rep: Reputation: 15
If you did not preserved the permissions and ownership the first time you copied them, I don't believe there is a way to restore them. You should have used something like "tar" or "rsync" to preserve the attributes.
 
Old 04-12-2007, 09:40 AM   #3
Shay
Member
 
Registered: Sep 2003
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pbaldera
If you did not preserved the permissions and ownership the first time you copied them, I don't believe there is a way to restore them. You should have used something like "tar" or "rsync" to preserve the attributes.
Nothing special about the permissions and ownership of the files. They were whatever the default is for new files.
 
Old 04-12-2007, 09:43 AM   #4
pbaldera
LQ Newbie
 
Registered: Nov 2005
Location: New York City
Distribution: RHEL3,4,5
Posts: 29

Rep: Reputation: 15
If that is the case your permissions are probably the same they were before, and you should only change the the ownership back. Just do a recursive chown on your home dir. chown -R <yourusername>:<yourgroup> /home/<yourhomedir>. Do this as root.
 
Old 04-12-2007, 09:47 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,036

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
As these files now belong to root, you'll have to be root to be permitted to change the ownership / group back to yourself, like this:
chown yourusername:yourgroup filename

Edit: If you are going to use the -R option as pbaldera recommends, you need to be very careful with your syntax & spelling, because if you accidentally type
Code:
chown -R <yourusername>:<yourgroup> / home/<yourhomedir>
when you are root, you will hose your system. (Notice the space after "/" and before "home")

Last edited by tredegar; 04-12-2007 at 09:55 AM.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chown/Chmod ff Directories/Files Question Genin Linux - Newbie 4 12-27-2006 12:51 PM
moved files to unmounted drive, cannot find now mrelectron Linux - Software 2 11-13-2006 07:11 PM
help with chmod chown on cdrom copied files spacklebird Linux - Software 2 11-19-2003 01:48 AM
chmod vs chown on some root files and yes apps ergo_sum Linux - Newbie 3 11-12-2003 11:49 AM
Graphically setup user permissions (frontend to chmod and chown) sfonvill Linux - Security 2 08-27-2003 04:12 PM


All times are GMT -5. The time now is 04: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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration