How to stole ssh session when you’re root

It happen to me all the time that one of developers notifies me about some kind of problem that I can’t confirm from my account. Sometimes it was because of bad ssh keys configuration, other times file permissions, mostly such stuff. It’s sometimes convenient to “enter into someone’s shoes” to see what’s going on there. If you’re root on machine you may do that like this: su developer - Easy one but that’s not enough for all cases. When you use bastion host (or similar solutions) sometimes users have connection problems and it’s harder to check. When such user have ForwardAgent ssh option enabled you may stole this session to check login problems. After you switch to such user, you may wan’t to hide history (it’s optional 😉 ) - disable history like that: ...

2016-04-27 · 1 min · timor

pip - uninstall package with dependencies

Virtualenvs in python are cheap but from time to time you will install something with pip on your system and when time comes removing all this crap could be difficult. I found this bash snippet1 that will uninstall package with all dependencies: Recursive pip uninstall for dep in $(pip show python-neutronclient | grep Requires | sed 's/Requires: //g; s/,//g') ; do pip uninstall -y $dep ; done pip uninstall -y python-neutronclient Depending how you installed it, you might need to use sudo. ...

2016-04-26 · 1 min · timor

Daily MySQL backups with xtrabackup

I’ve been using standard MySQL dumps as backup technique on my VPS for few years. It works fine and backups were usable few times when I needed them. But in other places I’m using xtrabackup. It’s faster when crating backups and a lot faster when restoring them - they’re binary so there is no need to reevaluate all SQL create tables/inserts/etc. Backups also include my.cnf config file so restoring on other machine should be easy. ...

2016-04-23 · 3 min · timor

Use bastion host with Ansible

When you deploy your application in cloud you don’t need and don’t want your hosts exposed via SSH to the world. Malware scans whole network for easy SSH access and when find something will try some brute force attacks, overloading such machines. It’s easier to have one exposed, but secured host, that doesn’t host anything and is used as proxy/gateway to access our infrastructure- it’s called bastion host  external link . ...

2016-04-22 · 3 min · timor

Tweaking ASUS Zenbook UX305CA on Linux

Lately I was searching for mobile notebook that I could use for remote work. I checked f ThinkPad series but they were huge bricks that have nothing in common with ‘mobile’ word. Then I saw ASUS Zenbook that I didn’t take into account before and it was exactly what I was searching for. Configuration of Skylake based notebook right now is not straightforward - there are still glitches and small bugs that are waiting to be fixed. I want to sum up what I’ve done after installation. I started with fresh Ubuntu 16.04 to get Debian based distro with possibly latest kernel and patches. ...

2016-04-21 · 11 min · timor

Prefer IPv4 over IPv6

I try to use IPv6 where it’s available but it’s sometimes so hard… It happen quite often that I can’t download packages from repos because they weren’t configured on IPv6 vhosts even when host is available via IPv6 address. For APT you may use this trick to force IPv4 connections only: echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4 If you need more than that, then gai.conf will allow you to filter where you will be connecting via IPv4 and where via IPv6 - in example bellow you will prefer IPv4 whenever it’s available: ...

2016-03-29 · 1 min · timor

List octal file permissions in bash

Sometimes it’s easier to use octal file permissions but they’re not so easy to list. I caught myself few times that I didn’t remember how to list them - so this is a reason for that note. stat -c "%a %n" * 755 bin 755 games 755 include Yes, it’s that easy 😃 And here also with human readable attributes: stat -c '%A %a %n' * drwxr-xr-x 755 bin drwxr-xr-x 755 games drwxr-xr-x 755 include

2016-02-24 · 1 min · timor

WordPress with HyperDB on PHP 7.0

I was configuring WordPress with HyperDB  external link plugin on PHP 7.0 but the only I get were constant 500 errors. As I found here  external link PHP 7.0 is not supported by HyperDB for now - it’s rely on mysql php extension but in PHP 7.0 there is only mysqli extension. But few folks fixed it and it’s possible to use it. ...

2016-02-24 · 1 min · timor

Automatically build after file change

I’m playing a lot with Docker lately. Building images, and then rebuilding, and then building again… It’s pretty boring. To automate this task a little I used inotify to build automatically after I changed any file. This trick could be used in many different situations. You will need inotify-tools package: sudo apt-get install -y inotify-tools Then run something like this: while inotifywait -e modify -r .; do docker-compose build; done This commands will rebuild my Docker images after any file change in current directory. Use Ctrl+c to exit from loop. ...

2016-02-23 · 1 min · timor

Install WordPress from command-line

I never tried it before but today I needed to install WordPress… From command line only. And there is a way to do this with wp-cli  external link . WP-CLI installation First some requirements (as root): apt-get install php5-cli php5-mysql mysql-client curl And now installation of wp-cli (as root too): curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar mv wp-cli.phar /usr/local/bin/wp Check if it’s working: ...

2016-02-15 · 1 min · timor