Minimal things needed for SSH login on Debian Linux

I was unable to find a place where all these things are collected, so I have decided I will write it down here.

So I am currently working on a little project where I need to have SSH access during the boot (on the initrd system). The following things are needed to create a working – as far as I know – minimal SSH server:

  • ifconfig – to configure the network interface
  • route – to configure the routing
  • Dropbear SSH server – a very small, and fully functional SSH server, client, keygen
  • /etc/login.defs
  • /etc/passwd, /etc/shadow, /etc/groups – for the authentication
  • /lib/libnss_files* – for the authentication processing
  • /etc/nsswitch.conf with the following content:

    passwd: files
    group: files
    shadow: files
  • /dev/pts – with devpts mounted (mount -t devpts none /dev/pts) for the terminals

On some systems the Dropbear needs a “better entropy device” than /dev/random, so we should symlink /dev/urandom to /dev/random.

And that’s all, everything should be fine now, and should run. I think I will write an another post with the whole “early ssh” thing soon, but I still need testing, and have to clean up my code somewhat.

Posted in: Uncategorized by kakaopor 1 Comment , ,

How to repair an SQLite database

Today I have faced with a crashed SQLite database. Actually, I am not totally sure it was crashed, but the sqlite process had not shut down properly, and (after this) to select anything from it has taken more than an hour, anyway it was damn slow, and has eaten a lot of CPU time, and has created a huge journal file on every select. Then I got the idea, why not dump it and restore to another file? So I tried the following:


# echo ".dump" | sqlite old.db | sqlite new.db

(Here we give the command “.dump” to the SQLite with the old DB, and we redirect the output (the SQL dump itself) to another SQLite process with the new DB. It is the same as dumping to a file, and then restoring it, but it is much faster, and does not need a (probably) big dump file.)

Then the database had become 1.7GB from the original 2.7GB, so it had a lot of overhead before, and it is really fast now.

Posted in: Uncategorized by kakaopor 4 Comments , ,

Busybox fdisk segmentation fault error

Today I have run into an error with fdisk under busybox. I am currently building a really small system with basic stuffs, and I need to run fdisk in the initramfs. Unfortunately when I try to run fdisk interactively, I get the following error:


fdisk[...]: segfault at 8117dc4 ip 080ff478 sp bffee994 error 7 in fdisk[8048000+df000]
Segmentation fault

It seems this is a bug in the input handling, or maybe I made something wrong. Anyway, the following is working fine:


# cat | fdisk /dev/...

I will take a look on this in the source and update this post if i will have enough time.

Posted in: Uncategorized by kakaopor No Comments ,

Captchaz – a free captcha generator php class

I have “released” the first version of my own Captcha generator for PHP.

You can download it (for free of course) on these links:

If you have any comments, questions or anything contact me by commenting to this post, or by filling the contact form on the captchaz page.

Have fun with it!

Posted in: Uncategorized by kakaopor No Comments , ,

First post

This is my first Wordpress post ever. I will write some random things here what I meet, experience, try, make and so on. So some really random things will be here – if I have any interesting subject and enough time.

Well, I hope this won’t be too boring.

(That was really lame. I hope the upcoming posts will be better. Or just less lame.)

Posted in: Uncategorized by kakaopor No Comments
i
north-supercharged