Know when and who is doing ssh

I would like to know if someone is using the ssh on my servers. That’s why I have put a telegram notification. Here is how it works

Put in ssh/sshrc


telegram-send -g "Access $SSH_TTY $SSH_CONNECTION `id`" &

Of course you need to setup your telegram-send

Compare two filesystems

Lets run those command on the machines

New instanceOld instance
find / -xdev | sort > new.txt find / -xdev | sort > old.txt

Pull the files locally

scp -i ~/.ssh/somekey [email protected]:/new.txt  /tmp/new.txt
scp -i ~/.ssh/somekey [email protected]:/old.txt  /tmp/old.txt

Then use this great delta tool to compare the files

delta -s /tmp/new.txt /tmp/old.txt

Using md5 sums

And a using md5 sums – this is slow!

# On the new instance

find / -xdev -type f -exec  md5sum {} \; > new-files.txt
find / -xdev -type d | sort >
sort  -k2  new-files > 

# On the old instance

find / -xdev -type f -exec  md5sum {} \; > old-files.txt
find / -xdev -type d | sort > sorted.old-folders.txt
sort  -k2  old-files >sorted.old-files.txt 

How to pull files from remote sftp

Create a script with the commands to pull the files and the remove them from the remote server

get -r upload/* incoming/
rm upload/*

You will need a cron

0 5 * * * /usr/bin/sftp -b [email protected]

I recommend using systemd so that you can have logs

Where is more clear to do line break

Continue reading

Create AP on ubuntu

Continue reading

Check to dns zones

We are migrating from Cloudflare to route53 and want to make sure that all the records are migrated correctly.

records = %w(

records.each do |record|
  aws = `dig +noall +answer |tr '\t' ' ' | cut -d' ' -f1,3,4,5`
  cf = `dig +noall +answer @|tr '\t' ' ' | cut -d' ' -f1,3,4,5`

  if aws != cf

terraform bash shorcuts

Do you enjoy switching between us-east-1 and eu-central-1? If not here are some shortcuts which might make your day.

function change_region(){
  cd $new_folder

function production(){
  change_region 'terraform_production' 'terraform_development'

function development(){
  change_region 'terraform_development' 'terraform_production'

function us(){
  change_region 'us-east-1' 'eu-central-1'

function eu(){
  change_region 'eu-central-1' 'us-east-1'

How to give better examples

Continue reading

Rails free hosting

If you want free hosting, I mean free, not-cheap or other kinds of hosting. The only option which I know for now is Heroku.

There are some websites which advertise them as free rails hosting but they are paid.

So stay safe with the good old, slow on boot but very stable and enjoyable to work Heroku!

Akonadi KDE

Continue reading

© 2021 Gudasoft

Theme by Anders NorénUp ↑