...sur mon blog, j'utilise ce site pour noter les petites choses qui me sont utiles, que ça soit informatique ou autre :)

Il y a 2 years 9 months

I'm putting this small tuto here, I've been stuck with my syno two times because of the mfa not working (key change after a DSM migration and another time when I had a pb with the clock not on time which was blocking the 2fa key calculation) :

With a ssh admin user, ssh to your NAS and go in the directory


Find the directory of the user you want to modify and chdir into it, then remove the file google_authenticator

note : it's good to have a spare local admin user even if you are in a domain/ldap

source ici

Il y a 5 years 2 months

I've been through a svn to git migration, I've been blocked with a bad revision which prevented me from git svn clone my repository. I've seen that it is possible to bypass bad revision, using svnadmin utility.

I've wrote a small script that allows me to skip bad revision, an continue the dumping process without any manual action :

echo "removing initial revision dump"
rm -f /home/data01/svn-dumpfile-20190517-1
if ! [ -f /home/data01/svn-dumpfile-20190517 ] ; then
    echo "dumping first"
    /usr/bin/svnadmin dump /home/data01/repository > /home/data01/svn-dumpfile-20190517 2> ./dump-start.log
echo "copie du dump"
cp /home/data01/svn-dumpfile-20190517 /home/data01/svn-dumpfile-20190517-1
counter=$(tail ./dump-start.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
echo "last buggy revision is : $counter"
echo "incrementing next revision"
echo "removing last dump.log"
echo > ./dump.log
echo "ready to start !?"
read toto
while [ "$counter" -le 42700 ] || [ "$res" -eq 1 ]
    echo "dumping from revision $counter"
    /usr/bin/svnadmin dump --incremental -r $counter:HEAD /home/data01/repository >> /home/data01/svn-dumpfile-20190517-1 2>>./dump.log
    if [ "$res" -ne 0 ] ; then
        newcounter=$(tail -20 ./dump.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
        if [ "" != "$newcounter" ] && [ $newcounter -gt $counter ] ; then
            echo "found newcounter=$newcounter"
        echo "buggy revision is : $counter"
        echo "end of the dump !"
    echo "skipping revision $counter"

It's a quick-and-dirty script, leaved here asis ;)

Il y a 5 years 4 months

I've just reinstalled a centos7 VM, and I wanted to plug ldap authentification so that my ldap users could login

Here are the instructions to do so :

yum -y install sssd
echo "[domain/default]
id_provider = ldap
auth_provider = ldap
chpass_provider = ldap
sudo_provider = ldap
ldap_uri = ldaps://
ldap_default_bind_dn = uid=the_user,cn=users,dc=example,dc=com
ldap_default_authtok = l3passw0rd
ldap_default_authtok_type = password
ldap_id_use_start_tls = True
ldap_tls_reqcert = never
ldap_search_base = dc=example,dc=com
ldap_sudo_search_base = ou=wheel,dc=example,dc=com
ldap_netgroup_search_base = dc=example,dc=com
cache_credentials = True
enumerate = True
autofs_provider = ldap
override_homedir = /home/%u
default_shell = /bin/bash
services = nss, sudo, pam, autofs
config_file_version = 2
domains = default
filter_users = root,ldap,named,avahi,haldaemon,dbus,radiusd,news,nscd
" > /etc/sssd/sssd.conf
chmod 600 /etc/sssd/sssd.conf
chown root:root /etc/sssd/sssd.conf
authconfig --enablesssd --enablesssdauth --enablemkhomedir --enablelocauthorize --update
systemctl restart sssd.service

Et voila !

Il y a 6 years 1 month

Create directory if it doesn't exist :

mkdir /etc/systemd/system/docker.service.d/

Create file :

echo '[Service]
' > /etc/systemd/system/docker.service.d/http-proxy.conf
echo '[Service]
' > /etc/systemd/system/docker.service.d/https-proxy.conf

Reload systemctl & docker daemon :

systemctl daemon-reload
systemctl restart docker
Il y a 6 years 2 months

A small fonction useful to add to your .bashrc

whoswaps ()
  for file in /proc/*/status;
        echo $file $(awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file);
    done | sort -k 3 -n -r | less