systemd ssh SOCKS proxy

There is nothing to say, just example..

cat /etc/systemd/system/ssh-scocks-proxy.service
[Unit]
Description=Socks proxy via SSH
ConditionPathExists=|/usr/bin
After=network.target

[Service]
ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i -D user@remote-server.com

# Restart every >2 seconds to avoid StartLimitInterval failure
RestartSec=5
Restart=always

[Install]
WantedBy=multi-user.target

(c) https://gist.github.com/drmalex07/c0f9304deea566842490
(c) https://blog.kylemanna.com/linux/ssh-reverse-tunnel-on-linux-with-systemd/

Linux memory usage per user

#!/bin/bash

if [[ "$1" = "-h" || "$1" = "--help" ]]
then
        echo "Usage: $(basename $0) [user]"
        echo ""
        echo "  -h [--help] - shows this help"
        exit 0
fi

if [[ -z $1 ]]
then
        for i in `ps -e -o user --no-header | sort | uniq`; do
                echo "$i: $(ps -u $i  -o rss --no-header | paste -sd+ -| bc)KB"
        done;
else
        echo "$1: $(ps -u $1  -o rss --no-header | paste -sd+ -| bc) KB"
fi

bind9 log file Ubuntu

to forward log info from syslog to another file for bind9 server in Ubuntu you have to:

  1. add logging section in any name.conf* file:
    logging {
        channel bind_log {
        file "/var/log/named.log";
        print-time yes;
        print-category yes;
        print-severity yes;
        };
        category default { bind_log;};
        category xfer-in { bind_log;};
        category xfer-out { bind_log;};
        category update { bind_log;};
        category security { bind_log;};
        category queries { bind_log;};
    };
    
  2. update apparmor config by adding to file /etc/apparmor.d/usr.sbin.named
     /var/log/named.log rw, 
  3. apparmor_parser -r /etc/apparmor.d/usr.sbin.named
  4. service bind9 restart

git commands

  • add new user in gitolite:
    * cd /tmp/
    * git clone git@git-host:gitolite-admin
    where: git - git-user, git-host - address or hostname of server, gitolite-admin - repo name
    * ssh-keygen -t rsa
    .pub - keep on server side.
    * cp /some/where/new_user_key.pub /tmp/gitolite-admin/keydir
    * git add keydir
    * git commit
    * git push
  • create new repositories:
    * update file: gitolite-admin/conf/gitolite.conf
    * git add .
    * git commit -a -m "some comment"
    * git push