Posts Tagged ‘linux’

How to create an encrypted blank password with sha512

September 13, 2013

First let me explain why I want to do something like that. By the way at the bottom of this article is the one-liner which will do what you want. I just like to write a bit more for those who find it entertaining.

First of all, because it’s fun. So I’m a geek and my idea of fun may be a bit diluted, but finding out how to do it was fun. Secondly it’s just a tad more secure than having a blank in /etc/shadow which is just to easy to spot. And in the third place users with blank password can have annoying limitations. As it should be, I must admit.

And finally, which is actually the reason for having blank passwords in the first place, this computer is used by my little nieces and my mother and I don’t want to burden any of them with a password. Yes I can proudly say that my 9 year old niece has been using Linux for years. 🙂 Who says Linux is hard?

And to anyone having that prejudice I can only suggest trying to install windows by themselves, spend two days rebooting and updating (they go hand in hand) and fixing those annoying update problems and the accompanying incomprehensible error messages. Compare that with installing Linux, which would take you about an hour to have a fully functioning completely updated system with all the programs you need and just those and all of that without needing to have any technical knowledge, provided you choose an easy distribution like Ubuntu or one of its derivatives.

Sorry for my rambling, but I just spend a weekend installing a laptop with a messed up recovery, for which I needed to download the windows aik, burn a windows recovery disk on another pc and use the terrible Microsoft command prompt. And let’s not forget all those nice free programs on windows which all want to install other programs and tool bars you don’t need, or search engines that can’t find a single useful bit of information. And of course each time they update you’ll get the same, all for your convenience.

Enough about my frustration with Windows. So I knew it was possible to have a blank encrypted password, because I know Ubuntu did it. They may still do, but I don’t use it anymore since it wasn’t made for me. I make to many customizations and that doesn’t work well with doing an upgrade to a new version. Arch is my weapon of choice nowadays. Well anyway, let’s get back to the subject at hand.

All the password are stored in /etc/shadow, not the passwords themselves of course, but a salted hash. On this page I found a very good description of the file format. As it says in the comments, it explains a lot of aspects others overlooked. The next question was: “How does one create a salted hash?” To which I found the answer on serverfault. That’s all just nice and fine but I wanted the salt to be random, so that each of my users would have a ‘unique’ password, at least by the look of it, in /etc/shadow. Which meant I needed a random string. That’s where this page helped out.

Combining all that information into one line, you’ll get:

python2 -c 'import crypt; print crypt.crypt("", "$6$'$(date +%s | sha256sum | base64 | head -c 8)'")'

Just copy and paste the line above to your terminal and it will output a random encrypted blank password. This should output something like this:

Pretty nifty, ain’t it? Don’t get mislead by the sha256sum. It’s just for creating the random salt. Python does the encryption and “$6$” means it’s sha512, which is the standard nowadays. Since it’s in python 2, I had to change python from the original post to python2. It might be named differently on your distribution, but that’s how it’s called on Arch. All you need to do now is open /etc/shadow and paste the output string into it. I presume you know how to do that. Otherwise, just follow the link above and read that post.


How to switch from alsa to OSSv4

July 25, 2009

I’ve recently switched from alsa to OSSv4 on my linux box and I find the difference in quality amazing. I can now hear details in the music I did not hear before on my laptop. And as a nice side effect it solved a problem I’ve had with flash for a long time. After using firefox for several hours, sound in flash started to stutter and the only way to solve that was to restart firefox.

First of all, I’m using ubuntu 9.04 (Jaunty Jackalope) 32-bits with kernel 2.6.28-13-generic. I have a built in HD audio (ICH6 family). I never had any problems with alsa or pulse, though I removed pulse not long after installing, since I did not see the benefit of it.

benefits, drawbacks and popular misconceptions


  • Better sound quality.
  • Mixing is done within kernel space, meaning lower latency
  • drawbacks

  • Your card may not be supported
  • midi is not supported yet.
  • sound recording on generic usb sound devices is not yet implemented, and support for those devices is still considered experimental.
  • popular misconceptions

  • Some people seem to believe OSS is a security risk, since it does mixing within kernel space. However, I’ve seen none of them explain why this would be so.
  • How to install OSSv4

    Before you begin.

    Install libasound2-plugins. Just open a terminal and type:
    sudo apt-get install libasound2-plugins
    Make sure your soundcard is supported.
    Here’s the list of currently supported cards.
    If you ever created a custom config file for alsa back it up and remove it. Since I know what kind of hell it is, to write one of those I would not want you to loose the work it took to create one. If you don’t know what I mean, just type.
    ls ~/.asoundrc
    ls /etc/asound.conf
    If both commands show nothing, consider yourself lucky you never had to create a custom configuration for alsa.
    Otherwise use sudo mv to move them to a back-up position.


    Go to the 4-front-tech website.. Click on download in the menu on the left. clik on the opensound logo (the big one on the left), choose Linux 2.6 (x86) (DEB), since this is a guide for ubuntu. If you have a 64 bit version of linux installed, choose the amd64 version instead. Now press submit and you will be provided with two download links. A installer deb and a pdf with instructions. Download them both.

    Reboot, press esc to enter the grub menu and choose the second option, start in recovery mode. Next choose a root prompt, either with or without network access. Use cd to go to the location where you downloaded OSS to and use dpkg -i to install it.
    I created a directory snd in my home directory and my username is tin. So here’s how it looked on my pc.

    cd /home/tin/snd
    dpkg -i oss-linux*

    Reboot and OSS is up and running.



    First to see if everything is working, open a terminal and type:
    lsmod | grep oss
    in my case, it shows:

    oss_usb 117132 3
    oss_hdaudio 143076 7
    osscore 561844 4 oss_usb,oss_hdaudio

    This means I have hd audio sound card and one or more usb-ports, where I could attach a usb sound device to. If you only see the usb_audio device and not your internal card, just reboot and uninstall. If you’ve experienced the superior sound quality on a different machine and you’re disappointed that your hardware is not supported. Please go to the oss forum for help.

    Both the arch and the opensound wiki show how to create the following configuration in /etc/asound.conf or ~/.asoundrc

    pcm.!default {
    type oss
    device /dev/dsp
    ctl.!default {
    type oss
    device /dev/mixer

    I would strongly advice against doing so. Most applications support both the oss and the alsa api. Since the kernel developers switched from alsa to oss, when oss became closed source in the past, alsa became the standard for most applications. This would mean your applications will use the alsa api to output to oss, instead of using oss directly. I also had the problem, that I was no longer able to play anything on 44.1 kHz, since my sound card is set to use 48kHz.

    gstreamer (and system sounds)

    Gstreamer is the backend used by totem 1 (aka movieplayer), banshee and songbird. It is also used in the gnome-desktop to play system sounds.
    Normally this is set correctly by the installer. Unless you’ve done changed the setting manually you would not need to change this.
    To set the sound output correctly, open gstreamer-properties from a terminal.
    Choose custom for both input and output, then osssink as output and osssource for input. (notice the 3 esses in both cases)


    If you have no sound in flash, check that there’s only one file called on your system and it links to the proper file.

    ls /usr/lib/ -al
    lrwxrwxrwx 1 root root 38 2009-07-22 00:05 /usr/lib/ -> /usr/lib/oss/lib/
    sudo updatedb

    If you have more than one occurrence of remove them. If the files is not there or not linked correctly, this is how you can create a new symbolic link:
    sudo ln -s /usr/lib/oss/lib/ /usr/lib/

    jack audio connection kit

    The only not working after installing oss, was jack.
    When I did a sudo jackd -h, it did not show oss as a sound-option, though it showed in /usr/lib/jack/
    sudo ldconfig
    solved that.

    pulse audio

    Though pulse is rather unnecessary when using oss, this is how to activate it, according to the oss wiki.
    For pulse audio to work, you need to make a few adjustments.
    Open a terminal and enter:
    sudo gedit2 /etc/pulse/
    put a # in front of module-hal-detect
    uncomment the line with module-oss and add mmap=0 to it.
    if the line does not exist, add the following line to the end of the file.
    load-module module-oss device=”/dev/dsp” sink_name=output source_name=input mmap=0
    You should of course make a comment (a line starting with #) to document your changes. 😉


    Reboot and go to a terminal, like described in the installing procedure, and type:
    sudo apt-get purge oss-linux
    Also revert other changes you have made in the settings. If you haven’t changed anything, your system should be back in the state it was before.

    Some notes


    The opensound wiki
    the arch wiki
    sound in linux not so sorry after all
    Please note that both wiki’s provide more information about settings for different applications. I only provided the ones I considered standard.


    1. There is of course also a totem version with xine as a backend.
    2. If you don’t use gnome, replace gedit by kate for kde, mousepad for xfce, leafpad for lxde or nano if you prefer to edit within the terminal.

    version history

    1.0 created 25/7/2009


    If you find anything incorrect in this tutorial, please notify me. You can do so by commenting in the thread. If this was helpful to you and you like OSS, it would be nice to let me know, by placing a comment. 🙂 This is not a support forum. If you would like some help and you use ubuntu, create a thread in the ubuntu forums, and post a link here. Any additional information, like special settings for specific hardware would also be appreciated. If you’re missing something, you are also very welcome to write a request.

    It may take some time, before I approve your comment. If you want to start a discussion wetter oss is better/worse than alsa, do it elsewhere and just post a link here. If I think your comment is inappropriate I’ll delete it after reading. This doesn’t mean you are not to allowed to post negative experiences if you’ve had them. Just don’t use inappropriate language. If it’s your hobby to insult people, just go yell at your friends and tell them what kind of morons they are, for an even better experience I’d advice total strangers in a public place, preferable ones a bit bigger than you and looking not too bright. Here however is not the place to do so.

    speed up ubuntu

    January 22, 2009

    I’ve found a few post about speeding up linux, which looked promising:

    e – extract any archive (commandline)

    December 18, 2008

    If you like the cli, this little ruby-script is ideal: e

    Just type:

    e archive [ archive archive …]

    and it will extract the arhive(s)