Notes: Linux





Random notes for Linux. Primarily for my own reference.

Scripting

# Change Dir to Script Dir
cd "$(dirname "$0")"

(My) Ideal Debian VM Setup

Serial Access

# Enable serial console
systemctl enable serial-getty@ttyS0.service

General

timedatectl set-timezone America/New_York
apt update
apt upgrade -y
# Enable automatic upgrades
apt install unattended-upgrades apt-listchanges sudo curl git -y
echo "Unattended-Upgrade::Automatic-Reboot-WithUsers "true";" > /etc/apt/apt.conf.d/52unattended-upgrades-local

With Docker

curl -fsSL https://get.docker.com | sh
apt install -y docker-compose
docker run --detach --name watchtower --restart unless-stopped --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower

With SMB Share

#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_MODE=l
apt install cifs-utils -y
echo "Linux username: "
read linux_username
echo "SMB Username: "
read smb_username
echo "SMB Password: "
read smb_password
mkdir /media/share
printf "username=$smb_username\npassword=$smb_password" > /root/sharecreds.txt
printf "\n//10.10.10.4/home /media/share cifs credentials=/root/sharecreds.txt,uid=$linux_username,gid=$linux_username,file_mode=0770,dir_mode=0770,noperm 0 0\n" >> /etc/fstab
systemctl daemon-reload
adduser $linux_username
echo "*/1 *  * * *  mount -a" | crontab - # Hack
mount -a


Comments are currently disabled.


Enable Comments

By enabling comments, you agree to allow this website to connect to Cusdis and to the Cusdis Privacy Policy.