Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Proxmox] Installing Cockpit with ZFS Manager extension

The Cockpit ZFS Manager requires Cockpit version 201 or above. In the Debian Buster repository there’s only cockpit version 188, so you have to use the buster backports repository, which contains cockpit version 223.

# install cockpit
echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/buster-backport.list
apt update
apt-get -t buster-backports install cockpit
# add ZFS manager
git clone https://github.com/optimans/cockpit-zfs-manager.git
cp -r cockpit-zfs-manager/zfs /usr/share/cockpit
# start cockpit
systemctl start cockpit.service
systemctl enable cockpit.service
systemctl status cockpit.service

Now browse to https://ip-address-of-machine:9090 and login.

[HTPC] hide mouse cursor with Unclutter

Damit beim Filme schauen auf dem Fernseher nicht immer händisch der Mauszeiger aus dem sichtbaren Bereich geschoben werden muss, habe ich nach einer Lösung gesucht und wurde mit Unclutter fündig: “Unclutter ist ein kleines Hilfsprogramm, das den Mauszeiger verschwinden lässt.”

#install
apt install unclutter
#config
cat /etc/default/unclutter

“Unclutter startet ab dem nächsten Neustart automatisch. Wenn man das oder die Optionen ändern will, kann man es durch Bearbeiten [3] der Datei /etc/default/unclutter mit Root-Rechten erreichen.”
Standardmäßig verschwindet der Mauszeiger nach einer Sekunde. Kann aber natürlich beliebig angepsasst werden.

[Shell] User and Group management & File permissions

  • User and Group management
    • id
    • useradd
      • -c – Full name
      • -e – Expiration date
      • -s – Default shell
      • -d – Home directory
    • passwd
    • usermod
      • -l – rename
      • -L – Lock
      • -U – unlock
    • userdel
      • -r – remove user data
    • groupadd
    • groupmod
    • gpasswd [-a -d -A] [user1, user2] [group]
    • newgrp [group]
  • su vs. su – vs. sudo
    • visudo
  • File permissions
    • UGO – User, Group, Other
    • RWX – Read, Write, Execute
    • chmod -R g+x (grant recursive execute permission to group)
      • r = 4
      • w = 2
      • x = 1
      • = 0
      • rwxrwxrwx = 777
      • rw-rw-rw- = 666
      • rwxrwxr–- = 774
      • rw-rw—- = 660
      • rw-r—–- = 640
    • chown
    • chgrp
    • umask

https://www.sluug.org/resources/presentations/2020/2020-02-12_permissions.pdf

[Software] Using pdfunite to merge PDF documents

First install pdfunite:

sudo apt update 
sudo apt install poppler-utils

Syntax:

pdfunite source1.pdf source2.pdf merged_output.pdf

If a pdf file is located in a different folder, you have to add the path like this: $home/Downloads/source1.pdf
If you want to merge all pdf’s of the current folder you cant type:

pdfunite *.pdf merged_output.pdf

An alternative with GUI is PDF Arranger.

[Terminal] Shorcut overview

Further shortcuts:

Ctrl-LCleans the screen
Ctrl-YPastes back the stuff erased by Ctrl-K or Ctrl-U
Ctrl-CAborts a application
Ctrl-ZSuspend a application. Resume it again by fg (resume in foreground) and bg (resume in background).
Use jobs if you have multiple suspended applications and use fg %# (where # is the job number) to get it back on screen or end it with kill %#.
Ctrl-Dis same as typing exit
Pos1like Ctrl-A
Endlike Ctrl-E
Ctrl-RSearch terminal history
Ctrl-GExit searching terminal history

Some of the shortcuts are also recognized by other applications, like Ctrl-U on Ubuntu’s graphical login screen.

[Shell] Delete a folder and its content

If you downloaded a series there are often folders for each episode. Each episode folder often includes another folder called “Sample” with a short demo video file.

Series -> Season 01 -> Episode 01 -> Sample -> sample.mkv

To get rid of these you can use the “find” and “rm” command. To remove each sample folder with its content you have to use the remove command with an “-r”.

find -name "Sample" -exec rm -r "{}" \;

[Docker] Install Docker in LXC running Debian Buster

If you already have an LXC with Debian running, add the following three lines to the lxc config (path /etc/pve/lxc/xxx.conf) and reboot the container:

lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

Now simply install docker.

sudo apt update && apt upgrade -y
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose

Running and managing docker containers requires sudo privileges. If you don’t want to type sudo for every commmand, add your current user to the docker group.

sudo usermod -aG docker ${USER}

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running.

sudo systemctl status docker

Test if the installtions is working correctly with hello-world.

sudo docker run hello-world

Each container you will create gets a unique ID and name you can look up with “docker ps”. To remove the docker instance just use “docker rm” followed by the ID or the container name.

sudo docker ps -a
sudo docker stop relaxed_williamson
sudo docker rm relaxed_williamson

[Shell] SSH Passwordless Login Using SSH Keygen

Generate key, copy key to server and finally ssh passwordless into your server.

ssh-kegen -t rsa
ssh-copy-id root@ip
ssh root@ip

View your generated key with:

cat /home/user/.ssh/id_rsa           #local
cat /home/user/.ssh/authorized_keys  #server

To disable password authentication permanently you have to edit the ssh config. Be sure to first backup before editing. Now just set PasswordAuthentication to “no” in your config and restart the ssh daemon.

cp /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
nano /etc/ssh/sshd_config
service ssh restart