Reinstall Linux by keeping user accounts

2

I am going to upgrade Linux Mint 13 to Linux Mint 17.1 on a home computer. I am going to do a fresh upgrade. There are three partitions for swap, / and /home. I will preserve swap and /home. The partition for / will be formatted and Linux Mint 17.1 will be installed there.

There are four users (including me) on this machine. The files and settings will be safe in /home.

The question is how can I preserve user accounts (login names and login passwords) for other users? I know the login information is stored in /etc/passwd. I can save and restore this file (or information about other three users). So I can link the home folders with correct login names and UIDs.

What about passwords? Is it enough to save and restore /etc/shadow?

It is easy for one user systems. I would just restore my user account during the install by choosing the same login name and login password. And it will correctly link with the correct home folder.

djhurio

Posted 2015-01-31T14:54:20.003

Reputation: 543

Just be careful not to modify accounts with UIDs less than 1000 (or whatever value your system is set to start numbering user accounts at). – Daniel B – 2015-01-31T15:34:16.130

It is easy for one user systems. I would just restore my user account during the install by choosing the same login name and login password. It is not. You will get a new and empty home folder. – khajvah – 2015-01-31T16:01:41.597

3

Check out this link

– khajvah – 2015-01-31T16:04:43.063

@khajvah That’s not true for separate /home partitions. Of course it won’t delete existing user folders. At the very worst, the UIDs might not match, but fixing that is trivial. – Daniel B – 2015-01-31T16:25:08.280

@DanielB I meant, empty folder for the particular user not the entire partition. – khajvah – 2015-01-31T16:31:50.347

@khajvah, I have done it several times for single-user setting. It works because I am always the first user with UID=1000 and I do not change my login name. So I am ending at the same home folder as before reinstall. – djhurio – 2015-01-31T17:03:01.730

@khajvah, Thanks for the link! Sounds good. I am surprised there is not a tool for that task. – djhurio – 2015-01-31T17:31:15.543

@djhurio good idea for a new project ;) – khajvah – 2015-01-31T17:32:58.510

@khajvah, just did the upgrade successfully following the manual you linked here. Make it as an answer and I will accept it. – djhurio – 2015-01-31T20:02:22.657

No answers