Koozali.org: home of the SME Server

Migrating user passwords to a new SME 8 system

Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Migrating user passwords to a new SME 8 system
« on: July 23, 2012, 02:39:45 PM »

I need to be able to migrate users from an old SME 7 system to a newly built SME 8 system. While LAT is great for copying user, groups, ibays, domains etc it does not copy the user passwords.

So my question is if I simply take a copy of the /etc/passwd and /etc/shadow files and place them into a temporary location on the new server then write a script that will read and parse both these files into memory then read the current /etc/passwd and /etc/shadow files and using the username as the key replace the entire line of the new file with the entire line from the old - WITH ONE EXCEPTION - making sure that the ID number of the new file is retained. Should this work?

Adam
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Migrating user passwords to a new SME 8 system
« Reply #1 on: July 23, 2012, 02:43:43 PM »
Adam, please, explain your problem, not your solution..

if you need to upgrade your server, there are dozen of way to achieve it
if you need to clone your server (for example to test SME8 before upgrading), please take a look in the wiki

Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Re: Migrating user passwords to a new SME 8 system
« Reply #2 on: July 23, 2012, 02:50:55 PM »
Hello Stafano,

Thanks for your quick reply. The issue is that I need to migrate [a subset of] users from an old server to a new server. The old server is not suitable for upgrade for a number of reasons not excluding the fact it's a very old server which has been upgraded many times and has many many things on it which the new server does not need.

The users and usage of the new system is only a subset of the old system.

Cheers,

Adam
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Migrating user passwords to a new SME 8 system
« Reply #3 on: July 23, 2012, 02:55:28 PM »
I sincerely can't see the problem.. upgrade your server to SME8, erase unwanted/unneeded users and you're done..


Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Re: Migrating user passwords to a new SME 8 system
« Reply #4 on: July 23, 2012, 02:59:38 PM »
I sincerely can't see the problem.. upgrade your server to SME8, erase unwanted/unneeded users and you're done..

The old system has much more than unwanted/unneeded users.

There are other reasons why this is going to be difficult. One is that the old machine is on stand-alone hardware while the new machine in on VMware ESXi 5 and I'm having troubles getting vCenter Converter to work with the old machine.

Do you see any problems with the method I outlined above?

Adam
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Migrating user passwords to a new SME 8 system
« Reply #5 on: July 23, 2012, 03:14:44 PM »
vCenter Converter to migrate SME? one of the main advantage in using SME (and many other linux flavours) is that you'd never have to clone/convert the physical machine to move to a virtual one.. don't follow the windows way, use the force

Adam.. using the backup/restore function to migrate your server you will move only users, their data, and configuration dbs..

so you will not move any other info, i.e. no unwanted contribs will be installed on the new server..
you are using the wrong approach IMVHO, so yes, I see many potential issues with your method

anyway, using the "clone" method (see my wiki link above) you can customize your include/exclude list to move only the data of your preferred users.. anyway, passwd/shadow will be identical before and after the migration

Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Re: Migrating user passwords to a new SME 8 system
« Reply #6 on: July 23, 2012, 03:27:07 PM »
I had considered a backup to desktop but discounted it as it says "Your server has too much data for a reliable backup to desktop."

Adam
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Migrating user passwords to a new SME 8 system
« Reply #7 on: July 23, 2012, 03:31:12 PM »
ok..

backup your data on a network share (event on a laptop, as long as you have enough space) or use Affa..

and, please, before doing anything, search the forums.. you'll find hundreds of hints on how to backup/restore your data

Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Re: Migrating user passwords to a new SME 8 system
« Reply #8 on: July 23, 2012, 03:37:17 PM »
ok..

backup your data on a network share (event on a laptop, as long as you have enough space) or use Affa..

and, please, before doing anything, search the forums.. you'll find hundreds of hints on how to backup/restore your data

Not so easy, the servers are in a data centre a good distance away. Admittedly I've never used the function before so I'll have to go through the forums to see if I can configure what is backed up.

Thanks for your help.

Adam
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Migrating user passwords to a new SME 8 system
« Reply #9 on: July 23, 2012, 03:44:39 PM »
if servers are in different data centers, Affa is your friend.. I migrated my server between two locations with affa without issue at all

and yes, affa can be configured to decide what is backed up (see the wiki page)

Offline madadam

  • *
  • 149
  • +0/-0
    • http://www.extremetourist.com
Re: Migrating user passwords to a new SME 8 system
« Reply #10 on: July 23, 2012, 05:16:00 PM »
Thanks Stefano. In the end I used some of the method described in the wiki you quoted above. So far it seems to have worked, I've copied over all the accounts and various files in /etc and now am deleting what's not needed. I will do some further testing to make sure. The beauty of VMware is that I can take a snapshot of the VM before I made all these changes - just in case!

Adam
...