Install macOS in VirtualBox

First you need an ISO file of the macOS installation DMG. Either download that file from the internet (please be advised to use safe sources) or you follow a tutorial to convert the DMG to an ISO. A tutorial is given here:

https://www.xda-developers.com/how-install-macos-virtualbox

Simply install macOS by adding a virtual machine an selecting the ISO and system as macOS. After the VM was added, change the config as follows:

  • Min 2-coreCPU
  • Min 4 GB RAM
  • Min 40 GB HardDisk
  • Min 128 MB VboxSVGA with 3D acceleration enabled

Last steps, you need to execute special config commands in terminal:

$ VBoxManage modifyvm "VM_NAME" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Debian 12 as Active Directory member with limited SSH access

In order to join Debian 12 to an AD, you need to install Samba and change the default authentication. Please make sure that the network configuration is set up correctly and you are using the AD DNS servers.

Step 1: Install prerequisities

$ apt install samba winbind libnss-winbind libpam-winbind

Step 2: Create samba config

Create a new file /etc/samba/smb.conf or change the given one with your favourite editor. (VI, NeoVIM, VIM, Nano…) and add following content. If you want the explanation for the config parameter, please visit the Samba Documentation.

[global]
    netbios name = <my host name here>
    realm = <my domain here, e.g. domain.local>
    workgroup = <my domain name without .local>
    security = ADS
    local master = no
    domain master = no
    allow trusted domains = no
    winbind use default domain = yes
    winbind enum groups = yes
    winbind enum users = yes
    winbind nss info = rfc2307
    winbind cache time = 300
    winbind offline logon = no
    idmap config * : range = 2000-9999
    idmap config * : backend = tdb
    template shell = /bin/sh

Step 3: Test config, start samba and join Ubuntu to the domain

Now let us test the samba config and start the SAMBA server only once, starting at boot will come later. If asked for a password, please enter it for the specified user.

$ testparm
$ systemctl start nmbd; systemctl start smbd; systemctl start winbind
$ net ads join -U Administrator
$ systemctl restart winbind

if successful, you can check the AD’s users and groups with wbinfo

$ wbinfo -u
$ wbinfo -g

Basically you should see all users and groups. Hurray, your box is now a domain member!

Step 4: Make the system use AD users for authentication

Next up, you need to change the authentication backend. Simply use following command to enable homefolder creation and windows authentication:

$ pam-auth-update

Now check if PAM can read users and groups:

$ getent passwd
$ getent group

You should see all users and groups now. If you have domain trusts, users from other domains are going to be listed as well.

Step 5: Configure OpenSSH and Sudo

Ok, all great so far. Now, let’s change OpenSSH to authenticate with AD and limit login only to domain admins in this case.

edit /etc/ssh/sshd_config and change or add the following lines:

PasswordAuthentication yes
AllowGroups "domain admins" adm root

Next allow domain administrators to “sudo” commands (optional):

edit /etc/sudoers and change or add following lines:

%domain\ admins ALL=(ALL) NOPASSWD: ALL

Please be aware that NOPASSWD is used to suppress password confirmation when executing commands with sudo. It could be that you see that as a security risk. If so, simply remove “PASSWD:” from the line.

Step 6: Start samba and winbind at boot time

Last but not least, we need to start SAMBA at boot time. Simply execute following line:

$ systemctl enable nmbd; systemctl enable smbd; systemctl enable winbind

That should be it. Now reboot and use your Ubuntu box as an AD member.

Migrate Windows File Server

Microsoft File Server migration in my case consisted of 3 steps:

  1. Copy files (including NTFS permissions)
  2. Copy shares
  3. Copy quotas

Here is what to do:

Copy files using robocopy

i copied files from my old to new server using following command on the source server:

robocopy.exe .\MyRootFolder \\MyDestinationServer\driveletter$\MyRootFolder /MIR /SEC /SECFIX /W:3 /R:3 /E /ZB /COPYALL /V

To learn more about the parameters, go to this microsoft page for robocopy

Copy shares

Use regedit to export / import following key and its content:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Shares

Copy quotas

Now this was the most complicated part as it involved some scripting. First export the quota templates from the source server:

dirquota.exe template export /file:C:\quota.xml

copy that file onto the destination server and do:

dirquota.exe quota template import /file:<path_to_xml_file>

Afterwards you have to output the specific quotas and add them with:

dirquota.exe quota add /Limit:<size_in_gb_or_mb> /SourceTemplate:<name_of_the_template> /Path:<path_to_quota_folder>

Source: https://suddhaman.blogspot.com/2020/07/file-server-migration-windows-server.html