Koozali.org: home of the SME Server

User password migration

mstenson

User password migration
« on: April 03, 2004, 01:42:08 AM »
I know this has been broached before and I've searched and read a considerable number of posts pertaining to this I have not seen an answer.  I will very shortly need to be able to transfer user passwords from one box to the other.  Is there anyway of forcing the SME server to reread /etc/passwd and /etc/shadow and synch the passwords?

Anonymous

User password migration
« Reply #1 on: April 19, 2004, 10:53:06 PM »
I ended up coming up with something that seems to work well.  Solution follows:

Prepare the old server files for transfer.

Create a folder called migrate in /home/e-smith/ This will allow you to access
the dir via ftp using a standard user account.  Make a tarball of the
/home/e-smith/files/users/ dir.  You will want to use a -cvf switch to save
permissions and you may want to gzip it .  Once this
is completed cp this file /home/e-smith/migrate.  At this point you'll want to
edit the /etc/passwd , /etc/shadow and , /etc/group and /home/e-smith/accounts
files to reflect the users you're transferring over only as below:

/etc/passwd

user1:x:5000:5000:user1 user1:/home/e-smith/files/users/user1:/bin/sshell
user2:x:5001:5001:user2 user2:/home/e-smith/files/users/user2:/bin/sshell
user3:x:5002:5002:user user3:/home/e-smith/files/users/user3:/bin/sshell

/etc/shadow

user1:$1$LCqIGQFA$d23Oz4iH/PO5lBkVnRMzP0:12507:0:99999:7:-1:-1:-1
user2:$1$3hQM1eaj$ovJkcE8d1w30sxTiJ2xZc.:12507:0:99999:7:-1:-1:-1
user3:$1$n6ao2Y59$l3pQBkaFL.aXF1qIwMuvt/:12514:0:99999:7:-1:-1:-1

/etc/group

user1:x:5000:
user2:x:5001:
user3:x:5002:

/home/e-smith/accounts

ser.user3=pseudonym|Account|user3
user1=user|City|Ottawa|Company|XYZ
Corporation|Dept|Main|EmailForward|local|FirstName|user1|ForwardAddress||LastName|user1|PasswordSet|yes|Phone|555-5555|Street|123
Main Street|Uid|5000|VPNClientAccess|no
user1.user1=pseudonym|Account|user1
user1_user1=pseudonym|Account|user1
user2=user|City|Ottawa|Company|XYZ
Corporation|Dept|Main|EmailForward|local|FirstName|user2|ForwardAddress||LastName|user2|PasswordSet|yes|Phone|555-5555|Street|123
Main Street|Uid|5001|VPNClientAccess|no
user2.user2=pseudonym|Account|user2
user2_user2=pseudonym|Account|user2
user3=user|City|Ottawa|Company|XYZ
Corporation|Dept|Main|EmailForward|local|FirstName|user|ForwardAddress||LastName|user3|PasswordSet|yes|Phone|555-5555|Street|123
Main Street|Uid|5002|VPNClientAccess|no
user_user3=pseudonym|Account|user3

Save these in the /home/e-smith/migrate folder that was created earlier.  


Install the new server.

Once the new server is up and running then you'll want to FTP the files in the
migrate folder on the previous server to the new server to /root/migrate/.  Once
this is completed then do

$ cat passwd >> /etc/passwd
$ cat shadow >> /etc/shadow
$ cat group >> /etc/group
$ cat accounts >> /home/e-smith/accounts

Once this is completed untar the tarball to /home/e-smith/files/users/.  At this
point all the user directories and user information has been transferred over.
>From here you will need to initiate a couple events for this to work.  At a root
prompt type

$ /sbin/e-smith/signal-event post-upgrade

when this is complete do

$ /sbin/e-smith/signal-event reboot

The server will now reboot and when it comes back up it will apply the
configuration changes.  At this point you will be able to administer the users
from server-manager fully.  

I have tested this solution on both 5.5 - 6 migations and 6 - 6 migrations with
success.  I plan on testing 5.5 - 6 migration again to confirm.

mstenson

User password migration
« Reply #2 on: April 19, 2004, 10:55:37 PM »
Sorry, forgot to login before submitting that.

brian2hand

Migrate users
« Reply #3 on: August 10, 2004, 03:52:58 AM »
Thanks - you are a legend.....


Saved me hours of frustration rebuilding my box.
 8-)

Offline nefkho

  • ****
  • 183
  • +0/-0
    • http://www.cagothonglines.com
hi
« Reply #4 on: August 11, 2004, 03:42:05 AM »
hi, can u write down the detail syntax for above procedure, the tarball etc.

thanks,
Nef Kho  :-) .........

Offline Denbert

  • *
  • 156
  • +0/-0
    • hegnstoften.net
User password migration
« Reply #5 on: October 20, 2005, 11:01:12 PM »
Hi,

Can’t get this working with the Samba.

Mail etc. works fine.

Anyone got a clue?

I have a SME 6.0.1 with the plus script and I need to move users and data to new hardware!
/ Denbert
"Success is not final, failure is not fatal: it is the courage to continue that counts" - Sir Winston Churchill

Offline meanpenguin

  • ***
  • 138
  • +0/-0
User password migration
« Reply #6 on: October 21, 2005, 08:18:29 PM »
Hi,

Why not just use the LazyAdmin tools in contribs.

Ed

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: User password migration
« Reply #7 on: October 22, 2005, 12:37:47 AM »
Quote from: "mstenson"
Is there anyway of forcing the SME server to reread /etc/passwd and /etc/shadow and synch the passwords?


There's no such things as "reread /etc/passwd and /etc/shadow". Both files are read anew whenever they are used.

So I'm not sure exactly what you mean by "sync the passwords".

You also need to be aware that samba and PPTP VPN don't use /etc/shadow, but instead use /etc/samba/smbpasswd. There's no way to convert an /etc/shadow password into an smbpasswd password - nor vice-versa.