Skip to content

Linux

BackupYourSystem/TAR

Users

Create new user
useradd \
    --gid 0 \
    --groups sudo,docker,users \
    --create-home \
    --shell /bin/bash \
    user
Create new user
useradd -g 0 -G sudo,docker,users -m -s /bin/bash user

Groups

List all groups
cat /etc/groups

Services

List all services
systemctl list-units --type=service --all

Port Usage

List ports with TCP listeners
sudo ss -tulpn
Flags explained
Flag Description
-t Show TCP sockets
-u Show UDP sockets
-l Show only listening sockets
-p Show the process using each socket
-n Show numeric addresses (no DNS)
-w Show raw socket information (opt.)

Mounting Drives

How to mount samba shares on the Linux system

Samba Share1

Home Assistant - Samba share

Home Assistant configuration files can be shared in the config folder share.

Example /etc/fstab entry
//homeassistant/config /home/docker/homeassistant cifs uid=1000,gid=1000,forceuid,forcegid,vers=3.0,credentials=/mnt/.smbcredentials

Synology - SMB Settings

CIFS Version

Synology only supports version 2.0

Example /etc/fstab entry
//JOHN-NAS/home/smarthome/homeassistant /home/docker/homeassistant_old cifs uid=1000,gid=1000,forceuid,forcegid,vers=2.0,credentials=/mnt/.nascredentials

Samba Share

How to share from the Linux system

apt update && apt install -y samba
nano /etc/samba/smb.conf
Example SMB config entry
[appdaemon]
path = /root/appdaemon
browseable = yes
read only = no
writable = yes
guest ok = yes
Create user for SMB
sudo useradd --groups sambashare smb
Set passwords
passwd smb
smbpasswd -a smb
Restart the services
systemctl restart smbd && systemctl restart smbd

Packages

Search installed packages
dpkg -l | grep <package-name>
List installed files
dpkg -L <package-name>

Cron

crontab guru