Sabri – Ssh from Automatic Bash Remote Inditement

Comments // Written on Jul 02, 2009 // Open Source

SabriI got a memory leak problem on my brain. Can’t remember all the passwords, hosts and usernames to connect to work and home servers, remote hosts etc. Usually I store everything on gnote and then simply copy&paste on my terminal, but I got bored about that, so I created sabri.

Sabri ( Ssh from Automatic Bash Remote Inditement ) is a Bash script able to store on a sqlite3 database all my ssh connections data (host, user & pass) and then connect to any of them automatically without prompting me for each password. I used Expect for automatic password send to openssh server and Crypt::Tea perl module to encrypt passwords for data safety.

Here’s how it works:

sabri -i #Installs the Database and create tables
sabri -s # Create a new connection
sabri -d connection_name # Connects to a stored connection

Easy uh?

Sabri is still in pre-release, I still didn’t realize any error detection/prevention, but if anyone wants to try it out just clone my sabri’s git repository

git clone git://github.com/andreaolivato/Sabri.git

or go to GitHub to download the zip file.

Please run

sabri -h

and

sabri -c

before any other action!

A linuxer life part 1 – The early morning

Comments // Written on Dec 04, 2008 // A linuxer Life

Waking up … just some services up

init 1

Getting brain fully functional, connecting to the world

init 3
username
password
/etc/init.d/net.brain start

Look at the clock, it’s late dammit! Tought it was earlier

/etc/init.d/ntp-client start

Get out of the bed, straight to the toilet, flush the toilet

pwd
~/house/bedroom
cd ~/house/toilet
mv ~/.local/share/Trash/files/* ./
rm * -r

Whash teeths and armpit, get a bidèt

cd ~/.body/teeths && svn cleanup
cd ~/.body/armpits && svn cleanup
cd ~/.body/xxx && svn cleanup

Go back to the room, trow away the bed clothes, get the work ones, get dressed

cd ~/house/bedroom
rm ~/.clothes/debian-shirt.sh # To sleep safe
rm ~/.clothes/boxer-shorts-old.sh
wget http://clothes.lan/odd-socks.bz2 ~/.clothes
wget http://clothes.lan/boxer-shorts-new.bz2 ~/.clothes
wget http://clothes.lan/gentoo-shirt.bz2 ~/.clothes # To be powerful
wget http://clothes.lan/black-jeans.bz2 ~/.clothes
bunzip2 *.bz2

Go to kitchen, grab some food, eat it and start digesting…it will take a while…

cd ~/home/kitchen
git clone git://fridge.lan/milk ~/.body/mouth
cd ~/.body/mouth
./configure --prefix="~/.body/stomach"
make chew
make gulp
make digest
CTRL+Z

Exit home, see a fatty neighbour out of his door, say hello to him then go down the stairs ’till out

cd ~/
cd ../
ls -l
-rw-r--r-- 1 me me 71680 2 dic 09:10 me.person
-rw-r--r-- 1 neighbour neighbour 97280 2 dic 09:10 him.person
echo "Good morning\n";
Good Morning
cd ../
pwd
/

Bash Completition on Gentoo

Comments // Written on Dec 03, 2008 // Open Source

Here’s how to get a personalized and satisfactory completion on Gentoo installations..

Fisrt of all you need an use flag set widely in your system so that every software you are going to emerge (or re-emerge) if is capable will be added to your completition choices. To do so just open our magic make.conf with your favourite editor (I use vim, you can use emacs, nano, pico…i don’t really care about wars)
# vim /etc/make.conf
then find the USE variable and add inside it the string
bash-completion
Now you have the option to re-emerge all previously installed programs that have bash-completition USE flag. To do so just do
# emerge -a --newuse world
Right now you got the correct completitions available but to use them you need to install the bash completition ebuild so…
# emerge -avtD app-shells/bash-completion app-shells/gentoo-bashcomp
After emerging the ELOG will tell you to add a string to your .bashrc to enable it. So for each user you want to enable bash completition just edit their own .bashrc.
$ vim ~/.bashrc
Obviously you can do it for root account too (for emerge f.e.)
# vim /root/.bashrc
Right now you got it configured but no program is really affecting your bash shell. To do so I suggest you to use eselect (if you don’t have it just emerge it).

Fist of all use eselect to list all your available programs
# eselect bashcomp list
Then just choose wisely the programs you would like to add and insert them using their ID (the number beetween squares [] ).
# eselect bashcomp enable 1

Done! I usually like adding just a few completition like the emerge one (called gentoo, it adds other completitions then emerge alone) , subversion and git…