Moving users and groups

General support questions
Post Reply
ben_tvpp
Posts: 29
Joined: 2018/12/04 13:28:51

Moving users and groups

Post by ben_tvpp » 2019/03/04 00:36:13

Hi, I'me doing a Centos 6 to 7 upgrade. I am keeping the home partition from the CentOS install as it has a lot of data and I wish to keep the group and user permissions (including uid/gid/user/group)..

I know I can user -gid and -uid options for adduer but according to docs

Code: Select all

Use the -g (--gid) option to create a user with a specific initial login group. You can specify either the group name or the GID number. The group name or GID must already exist.
The reason I need to do this is that the data in /home is actually a backup of a production server (which has actually died).

Is there a way of doing this?

Ben

billwest
Posts: 150
Joined: 2006/11/19 10:50:31
Location: Perth, Western Australia

Re: Moving users and groups

Post by billwest » 2019/03/04 01:34:07

I actually did something similar quite a while (a few years) ago.
I copied and pasted relevant parts of /etc/passwd, /etc/shadow, /etc/group from one machine to another, and it seemed to work.
If you use samba, it may require a bit more work.
No guarantees given.

tunk
Posts: 611
Joined: 2017/02/22 15:08:17

Re: Moving users and groups

Post by tunk » 2019/03/04 11:06:52

I have done the same for two CentOS 7 systems (with the addition of /etc/gshadow).
If your old system uses SHA256 password hashes, you may want to force your users to
set new passwords to get SHA512 (not sure if this will work).
YMMV

Edit: before doing anything with those files, make a copy just in case anything goes wrong.

ben_tvpp
Posts: 29
Joined: 2018/12/04 13:28:51

Re: Moving users and groups

Post by ben_tvpp » 2019/03/05 00:12:53

Thanks, that seems to work.

Post Reply

Return to “CentOS 6 - General Support”