Skip to content

Instantly share code, notes, and snippets.

@justaguywhocodes
Created November 5, 2025 15:42
Show Gist options
  • Save justaguywhocodes/ee3dc7eadca755fb14d9b10a0a541a4e to your computer and use it in GitHub Desktop.
Save justaguywhocodes/ee3dc7eadca755fb14d9b10a0a541a4e to your computer and use it in GitHub Desktop.
sudo apt update && sudo apt install apt-offline -y
sudo apt-offline set --update --upgrade apt-offline.sig
sudo apt-offline get apt-offline.sig --bundle bundle.zip
# Transfer bundle.zip to air-gapped via USB.
# On air-gapped:
sudo apt-offline install bundle.zip
sudo apt-offline set --install-packages samba apt-offline.sig
# Transfer apt-offline.sig to connected machine via USB.
On connected:
sudo apt-offline get apt-offline.sig --bundle bundle.zip
# Transfer bundle.zip back to air-gapped.
# On air-gapped:
sudo apt-offline install bundle.zip
# Proceed with Share CreationCreate shared directory:
sudo mkdir /shared
sudo chown nobody:nogroup /shared
sudo chmod 0775 /shared
# Backup and edit Samba config:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
# Add at end:
[shared]
comment = Shared Folder
path = /shared
browsable = yes
guest ok = no
read only = no
create mask = 0755
# Test config and restart Samba:
sudo testparm
sudo systemctl restart smbd
sudo systemctl enable smbd
# Set Samba password (replace yourusername):
sudo smbpasswd -a yourusername
# Delete the Network Share on Air-Gapped UbuntuEdit Samba config:
sudo nano /etc/samba/smb.conf
# Delete [shared] section. Test config and restart Samba:
sudo testparm
sudo systemctl restart smbd
# Remove directory:
sudo rmdir /shared
# (Optional) Restore config:
sudo mv /etc/samba/smb.conf.bak /etc/samba/smb.conf
sudo systemctl restart smbd
# (Optional) Uninstall Samba:
sudo apt-offline set --install-packages samba apt-offline.sig # Generate sig for removal (use --uninstall-packages if supported, else manual)
# Transfer sig to connected, get bundle, install on air-gapped:
sudo apt-offline install bundle.zip
sudo apt purge samba -y
sudo apt autoremove -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment