group=AD_group_name
sed -i "$ i+:$group:ALL" /etc/security/access.conf && tail -n5 /etc/security/access.conf
printf "\nsudo\n"
echo "%$group ALL=(ALL:ALL) ALL" >>/etc/sudoers.d/$group && cat /etc/sudoers.d/$group
chmod 600 /etc/sudoers.d/$group
ll /etc/sudoers.d
printf "\n\n"
Category: Linux
Pull only the relevant parts from access.conf
an easy way to pull just the relevant lines from a access.conf file, without all the commented stuff at the beginning
sed -n '/All other users/{:a; n; /./{p; ba;}}' /etc/security/access.conf
Working RetroPie apt sources list
If RetroPie is running Buster, then you need the following in /etc/apt/sources.list :
deb http://legacy.raspbian.org/raspbian/ buster main contrib non-free rpi
deb-src http://archive.raspberrypi.org/debian/ buster main
Remove any conflicting raspi.list files in /etc/apt/sources.list.d/
nmap usage
Discover Live Hosts – Ping Scan – Host Discovery Without Port Scanning
nmap -sn 192.168.1.0/24
Scan a Specific Host
nmap -sV 192.168.1.100
TCP SYN Scan (Stealth Scan)
nmap -sS 192.168.1.100
nmap -sS -p 22,80,443 192.168.1.10
TCP Connect Scan (Full Handshake)
nmap -sT 192.168.1.100 # Works without root privileges
Service and Version Detection
nmap -sV 192.168.1.100
nmap -sV --version-intensity 5 192.168.1.100 # More thorough probing (scale: 0-9)
OS Detection (OS Fingerprinting)
nmap -O 192.168.1.100
nmap -O --osscan-guess 192.168.1.100 # Shows best guess even with low confidence
Aggressive Scan (All-in-One Detection)
The -A flag runs four operations at once:
- OS detection (-O)
- Service and version detection (-sV)
- Default NSE script scan (-sC)
- Traceroute
nmap -A 192.168.1.100
nmap -A -T4 192.168.1.100 # Aggressive scan at fast timing
Bluetooth headphones won’t connect
my Ozeino headphones often stop talking to my Debian NUC system.
To fix, open a terminal on the linux box
elevate to sudo. perform the following while playing with the power/connect button on the headphones.
bluetoothctl scan on
bluetoothctl pair 7c:4d:f0:25:85:89
bluetoothctl connect 7c:4d:f0:25:85:89
if still no luck, then delete the device:
bluetoothctl remove 7c:4d:f0:25:85:89
bluetoothctl pair 7c:4d:f0:25:85:89
Use nmap to quickly scan an IP range
nmap -sn -r 10.2.172.0/26
this will show results in order of IP address.
Download best video format and subtitles from youtube
this will give you an .mkv and a .srt file:
yt-dlp -f "bv[ext=webm]+ba[ext=m4a]" --write-subs --embed-subs --sub-lang en,en.* --sub-format srt https://www.youtube.com/watch?v=inKdUICLmXY
Linux Cockpit Terminal screen illegible
If the Terminal screen on a server’s Cockpit page is illegible, you’ll need to set the site permissions from your client web browser.
Go to the site at http://x.x.x.x:9090, login, click the Terminal option.
Click the lock icon in the address bar.
Click on Connection Not Secure.
Click on More Information.
Click on the Permissions icon.
Under “Extract Canvas Data”, unselect “Use Default” and select “Allow”.
Refresh the page. You may have to change the font size.
upgrade to Debian 13 Trixie
Pre-Upgrade System Preparation
elevate to root
Create System Backup
mkdir mkdir /mnt/athena_backups/"$HOSTNAME"_backups
tar -czf /mnt/athena_backups/"$HOSTNAME"_backups/etc-backup-$(date +%Y%m%d).tar.gz /etc
dpkg --get-selections > /mnt/athena_backups/"$HOSTNAME"_backups/package-selections-$(date +%Y%m%d).txt
Ensure Debian 12 is fully updated before proceeding
apt update
apt upgrade -y
apt dist-upgrade -y
apt clean
apt autoremove -y
Verify system integrity before upgrade
apt --fix-broken install
dpkg --configure -a
Create safety copy of repository settings
cp /etc/apt/sources.list /etc/apt/sources.list.bookworm-backup
cp -r /etc/apt/sources.list.d /etc/apt/sources.list.d.bookworm-backup
Update Main Sources List and Additional Repositories
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
find /etc/apt/sources.list.d -name "*.list" -exec sed -i 's/bookworm/trixie/g' {} ;
This systematically updates all repository references from Bookworm to Trixie across all configuration files.
apt update
Third-party repositories may not immediately support Trixie. Consider temporarily disabling them by adding ‘#’ at the beginning of their lines in sources configuration files.
Minimal Upgrade First
apt upgrade --without-new-pkgs
Full Distribution Upgrade
apt full-upgrade
Confirm successful upgrade completion
cat /etc/debian_version
lsb_release -a
cat /etc/os-release
Clean Obsolete Packages
apt autoremove -y
apt autoclean
Update Package Cache
apt update
apt list --upgradable
System Reboot: Complete the upgrade process
systemctl reboot
Interrupt the boot process in order to gain access to a system
init=/bin/bash
/usr/sbin/load_policy -i
mount -o remount,rw /
passwd
touch ./autorelabel
/sbin/reboot -f
Backup Nextcloud
sudo su -
cd /var/www/html/nextcloud/
turn maintenance mode on
sudo -u www-data php occ maintenance:mode --on
run backups
tar -cvpzf /mnt/athena_backups/nextcloud_backup/nextcloud-$(date +"%Y-%m-%d").tar.gz -C /var/www/html/nextcloud/ .
turn maintenance mode off
cd /var/www/html/nextcloud/
sudo -u www-data php occ maintenance:mode --off
OR:
cd /var/www/html/nextcloud/config/
sed -i s/"'maintenance' => true"/"'maintenance' => false"/ config.php
Stop USB drives from stopping a boot process
Change an external USB drive’s reference in fstab from ‘defaults to nofail:
UUID=xxx /media/toaster/sd20 ext4 nofail 0 0
This will prevent an absent USB drive from causing the boot to halt.