[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mdadm drive fail power cord issue.



[cut]

ok as it shows and you also advice to replace the disk. i think it would be better to replace the GPT. for ease of use. and  am going to create another box.

Sorry but the above is hard for me to understand.  Are you asking how
you can transfer users from /etc/passwd on one machine to another
machine?  If that is your question then I would copy those users to
the new machine's /etc/passwd file.  Copy the user account lines (user
accounts have uid's and gid's >=1000) from these files:

  /etc/passwd
  /etc/group
  /etc/shadow
  /etc/gshadow

Append the user account lines from those files onto the end of the new
machine's files.  That is all that is needed.

These commands may be useful for extracting the user account lines
from these files.

  awk -F: '$3>=1000' /etc/passwd

  awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/group; done

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/shadow; done

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/gshadow; done

Look this over, understand what they are doing, then append the
results onto the new files on the new system and the old users will
have been transferred to the new system.

  awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd > /root/passwd.users

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/group; done > /root/group.users

And so forth.  Then copy those files to the new machine.  Then append
those lines to the correct files on the new machine.


sorry for the poor question once again. it is quite a script and i learned from it however my question was a bit different.
i am not using an independent samba box. my samba is winbind with windows active directory and all the users are called and assigned rights from my Microsoft windows AD user db.

as you know /etc/passwd file has no presence of AD users. samba is the one who manages the database and assigned GID and UID all by it self. and there is a utility to edit and set gid and uid called wbinfo.

as i have tried earlier samba assign these numbers randomly to the users. i have tested that.

so just trying to find a easy way to actually replicate the same samba as the failing one and as a result of that i do not have to assign all the rights to individual users on restored data beside that i can just copy paste the data and my new storage will work like the old one with out any hassle. 

Thanks,

yousuf

 
Hope that helps!
Bob




Reply to: