Skip to content
  • advertising through scare tactics

    Email Scams
    1
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Cloud scam

    Email Scams
    1
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Backup Redis

    Linux Systems Guides
    1
    1
    0 Votes
    1 Posts
    109 Views
    No one has replied
  • 0 Votes
    1 Posts
    168 Views
    No one has replied
  • no matching host key type found

    Linux Systems Guides ssh-dss
    1
    1
    0 Votes
    1 Posts
    401 Views
    No one has replied
  • Print command name running on port osx

    FreeBSD Notes osx
    1
    0 Votes
    1 Posts
    486 Views
    No one has replied
  • Locate HDD

    Linux Systems Guides hard drive info hdd locate hard drive
    1
    0 Votes
    1 Posts
    719 Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    3 Posts
    3k Views
    rickR
    New script due to dependency changes: #! /bin/sh set -e if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then ACTION=$1 elif [ "$1" = "" ]; then ACTION=install else echo "usage: $(basename $0) action [source]" echo "action is either install (default) or upgrade" echo "source is either tar (default) or git" exit 1 fi if [ "$2" = "git" ] || [ "$2" = "tar" ]; then SOURCE=$2 elif [ "$2" = "" ]; then SOURCE=tar else echo "Unknown source $2!" exit 1 fi if [ "$BPC_UID" ] && [ $(getent passwd "$BPC_UID" | cut -d ':' -f 1) != "backuppc" ]; then echo "The uid = $BPC_UID is already in use!" exit 1 fi #Install dependencies apt-get -q update export DEBIAN_FRONTEND=noninteractive apt-get install -q -y apache2 apache2-utils libapache2-mod-perl2 par2 perl smbclient rsync tar gcc zlib1g zlib1g-dev rrdtool git make perl-doc libarchive-zip-perl libfile-listing-perl libxml-rss-perl libcgi-session-perl libacl1-dev wget iputils-ping pwgen #Set up backuppc user and directory if ! id backuppc >/dev/null 2>&1; then if [ "$BPC_UID" ]; then adduser --system --home /var/lib/backuppc --group --disabled-password --shell /bin/false --uid="$BPC_UID" backuppc else adduser --system --home /var/lib/backuppc --group --disabled-password --shell /bin/false backuppc fi fi mkdir -p /var/lib/backuppc/.ssh chmod 700 /var/lib/backuppc/.ssh echo -e "BatchMode yes\nStrictHostKeyChecking no" > /var/lib/backuppc/.ssh/config if [ ! -e /var/lib/backuppc/.ssh/id_rsa ]; then ssh-keygen -q -t rsa -b 4096 -N '' -C "BackupPC key" -f /var/lib/backuppc/.ssh/id_rsa fi chmod 600 /var/lib/backuppc/.ssh/id_rsa chmod 644 /var/lib/backuppc/.ssh/id_rsa.pub chown -R backuppc:backuppc /var/lib/backuppc/.ssh #Set password or read password file if [ "$BPC_PASS" ]; then PASSWORD="$BPC_PASS" elif [ -e /root/password ]; then PASSWORD=$(cat /root/password) chmod 600 /root/password else PASSWORD=$(pwgen -s -1 32) echo "$PASSWORD" > /root/password chmod 600 /root/password fi echo "backuppc:$PASSWORD" | chpasswd backuppc #Get BackupPC release versions get_latest_release() { wget -q -O - "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' } bpcver=$(get_latest_release "backuppc/backuppc") bpcxsver=$(get_latest_release "backuppc/backuppc-xs") rsyncbpcver=$(get_latest_release "backuppc/rsync-bpc") mkdir -p /tmp/bpc cd /tmp/bpc if [ $SOURCE = "tar" ]; then ##Fetch and install latest stable releases wget https://github.com/backuppc/backuppc-xs/releases/download/$bpcxsver/BackupPC-XS-$bpcxsver.tar.gz wget https://github.com/backuppc/rsync-bpc/releases/download/$rsyncbpcver/rsync-bpc-$rsyncbpcver.tar.gz wget https://github.com/backuppc/backuppc/releases/download/$bpcver/BackupPC-$bpcver.tar.gz tar -zxf BackupPC-XS-$bpcxsver.tar.gz tar -zxf rsync-bpc-$rsyncbpcver.tar.gz tar -zxf BackupPC-$bpcver.tar.gz cd BackupPC-XS-$bpcxsver perl Makefile.PL make make test make install cd ../rsync-bpc-$rsyncbpcver ./configure make make install cd ../BackupPC-$bpcver fi if [ $SOURCE = "git" ]; then #Fetch and install the latest development code instead git clone https://github.com/backuppc/backuppc.git git clone https://github.com/backuppc/backuppc-xs.git git clone https://github.com/backuppc/rsync-bpc.git cd backuppc-xs perl Makefile.PL make make test make install cd ../rsync-bpc ./configure make make install cd ../backuppc ./makeDist --nosyntaxCheck --releasedate "`date -u "+%d %b %Y"`" --version ${bpcver}git tar -zxf dist/BackupPC-${bpcver}git.tar.gz cd BackupPC-${bpcver}git fi if [ $ACTION = "install" ]; then ./configure.pl --batch --cgi-dir /var/www/cgi-bin/BackupPC --data-dir /var/lib/backuppc --hostname backuppc --html-dir /var/www/html/BackupPC --html-dir-url /BackupPC --install-dir /usr/local/BackupPC fi if [ $ACTION = "upgrade" ]; then ./configure.pl --batch --config-path /etc/BackupPC/config.pl fi #Set up web server #Note that changing the apache user and group (/etc/apache2/envvars) could cause other services #provided by apache to fail. There are alternatives if you don't want to change the apache #user: use SCGI or a setuid BackupPC_Admin script - see the docs. cp httpd/BackupPC.conf /etc/apache2/conf-available/backuppc.conf sed -i "/Require local/d" /etc/apache2/conf-available/backuppc.conf sed -i "s/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=backuppc/" /etc/apache2/envvars sed -i "s/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=backuppc/" /etc/apache2/envvars echo '<html><head><meta http-equiv="refresh" content="0; url=/BackupPC_Admin"></head></html>' > /var/www/html/index.html a2enconf backuppc a2enmod cgid service apache2 restart #Set up backuppc service cp systemd/init.d/debian-backuppc /etc/init.d/backuppc chmod 755 /etc/init.d/backuppc update-rc.d backuppc defaults chmod u-s /var/www/cgi-bin/BackupPC/BackupPC_Admin touch /etc/BackupPC/BackupPC.users sed -i "s/$Conf{CgiAdminUserGroup}.*/$Conf{CgiAdminUserGroup} = 'backuppc';/" /etc/BackupPC/config.pl sed -i "s/$Conf{CgiAdminUsers}.*/$Conf{CgiAdminUsers} = 'backuppc';/" /etc/BackupPC/config.pl chown -R backuppc:backuppc /etc/BackupPC echo $PASSWORD | htpasswd -i /etc/BackupPC/BackupPC.users backuppc service backuppc start #Clean up cd rm -rf /tmp/bpc echo "All done!" exit 0
  • Basic Linux Terminal Commands

    Pinned Linux Systems Guides
    8
    1 Votes
    8 Posts
    8k Views
    rickR
    To list all files in current directory including dot files (hidden files or directories), as well as print permissions : ls -la
  • Install Ruby on Debian

    Linux Systems Guides ruby debian
    1
    9
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Basic file permissions

    Linux Systems Guides permissions
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Install locate *nix

    Linux Systems Guides locate
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Set script to executable

    Linux Systems Guides chmod terminal executable
    1
    3
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • Find system manufacturer

    Linux Systems Guides system info dmidecode nix
    3
    0 Votes
    3 Posts
    2k Views
    rickR
    dmidecode -t processor
  • 0 Votes
    2 Posts
    3k Views
    rickR
    Maria database sudo su mariadb CREATE DATABASE <put your database name here without the carrots>; CREATE USER <put your password here without the carrots>@localhost IDENTIFIED BY 'put your password here'; GRANT ALL ON your database name.* TO your_username@localhost; FLUSH PRIVILEGES; exit; exit
FreeBSD Notes
  • email-scam.png

    read more

  • cloud-scam.png

    read more

  • Create a shell script that will dump the Redis database

    cd ~ mkdir redi-backups-script cd redis-backups-script nano redis_backups-script.sh

    Paste the script below:

    #!/bin/bash rdb_file="/Place-directory-of-rdb-here/redis/dump.rdb" redis_cli="/usr/bin/redis-cli" DIR=`date +%d-%m-%y` DEST=~/redis_backups/$DIR mkdir $DEST echo save| $redis_cli exit 1

    Set script to executable:

    chmod +x ~/scripts/redis_backups-script.sh

    Create a cron to run daily:

    Then create a cron job to run the script every day at midnight:

    crontab -e 0 0 * * * ~/redis-backups-script/redis_backup.sh

    Restore RDB backup

    Disable Append Only in the config:

    nano /etc/redis/redis.conf appendonly no

    Stop redis:

    sudo service redis-server stop

    Restore the redis backup:

    rename the rdb file you wish sudo cp /home/redis/dump.rdb /home/redis/dump.rdb.bak

    You can then copy the backup rdb file as follows:

    sudo cp /redis_backups/------/dump.rdb /home/redis/dump.rdb

    Apply the proper permissions to the dump.rdb file:

    sudo chmod 660 /home/redis/dump.rdb

    Re-starting Redis server

    sudo service redis-server start
    read more

  • Install Zabbix 7.2 repo

    wget https://repo.zabbix.com/zabbix/7.2/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.2+debian12_all.deb

    zab1.png

    dpkg -i zabbix-release_latest_7.2+debian12_all.deb

    zab2.png

    Update repos

    apt update

    zab3.png

    Install Zabbix server and frontend

    apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2

    zab4.png

    Install plugins

    apt install zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql zabbix-agent2-plugin-postgresql

    zab5.png

    Install mysql

    wget https://dev.mysql.com/get/mysql-apt-config_0.8.30-1_all.deb

    zab-6sql.png

    sudo dpkg -i mysql-apt-config_0.8.30-1_all.deb

    Error on this new install, where lsb-release is not installed

    zab7sql-error.png

    apt-get install lsb-release

    zab7lsb.png

    Try again…

    dpkg -i mysql-apt-config_0.8.30-1_all.deb

    Error, gnupg not installed

    zab7gnupgerror.png

    apt install gnupg2

    zab7gnupg2.png

    Give it another go…

    dpkg -i mysql-apt-config_0.8.30-1_all.deb

    zab7sqltui.png

    zab7sql.png

    I had to list upgradable packages :

    apt-list --upgradable

    Which spit out : mysql-common/unknown 8.4.4-1debian12 all [upgradable from: 5.8+1.1.0]

    Then installed mysql-common

    apt-get install mysql-common

    zabbix-7-sqlgoofs.png

    Had to uninstall Mariadb to resolve these conflicts

    apt remove mariadb-client-core

    Then install mysql-server:

    apt install mysql-server

    zab7-sql-common.png

    zab7-sql-rootpass.png

    Enter your password, twice

    Now enter mysql by typing :

    mysql -u root -p

    zab7-mysql-enter.png

    Enter the following command individually Where ‘password’ is where you type in your actual own password

    mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by 'password'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> set global log_bin_trust_function_creators = 1; mysql> quit;

    Populate the database with zabbix script

    zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix mysql --u root -p set global log_bin_trust_function_creators = 0; quit;

    Edit file /etc/zabbix/zabbix_server.conf You can use nano

    nano /etc/zabbix/zabbix_server.conf

    Uncomment the DBPassword section, and type your password

    zabbix-dbpassword.png

    Then hold ctrl and tap x, it will ask if you want to save changes.

    Enable services:

    systemctl enable zabbix-server zabbix-agent2 nginx php8.2-fpm systemctl restart zabbix-server zabbix-agent2 nginx php8.2-fpm

    Check that zabbix service has started

    journalctl -xeu zabbix-server.service

    zabbix7startjob.png

    Delete the 'default site in nginx

    sudo rm -rf /etc/nginx/sites-enabled/default

    Make sure the symbolic link to the zabbix nginx file is present

    ln -s /etc/zabbix/nginx.conf /etc/nginx/sites-enabled/zabbix.conf

    Check that the zabbix nginx file is in the includes in nginx config

    nano /etc/nginx/nginx.conf

    Look for :

    include /etc/nginx/sites-enabled/*

    Now restart nginx

    systemctl restart nginx

    Hit the browser and type in the IP (or URL that you may have put in the zabbix nginx config file)

    zabbix.png

    Make sure to configure locales

    zabbix-locales.png

    sudo dpkg-reconfigure locales

    zabbixlocalestui.png

    zabbix-locales-2.png

    zabbix-locales-command.png

    Reboot the system

    sudo shutdown -r now

    zabbix-utf.png

    Add your database password

    zabbix-db.png

    Add a server name

    zabbix-servername.png

    zabbix-summary.png

    zabbix-config.png

    The default username is Admin, and the password is zabbix

    zabbix-home.png

    read more

  • Unable to negotiate with 10.10.1.35 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

    While attempting ssh this error is generally due to mismatched versions of ssh, where an up to date version is attempting to access an older version

    Add the following to your command :

    The proper way:

    ssh -o KexAlgorithms=diffie-hellman-group14-sha1 -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    The cheap way:

    Example :

    ssh -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    or ssh -oHostKeyAlgorithms=+ssh-dss user@10.10.1.35

    This can be added to the ~/.ssh/config file

    Host my-server HostName 10.10.1.35 HostKeyAlgorithms=+ssh-dss
    read more