How to Backup IMAP Mailboxes and Nextcloud Calendars, Contacts, and Notes

To backup all IMAP mailboxes for a user account, first download Rick Sander’s IMAP tools and save them somewhere on your system. Next, create a cron job and have it execute the following command:

mkdir -p /tmp/IMAP_$(date +%Y-%m-%d) && /path/to/imapdump/imapdump.pl -S example.com:993/user/password -f /tmp/IMAP_$(date +%Y-%m-%d) && cd /tmp/IMAP_$(date +%Y-%m-%d) && zip -r /backup/path/user@example.com_$(date +'%m-%d-%Y').zip user@example.com && chown user:user /backup/path/user@example.com_$(date +'%m-%d-%Y').zip && rm -Rf /tmp/IMAP_$(date +%Y-%m-%d)/user@example.com && find /backup/path -type f -mtime +90 -delete

To backup Nextcloud calendars and contacts, create a cron job running as root and have it execute the following command:

wget --directory-prefix=/tmp/nc-backup --user=ncuser --password=ncpassword --timestamping https://example.com/remote.php/dav/calendars/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/personal-1?export https://example.com/remote.php/dav/addressbooks/users/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/contacts?export && mv /tmp/nc-backup/personal-1?export /backup/path/calendar_$(date +'%m-%d-%Y').ics && mv /tmp/nc-backup/contacts?export /backup/path/contacts_$(date +'%m-%d-%Y').vcf && find /backup/path -type f -mtime +90 -delete

For Notes, do the same thing as above but execute the following instead:

mkdir -p /tmp/nc-backup && cd /nextcloud/path/k4hjd9n3-k3ns-9385-9k2n-l3kjs9fk4b9z/files && zip -r /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip Notes && chown user:user /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip && mv /tmp/nc-backup/notes_$(date +'%m-%d-%Y').zip /backup/path

How to solve delete file “Operation not permitted” on Linux

Sometimes it is necessary to prevent all users including root from deleting a file. This is often done by changing the file attributes on a Linux file system. The tool used to change file attributes in Linux and other Unix systems is chattr and the tool used to view the newly set attributes is lsattr.

The format of a symbolic mode is +-=[acdeijstuADST]. The format of a symbolic mode is +-=[acdeijstuADST] and they select the new attributes for
the files.

  • The operator ‘+’ causes the selected attributes to be added
    to the existing attributes of the files
  • ‘-’ causes them to be removed
  • ‘=’ causes them to be the only attributes that the files have.

See explanation of all letters used below:

Continue reading

How to Install Webmin+Nginx+Nextcloud+Syncthing on a Raspberry Pi 4

Flash Pi OS Lite to a micro SD card.

Install Webmin

If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the line:

deb https://download.webmin.com/download/repository sarge contrib

You should also fetch and install the Webmin GPG key with which the repository is signed, with the commands:

wget https://download.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

You will now be able to install with the commands:

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install webmin

All dependencies should be resolved automatically.
Continue reading

How To Install Nextcloud On A Synology NAS

This post should tell you everything you need to know to install Nextcloud instance on your Synology NAS without using Docker.

I previously published a post on how to setup Pi-Hole on a Synology and since then a number of people have asked for a guide on how to install Nextcloud on a Synology. After lots of tinkering, this post is the result.

I’ve talked about Nextcloud vs Synology before, and why I think Synology is the better choice for a home server. However, by using this guide you don’t need to choose – you can install Nextcloud on your Synology NAS!

This is likely to be another long post, so let’s get cracking shall we?

Setup DNS

Once Nextcloud is all setup and working on your Synology NAS, you will probably want to access it via a nice URL, usually a subdomain like nextcloud.example.com. If that’s the case, make sure you log into the DNS provider for your domain (this is usually the registrar you registered the domain with) and configure an A record that points to the public IP address of your Synology NAS. Continue reading

How to Flash Lineage OS on an LG V20 Phone

This method will, when completed, will provide you with root and an unlocked bootloader, with fastboot available. It is a somewhat involved process, but the majority of the process has been simplified as much as possible.

WARNING!!!!This replaces your current bootloader with a debug bootloader. If you attempt to lock this bootloader you may brick your device.
Currently AT&T(H910) and Sprint(LS997) cannot return to stock because no KDZ files are available.

Disclaimer:
Once your phone is unlocked, it will no longer be covered by LG warranty @me2151.
As we cannot guarantee the proper operation of our hardware with custom software, we are not able to maintain the full scope of warranty for your device after you have unlocked the bootloader.
Because of that we have a responsibility to let you know that defects which may result from, or were caused by custom device-software may not be covered by LG warranty @me2151. Continue reading

How can I remove the GUI from Raspbian/Debian?

$ sudo apt-get --purge remove "x11-*"

This will remove all the packages that are under x11 which is the library with all the graphical packages. the option –purge allow you to delete all the config file related.

$ sudo apt-get --purge autoremove
autoremove removes all the unused packages. There are a lot of unused packages after the first command.

Reference

https://raspberrypi.stackexchange.com/questions/5258/how-can-i-remove-the-gui-from-raspbian-debian

How to fix raspi-config “The splash screen is not installed so cannot be activated”

Problem:

You want to enable the boot splash screen on your Raspberry Pi using raspi-config, but you see this error message:

The splash screen is not installed so cannot be activated

followed by There was an error running option B3 Splash Screen

Solution:

As you can find out from reading the raspi-config source code, it checks for the existence of /usr/share/plymouth/themes/pix/pix.script. In order to install this file, install the rpd-plym-splash package.

Reference

https://techoverflow.net/2020/06/13/how-to-fix-raspi-config-the-splash-screen-is-not-installed-so-cannot-be-activated

How do I enable restricted codecs to play DVD’s?

DVD support cannot be provided by default in Ubuntu due to legal and technical restrictions. Most commercial DVDs are encrypted and so require the use of decryption software in order to play them.

Use Fluendo to legally play DVDs

You can buy a commercial DVD decoder that can handle copy protection from Fluendo. It works with Linux and should be legal to use in all countries.

Use alternative decryption software

In some countries, the use of the below unlicensed decryption software is not permitted by law. Verify that you are within your rights to use it.

  1. Install libdvdnav4, libdvdread4, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly, and libdvd-pkg.

  2. Open a terminal window by pressing Ctrl+Alt+T.

  3. Run the command

    $ sudo dpkg-reconfigure libdvd-pkg

    and confirm in order to install libdvdcss2.

Reference

https://help.ubuntu.com/stable/ubuntu-help/video-dvd-restricted.html.en

Use Instaloader to Regularly Download Photo’s from Specific Instagram Users

First, create a folder in your Pictures folder called ‘Instaloader’.

$ mkdir ~/Pictures/Instaloader

Next create a file inside that folder.

$ nano ~/Pictures/Instaloader/instaloader.sh

Add the following to the file (replacing user’s with Instagram profile names) and save:

#!/bin/bash
cd ~/Pictures/Instaloader
~/.local/bin/instaloader --fast-update user1 user2 user3

Give the file execute permissions and run it.

$ sudo chmod a+x ~/Pictures/Instaloader/instaloader.sh

$ sudo ~/Pictures/Instaloader/instaloader.sh

If it successfully executes, then add it to cron.

$ crontab -e

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.z5YMVK/crontab installed on Fri Mar 5 07:57:15 2021)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
0 0,12 * * * ~/Pictures/Instaloader/instaloader.sh