sh, bash, dash and Ubuntu

Hi!
I wanted to install a quite old package in my ubuntu computer using the .sh file I downloaded from their website. So, I tried typing in terminal:

sudo ./package_name.sh

and I got:

/bin/sh: 0: Can’t open ./package_name.sh

Briliant! Since you are here, you are probably looking for a fix.

The problem stems from the fact that Ubuntu uses dash as the default shell and your script is written with another shell in mind. The most usual is bash (sh).

So type in a terminal window:

sudo bash ./package_name.sh

This will force ubuntu to run the script using bash.

Enjoy!
Vasilis

PSAD Quick Fix

I like psad. I use it often and I find the email reports really handy.

Here is an issue I faced in Ubuntu and the solution:

Instead of the reports I received an email with the following contents:

[-] You may just need to add a default logging rule to the /sbin/iptables
‘filter’ ‘INPUT’ chain on oxide-server.  For more information,
see the file “FW_HELP” in the psad sources directory or visit:

http://www.cipherdyne.org/psad/docs/fwconfig.html

[-] You may just need to add a default logging rule to the /sbin/ip6tables
‘filter’ ‘INPUT’ chain on oxide-server.  For more information,
see the file “FW_HELP” in the psad sources directory or visit:

http://www.cipherdyne.org/psad/docs/fwconfig.html

 

I found on the web several people with the same problem, so here is what worked for me:

  1. Enable ufw logging. Type in console as root: ufw logging on
  2. Type as root:
    iptables -A INPUT -j LOG
    iptables -A FORWARD -j LOG
    ip6tables -A INPUT -j LOG
    ip6tables -A FORWARD -j LOG
  3. Open /etc/ufw/before.rules and type before the COMMIT directive:
    -A INPUT -j LOG
    -A FORWARD -j LOG
  4. Open /etc/ufw/before6.rules and type before the COMMIT directive:
    -A INPUT -j LOG
    -A FORWARD -j LOG
  5. Restart ufw by typing as root:
    ufw disable
    ufw enable
  6. Test if it worked:
    psad –fw-analyze

I know that some parts appear to do very similar things but for a strange reason it worked only after the exact above procedure.

Hope it helps!
Vasilis

 

 

SWikipedia: S (named ess spelled ‘es’- in compound words; plural esses, forms/script: ) is the nineteenth (19th) letter in the ISO basic Latin alphabet.

PDF cracking? Don’t bother!

Sometimes people pay too much attention to details that tend to lose the complete picture. This is what happened to me when I was loooking for a way to copy a part of an article (for some notes I kept) from a “protected” pdf file. I tried to find a way to “crack” the protection instead of thinking how pdf readers operate.

First of all, an advice:
Don’t use the following trick to steal other people’s work! This is called plagiarism and may lead you in really embarassing situations.

It is possible that you came here looking for a pdf cracker or a way to trick adobe pdf reader (or similar software) but I will show you a different approach.

Ok, let’s explain how this thing works. Since you can read the text from the pdf file, the information is not really encrypted, in contrast there is just a “special instruction set” that tells the reader if an operation (selection, copy, print etc) is allowed.  What if the PDF reader ignores this “instruction set”?  Then all operations are allowed and you are free to perform all operations as with any non-protected document!

So, all you have to do is to find a pdf reader that ignores adobe’s “special instructions”.
In ubuntu, I use the preinstalled Evince and it works fine.

I am not aware of an equivalent reader in windows, but I’ll do some research…

Hope it helps,
Vasilis

Firefox 4.0 ubuntu installation [part 2]

In a previous post, I shared some terminal commands in order to install firefox 4 in ubuntu.

The problem is that when the stable version was out and I tried to update my current installation the version remained “pre xxx” and the title bar said “Minefield”.
So, I figured out how to get rid of it and install the latest and stable version…

STEP #1
Download the latest stable version from the official downlad page:
www.mozilla.com/firefox/
in tar.bz2 format.

STEP #2
Open a terminal window and go to the downloaded file directory.
for example: cd ~/downloads/
Then extract the archive: tar xjf firefox-4.0.tar.bz2

STEP #3
Remove the previous firefox installation:
sudo rm -r /opt/firefox
(don’t worry if this step fails)

STEP #4
Move the extracted firefox folder:
sudo mv firefox /opt/firefox

STEP #5
“Backup” the old Firefox launcher:
sudo mv /usr/bin/firefox /usr/bin/firefox-old

Create a symbolic link pointing to the new firefox installation:
sudo ln -s /opt/firefox/firefox /usr/bin/firefox

The icons/shortcuts usually don’t need update, but if they do point them to “firefox”.

STEP #6
Open firefox and go to the “About” selection under the “Help” menu, to check the running version.