LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 11-29-2006, 08:05 AM   #1
nocnoc
LQ Newbie
 
Registered: Nov 2006
Posts: 8

Rep: Reputation: 0
disk crashing and moving /home to a new server but all permissions are root HELP!


Hello all,

We have an ftp site here on redhat 9 (the only linux server on the network) the disk is failing and we are in the process of bringing up a new redhat server. So far what we have done was copied the user conf files from the old server to the new server and the /home directory from the old to the new server. The problem that we are running into now is that the users cannot log in b/c they don't have permissions to thier home directory. When I do an ls -l all 136 /home/<home directory> are root owned

drwx------ 5 root root 4096 Nov 28 21:25 foldername1
drwxr-xr-x 2 root root 4096 Nov 28 18:58 foldername2
drwx------ 9 root root 4096 Nov 29 03:44 foldername3
drwx------ 2 root root 4096 Nov 29 00:04 foldername4
drwxr-xr-x 3 root root 4096 Nov 29 01:16 foldername5
drwx------ 4 root root 4096 Nov 29 06:11 foldername6
drwx------ 2 root root 4096 Nov 28 18:58 foldername7
drwx------ 3 root root 4096 Nov 28 22:17 foldername8
drwx------ 2 root root 4096 Nov 29 03:50 foldername9
drwx------ 6 root root 4096 Nov 29 00:00 foldername10
drwxr-xr-x 2 root root 4096 Nov 28 18:58 foldername11
drwxr-xr-x 2 root root 4096 Nov 28 18:58 foldername12
drwx------ 2 root root 4096 Nov 28 19:29 foldername13
drwxr-xr-x 2 root root 4096 Nov 28 18:58 foldername14
drwx------ 31 root root 4096 Nov 28 22:06 foldername15
drwx------ 6 root root 4096 Nov 29 05:24 foldername16
drwx------ 3 root root 4096 Nov 29 06:32 foldername17
drwxr-xr-x 2 root root 4096 Nov 28 19:08 foldername18
drwx------ 2 root root 4096 Nov 28 22:19 foldername19

How can I preserve the ownership of these directories when moving the /home directory from the old server (dying) to the new server. Or is there a file in /etc that has all this info that I could copy over.

Thanks
 
Old 11-29-2006, 08:37 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,999
Blog Entries: 54

Rep: Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756
Hello and welcome to LQ, hope you like it here.

To preserve DAC rights see "man cp", under "--preserve". Since you have already copied over all files it would be easier to use a wee script to change ownership provided the users have the same UID and GID in the new system (/etc/passwd and /etc/group). On the old system run:
Code:
find /home -type d -maxdepth 1 | while read dir; do 
 [ "${dir}" != "/home" ] && stat -c "chmod %a %n; chown -R %u:%g %n" "${dir}"
done | tee /tmp/chownhome.sh
This will produce a script with lines looking like this:
Code:
chmod 700 /home/lost+found; chown -R 0:0 /home/lost+found
chmod 700 /home/user0; chown -R 501:501 /home/user0
chmod 700 /home/user1; chown -R 502:502 /home/user1
# ad nauseam
Inspect to verify contents are OK.
Copy "/tmp/chownhome.sh" to the new system.
Run as root account user:
Code:
sh /tmp/chownhome.sh
YMMV(VM) as usual.

Last edited by unSpawn; 11-29-2006 at 10:49 AM. Reason: //correct bb code tag usage
 
Old 11-29-2006, 09:10 AM   #3
nocnoc
LQ Newbie
 
Registered: Nov 2006
Posts: 8

Original Poster
Rep: Reputation: 0
unSpawn

Thanks for the reply the script does in fact work but I don't see /tmp/chownhome.sh anywhere.
 
Old 11-29-2006, 10:51 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,999
Blog Entries: 54

Rep: Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756Reputation: 2756
I don't see /tmp/chownhome.sh anywhere
You didn't copy it to the new server?
 
Old 11-29-2006, 11:29 AM   #5
nocnoc
LQ Newbie
 
Registered: Nov 2006
Posts: 8

Original Poster
Rep: Reputation: 0
I got it now. I was looking in the wrong server for it.

Thanks
 
  


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
moving /home drummerdan Slackware 8 03-16-2006 10:30 PM
moving /home /root & /var to new partition CrashedAgain Linux - General 8 11-24-2005 10:44 AM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM
need help moving home shaggystyle Linux - Hardware 15 09-01-2004 12:31 AM
Moving /home xodeus Slackware 7 10-06-2003 03:33 PM


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

Main Menu
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