LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 08:20 AM   #1
Shay
Member
 
Registered: Sep 2003
Posts: 77

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 09:03 AM.
 
Old 04-12-2007, 08: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, 08:40 AM   #3
Shay
Member
 
Registered: Sep 2003
Posts: 77

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, 08: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, 08:47 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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 08:55 AM.
 
  


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 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 11:51 AM
moved files to unmounted drive, cannot find now mrelectron Linux - Software 2 11-13-2006 06:11 PM
help with chmod chown on cdrom copied files spacklebird Linux - Software 2 11-19-2003 12:48 AM
chmod vs chown on some root files and yes apps ergo_sum Linux - Newbie 3 11-12-2003 10:49 AM
Graphically setup user permissions (frontend to chmod and chown) sfonvill Linux - Security 2 08-27-2003 03:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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