From 4bffeb32d6bee7b4dc98f076cbc3be0a1df19f33 Mon Sep 17 00:00:00 2001 From: fragolinux <21192010+fragolinux@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:10:36 +0200 Subject: [PATCH] enhanced main readme --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2832c3f..5f807b8 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,34 @@ Inspired by the excellent work of Peter Scargill ("[The Script](https://www.esp- - [zigbee2mqtt](https://www.zigbee2mqtt.io/) | Zigbee to MQTT bridge, get rid of your proprietary Zigbee bridges - More to come... +## enable user root and root ssh login + +I know, this is far from being secure and should be avoided, but as this simplifies operations for not skilled people, and in the end it's a local setup, this is what should be done to avoid me the headaches of having to help people with permission issues. You don't agree? Then feel free to study proper security measures and fix this yourself :) + + # give root user a password + sudo passwd root + + # change these 2 lines in /etc/ssh/sshd_config to allow root login via ssh + PermitRootLogin yes + PasswordAuthentication yes + + # now restart ssh to apply changes without reboot + sudo systemctl restart ssh + +from now on, EVERY command you'll see MUST be run as root, so you'll not find any reference to sudo anymore + +## basic tools requirements + +before going on, you'll need some basic tools, like `jq` and `dialog` (both used by my new menu), and of course `git`, so please install them with something similar to this (adapt to your linux distro if it's not debian based): + + apt install -y jq dialog git + +## install docker + + curl -fsSL https://get.docker.com -o get-docker.sh + sh ./get-docker.sh + docker --version + ## install docker compose mkdir -p ~/.docker/cli-plugins/ @@ -52,6 +80,8 @@ update: docker compose pull docker compose up -d --force-recreate +feel free to check `docker --help` and `docker compose --help` to learn a lot more, but this is enough to deal with this setup + ## useful aliases alias docker-compose="docker compose" @@ -63,10 +93,25 @@ update: alias dsh="docker compose exec \$(grep -A1 services docker compose.yml|tail -1|cut -d: -f1|awk '{\$1=\$1};1') /bin/sh" alias dbash="docker compose exec \$(grep -A1 services docker compose.yml|tail -1|cut -d: -f1|awk '{\$1=\$1};1') /bin/bash" -## custom menu system +note: the last 2 commands need a bit of tuning for docker-compose files containing more than a single service, I'll work on them ASAP -the `iotmenu.sh` script (call it using `bash iotmenu.sh` from inside the main DockerIOT folder) allows easy access to all the services, showing which one is running and on which ports, and all the above docker commands without having to remember their syntax. +## BASIC BACKUP COMMANDS, to be run ALWAYS as root, till a proper backup procedure will be added + + # compress a full folder, PRESERVING permissions (change the date as you want) + cd && tar cvzfp DockerIOT-20240414.tgz DockerIOT + + # decompress a full folder, PRESERVING permissions + # BEWARE, risk of overwrite if something is already there in same folder, so better renaming the old one before with "mv DockerIOT DockerIOT-orig" + cd && tar xvzfp DockerIOT-20240414.tgz -NOTE: this requires a few addon binaries, like `jq` and `dialog`, please install them with something similar to: + # copy a folder from a linux system to an other, directly without windows: + # BEWARE, risk of overwrite if something is already on the remote system... + cd && scp -r DockerIOT root@192.168.1.X:/root - sudo apt install -y jq dialog + # copy a single file from 1 system to an other: + # SAFER way, as file is compressed and has a date in its name: + cd && scp DockerIOT-20240414.tgz root@192.168.1.X:/root + +## custom menu system + +the `iotmenu.sh` script (call it using `bash iotmenu.sh` from inside the main DockerIOT folder) allows easy access to all the services, showing which one is running and on which ports, and all the above docker commands without having to remember their syntax.