Secure deletion of files (Linux)

December 17, 2023 Reading time: ~1 minute

When removing files from a hard drive, it is recommended to securely delete them so when the hard drive is reused, no fragments of old files remain on the drive.

The way to do this is to use shred. To find all the files in the directory tree, you use find. The whole bash one liner is below:

find -type f -exec shred {} \;

You can add switches to the shred command, I recommend the ones below

-s, --size=N
shred this many bytes (suffixes like K, M, G accepted)

-u, --remove
truncate and remove file after overwriting

-v, --verbose
show progress

-n, --iterations=N
overwrite N times instead of the default (3)


Mounting a Proxmox .raw file

December 17, 2023 Reading time: ~1 minute

Proxmox will create an image on a hard disk when you add an extra hard drive to a guest VM.

the file has the .raw extension.

From https://unix.stackexchange.com/questions/316401/how-to-mount-a-disk-image-from-the-command-line

To mount this file on a Linux filesystem you need to discover what kind of filesystem it is. Do this by doing below:

 fdisk -lu /path/disk.img

This will give you an output such as below:

Then you can mount the raw image using the correct offset by multiplying the start by sector size.

mount -o loop,offset=xxxx /path/disk.img /mnt/disk.img.partition

In the example above, the mount command would be:

mount -o loop,offset=1048576 /media/server-storage/images/100/vm-100-disk-0.raw /mnt

You may need to use sudo if you aren't in the root account (you absolutely should NOT be logging/sudoing in as root!)


Using Docker to bring up Grav CMS

June 11, 2023 Reading time: 2 minutes

Grav is available as a docker from Linuxserver

https://hub.docker.com/r/linuxserver/grav

The stock docker-compose.yml below

---
version: "2.1"
services:
  grav:
    image: lscr.io/linuxserver/grav:latest
    container_name: grav
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /path/to/appdata/config:/config
    ports:
      - 80:80
    restart: unless-stopped

For use behind traefik, use the below:

---
version: "2.1"
services:
lazyblog-grav:
image: lscr.io/linuxserver/grav:latest
container_name: lazyblog_grav
environment:
- PUID=1000
- PGID=1000
- TZ=Australia/Adelaide
volumes:
- ./config:/config
restart: unless-stopped
networks:
- web
logging:
driver: journald
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.lazyblog-grav.entrypoints=websecure"
- "traefik.http.routers.lazyblog-grav.rule=Host(`Your URL`)
networks:
web:
external: true

In order to get Grav to work without a IPv6 connection go to the following file:

config/nginx/site-confs/default.conf

and comment out the lines below:

listen [::]:80 default_server;


And

listen [::]:443 ssl http2 default_server;


Copy all files (including hidden) on Linux type OS

May 7, 2022 Reading time: ~1 minute

In order to copy all files in a directory using the cp command use the -T switch. The man page says:

-T, --no-target-directory
              treat DEST as a normal file

This will copy all files including the (.) dot files to the destination. If the destination doesn't exist, it will be created.


Nextcloud 23 Collabora not working

December 9, 2021 Reading time: ~1 minute

Nextcloud 23 Collabora Office not working

See here --> https://help.nextcloud.com/t/psa-how-to-get-collabora-working-on-nextcloud-23/128511


Setting up docker with ONLYOFFICE in Docker

December 6, 2021 Reading time: 2 minutes
  1. install portainer
  2. git clone https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud
  3. follow instructions at https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud
  4. install mariadb docker

Configuration time

Configure mariadb to listen on the nextcloud network

docker exec -it nc-mariadb bash
apt update
apt install nano
nano /etc/mysql/my.cnf

Add the following:

under [mariadbd] add

skip-innodb-read-only-compressed

[mysqld]

bind-address = 172.22.0.5

Save and restart nc-mariadb

Add a remote user --> https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/

Add a nextcloud database --> https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html

Then navigate to your nextcloud instance and initialise nextcloud using mariadb as a database server


LazyCoderOZ

I am a Linux guy, been around for 20+ years using Linux as my daily driver.
This is my blog on my discoveries and notes so I don't forget how I have done things :)