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/

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

start TeamViewer via ssh

I’ve had situation when I urgently need access to my desktop. And I had only one program for remote control – teamviewer.
So here described one of the ways to run it when you have only ssh (i.e. command line):

  •  first of all connect to remote machine via ssh.
  • check if daemon is running fine:
    teamviewer --daemon status
  • determine Partner ID (remote machine id):
    teamviewer --info | grep "TeamViewer ID"
  • start it via one of the these methods. In my case worked only one:
    export DISPLAY=":0.0"
    teamviewer
  • obtain password. Here is two possible ways… in command line: teamviewer --passwd [PASSWD]
    this one din’t work for me 🙁 so lets  take screen-shot of  teamviewer window (with password) and via scp download it. for this:
    xwd -name TeamViewer | xwdtopnm | pnmtopng > passwd.png

start program with GUI via ssh without X-server

There are a lot of methods, few of them are described below:

  1. ssh X-forwarding:
    • Please ensure such parameters are enabled in your ssh server:
      #Specifies whether TCP forwarding is permitted
      AllowTcpForwarding yes
      X11Forwarding yes
      #Specifies the first display number available for sshd’s X11 forwarding:
      X11DisplayOffset 10  
      #sshd should bind the X11 forwarding server to the loopback address or to the wildcard address:
      X11UseLocalhost yes
    • Turn on X-forwarding by executing command: ssh -X user@host
    • If you see any errors whit -X. the remote machine is treated as trusted client.. run: ssh -Y user@host
  2. use -display :0.0 after name of program name. In this case very comfortable to use screen command.
  3. Export global variable: export DISPLAY=”:0.0″