Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Feb 2004 00:42:01 -0600
From:      Bob Martin <bob@buckhorn.net>
To:        "Scott St. John" <ssj@scottah.com>
Cc:        freebsd-isp@freebsd.org
Subject:   Re: Final conversion questions
Message-ID:  <404189B9.6040801@buckhorn.net>
In-Reply-To: <20040228211439.M89441@scottah.com>
References:  <20040228191105.M42305@scottah.com> <4040F1A8.1070108@buckhorn.net> <20040228211439.M89441@scottah.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040709050703010304040203
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Scott,
After you move the directories, use the attached perl script (run as 
root). Use the -r option to scp, and you'll get all files, including . 
files.

Bob Martin



Scott St. John wrote:
> Bob-
> 
> I do not have a NFS connection between the two boxes, I am using scp to 
> transfer files between the Linux and the new FreebSD boxes.  I used John The 
> Ripper to merge my passwd and shadow files and then used some awk scripts 
> from the OpenBSD site to format, then create my new passwd file for BSD.  I 
> am almost sure the UID/GID will NOT be the same since BSD starts at a 
> different # than Linux where my first UID is 1000.
> 
> If you have it, it sounds like the perl script would be the better trick 
> since it would check the passwd file instead of assuming the UID/GID were 
> the same.
> 
> Thanks!
> 
> -Scott
> 
> On Sat, 28 Feb 2004 13:53:12 -0600, Bob Martin wrote
> 
>>Scott,
>>I haven't followed this thread closely enough, but from what you're
>>saying, it sounds like you have a NFS connection between the 2 boxen.
>>That being the case, and since the UID/GID's are the same on both boxen
>>(IIRC you moved the Linux accounts to the BSD box), the following
>>command will get all of the files, and maintain the permissions:
>>
>>cp -pRP /<linux mount point/home/* /home/
>>
>>If the UID/GID's have changed, then this command will fix them for you:
>>(Note, this assumes you use bash as your shell)
>>cd /home
>>for a in `ls -1 /home`;do chown -R $a:users $a;done
>>
>>That command does assume that you have a 1 to 1 relationship between
>>home directories and usernames. If not, let me know and I'll find my
>>little perl script that reads /etc/passwd and sets the permissions.
> 
> 
> _______________________________________________
> freebsd-isp@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-isp
> To unsubscribe, send any mail to "freebsd-isp-unsubscribe@freebsd.org"

--------------040709050703010304040203
Content-Type: text/plain;
 name="HomePerms.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="HomePerms.pl"

#!/usr/bin/perl
$Home = "/home";

open(PASSWD, '/etc/passwd') or die("Can't open password: $!\n");
while (<PASSWD>) {
        chomp;
        ($login, $passwd, $uid, $gid, $gcos, $home, $shell) = split(/:/);
        system("chown -R $uid:$gid $home") or die("Error: $!\n");
        print "$login, $uid, $gid, $home\n";
}

--------------040709050703010304040203--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?404189B9.6040801>