{"id":128,"date":"2011-11-09T17:36:40","date_gmt":"2011-11-09T17:36:40","guid":{"rendered":"http:\/\/www2.ber10thal.com:8000\/blog\/?p=128"},"modified":"2013-06-12T04:04:57","modified_gmt":"2013-06-12T04:04:57","slug":"samba-domain-migration-to-a-new-machine","status":"publish","type":"post","link":"https:\/\/ber10thal.com\/blog\/samba-domain-migration-to-a-new-machine\/","title":{"rendered":"Samba domain migration (to a new machine)"},"content":{"rendered":"<p><a href=\"http:\/\/www2.ber10thal.com:8000\/blog\/wp-content\/uploads\/2011\/11\/samba.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www2.ber10thal.com:8000\/blog\/wp-content\/uploads\/2011\/11\/samba.gif\" alt=\"samba\" title=\"samba\" width=\"251\" height=\"122\" class=\"alignnone size-full wp-image-143\" \/><\/a><\/p>\n<p>This project involved migrating a samba domain from an old server to a new server (different machine, different hardware), versions below<\/p>\n<p>RedHat ES 3  &#8211;old server<br \/>\nUbuntu 11.04  &#8211;new server<\/p>\n<p>Samba 3.0.9  &#8211;old version<br \/>\nSamba 3.5.8  &#8211;new version<\/p>\n<p><strong>Mostly I used these instructions:<\/strong><br \/>\nhttp:\/\/www.samba.org\/samba\/docs\/man\/Samba-Guide\/upgrades.html#id2600749<br \/>\n<em>See the &#8211;&#8220;Replacing a Domain Controller&#8221;&#8211;<\/em><\/p>\n<p><strong>Get the SID: <\/strong> (security identifier for the domain)<\/p>\n<p>Get the SID from the old machine:<br \/>\nnet getlocalsid > \/etc\/samba\/my-local-SID<\/p>\n<p>The contents of the file will look like this<br \/>\nS-1-5-21-726309263-4128913605-1168186429<\/p>\n<p>Restore the SID to the new machine:<br \/>\nnet setlocalsid S-1-5-21-726309263-4128913605-1168186429<\/p>\n<p><strong>Files copied over from the old machine:<\/strong><br \/>\n\/etc\/passwd<br \/>\n\/etc\/shadow<br \/>\nin the password and shadow make sure to get the user accounts and machine accounts, the machine accounts end with a $ e.g. &#8220;computername$&#8221;<br \/>\n\/etc\/group  &#8211;I don&#8217;t think this this was necessary, but there may be groups you want to move<\/p>\n<p>It isn&#8217;t necessary to use the entire files;<br \/>\nI copied the lines for users and machine accounts from old shadow and passwd and put them into the existing file on the new server.  You may have to go to each workstation on the domain to get the machine names.<\/p>\n<p>Make sure the hostname of the new machine matches the old one and there is a mapping in \/etc\/hosts for it if you start getting weird errors after you change the hostname.<\/p>\n<p>IP address doesn&#8217;t matter, it can be different.<\/p>\n<p><strong>Samba files that need to be copied over;<\/strong><br \/>\nsmb.conf &#8211;main samba config file<br \/>\nsecrets.tdb  &#8211;stores machine account passwords<br \/>\nsmbpasswd &#8211;stores user account and passwords, needs to be converted to tdbsam format &#8220;passdb.tdb&#8221;<\/p>\n<p>I used pdbedit to convert the smbpasswd to passdb.tdb adjust your directories as needed;<\/p>\n<p>pdbedit -i smbpasswd:\/var\/lib\/samba\/smbpasswd -e tdbsam:\/var\/lib\/samba\/passdb.tdb<\/p>\n<p>To view what users and machine accounts made it to the new passdb.tdb file you can run the command.  (The file is database file and cannot be viewed directly)<br \/>\npdbedit -L<\/p>\n<p><strong>Errors you may get:<\/strong><\/p>\n<p>If you get these errors below:<\/p>\n<p>idmap will be unable to map foreign SIDs: NT_STATUS_UNSUCCESSFUL <\/p>\n<p>or<\/p>\n<p>winbindd\/idmap_tdb.c:341(idmap_tdb_alloc_init)<br \/>\n  idmap will be unable to map foreign SIDs: NT_STATUS_UNSUCCESSFUL<br \/>\n winbindd\/idmap.c:599(idmap_alloc_init)<br \/>\n  ERROR: Initialization failed for alloc backend, deferred!<br \/>\nwinbindd\/idmap.c:201(smb_register_idmap_alloc)<br \/>\n  idmap_alloc module tdb already registered!<br \/>\nwinbindd\/idmap.c:149(smb_register_idmap)<br \/>\n  Idmap module passdb already registered!<br \/>\n winbindd\/idmap.c:149(smb_register_idmap)<br \/>\n  Idmap module nss already registered!<br \/>\nwinbindd\/idmap_tdb.c:214(idmap_tdb_load_ranges)<br \/>\n  idmap uid missing<\/p>\n<p>add;<\/p>\n<p>    idmap uid = 10000-15000<br \/>\n    idmap gid = 10000-15000<\/p>\n<p>to your smb.conf file and restart samba<\/p>\n<p>I believe this sets the user and group Id mapping for machine ID&#8217;s<\/p>\n<p><strong>A problem I ran into:<\/strong><br \/>\nThe problem I ran into was finding the correct samba files to move over, for some reason there was a couple locations where the secrets.tdb and other files were, and I moved over the wrong files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project involved migrating a samba domain from an old server to a new server (different machine, different hardware), versions below RedHat ES 3 &#8211;old server Ubuntu 11.04 &#8211;new server Samba 3.0.9 &#8211;old version Samba 3.5.8 &#8211;new version Mostly I used these instructions: http:\/\/www.samba.org\/samba\/docs\/man\/Samba-Guide\/upgrades.html#id2600749 See the &#8211;&#8220;Replacing a Domain Controller&#8221;&#8211; Get the SID: (security identifier &hellip; <a href=\"https:\/\/ber10thal.com\/blog\/samba-domain-migration-to-a-new-machine\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Samba domain migration (to a new machine)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":2,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/posts\/128\/revisions\/263"}],"wp:attachment":[{"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ber10thal.com\/blog\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}