Tips Linux

Linux, DevOps and Security

Elegant way to pass arguments to a bash script


When I started to write bash scripts, I found that it was really convenient to use the basic way to pass arguments with $1 $2 and so on.

Continue reading

Root password Linux reset in 1 minute

This little trick recently saved me from a critical situation and shows one more time the weakness of every system with unencrypted disks.

Continue reading

Reverse shell on firewalled server

Sometimes, it may be useful to keep a connection to a server (let’s call it SERVER_1) that is not reachable from the internet because of iptables ingress rules or simply because it doesn’t have a public IP.¬† You can reach it from another server (let’s name it SERVER_2) that is accessible.

Continue reading

Simple python random

Recently, I had to chose randomly 4 people for a thankless task. It was the perfect occasion to code a simple script using the Python random module:
# -*- coding: utf-8 -*-
import random
people_initials = ['ML','WD','ME','BH','FS','AQ','SB','FR','KB','LL','FP','MG','AH','FJ']
rand_people = random.sample(people_initials, 4)
print rand_people


Don’t name your script or it won’t work.

Vim – Find and replace strings

Vim can be hard to use at the beginning, but when you’re used to it and know a few tricks, it’s impossible to go back to nano, also known as ‘the text editor for kids’.

Continue reading

Shell script to add keys to ssh config file

When you have many servers with different usernames, keys etc, it’s easier to manage the server with the .ssh/config file.

A very basic script that I wrote long time ago to easily add an host to my ~/.ssh/config file.

Continue reading

How to resume a stalled scp transfer

SCP is the perfect command line tool to transfer huge files from a server to another one but if the connection drops, the transfer become “stalled” and seems impossible to resume. Don’t panic, rsync allow us to resume a failed scp transfer :


rsync --partial --progress --rsh=ssh user@server:path/my_file /home/my_file


A quick and dirty method to launch one or more scripts as daemon with nohup

A quick and dirty method to launch one or more scripts as daemons with nohup :
nohup python3

You can safely close the terminal and your script will continue to operate in background.

IP extraction

Regex are useful to cope with basic unix / linux administration tasks.
To extract IP from file, this simple command do the trick :
grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /var/log/auth.log 15-08-27 - 16:17:00

Continue reading

© 2019 Tips Linux

Theme by Anders NorenUp ↑