rulururu

post Getting back the root password

July 25th, 2008

Filed under: Linux — Kai @ 2:12 am

Let’s imagine you forgot your root password. Now you’ll just have to reinstall the entire machine. But it’s surprisingly easy to get on the machine and change the password. This doesn’t work in all cases (like if you made a GRUB password and forgot that too), but here’s how you do it in a normal case.

  • First reboot the system. When it reboots you’ll come to the GRUB screen. Move the arrow key so that you stay on this screen instead of proceeding all the way to a normal boot.
  • Next, select the kernel that will boot with the arrow keys, and type E to edit the kernel line.
  • Use the arrow key again to highlight the line that begins with kernel, and press E to edit the kernel parameters. Simply append the number 1 to the arguments.
  • Then press Enter, B, and the kernel will boot up to single-user mode. Once here you can run the passwd command, changing password for user root…
machine# passwd
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully

Now you can reboot, and the machine will boot up with your new password.

It’s also possible to do something similar with lilo, too. If I’m not wrong typing linux single at the lilo prompt should work.

post PCMan - A FileManager having Tabs

June 18th, 2008

Filed under: Linux, Software — Kai @ 3:40 pm

One of the greatest mysteries to me is why most file managers don’t have tabs - it makes performing tasks so much simpler.
I’ve found a lightweight file manager for Debian called PCMan that gives you most of the functionality from Nautilus, but also has tabs. To install this file manager, you can either use the built-in Add/Remove applications dialog or use the command line.

Install it with apt-get:

apt-get pcmanfm

Once it’s installed, you can find it under System Tools \ PCMan File Manager.

PCMan

The current version is 0.3.5.10, which was released on February 14th 2008.
Its web reference is pcmanfm.sourceforge.net, which indeed looks a bit weird.

post Pipe Viewer

June 16th, 2008

Filed under: Linux, Software — Kai @ 8:12 pm

Today I found a really nice program for long-running console commands: pv, aka “Pipe Viewer“.
If you’ve ever strung together a long command with pipes, run it, questioned why it’s taking so long, maybe open another terminal to run top… pv is the answer to that question.

It’s very similar to tee, except instead of sending a copy of the data to a file, it displays one or more progress meters on the screen so you can see the flow of data through your piped commands.

It can be easily installed via apt or downloaded on the official website as RPM.

The usage is very simple. If you like to compress a file and show the progress visually you can do it this way:

pv big.iso | gzip > big.iso.gz
50.3MB 0:00:05 [11.6MB/s] [=====>                ] 33% ETA 0:00:09

In the manual you can find some more, also very complex examples such as this more complicated example using numeric output to feed into the dialog program for a full-screen progress display:

pv file | nc -w 1 somewhere.com 3000
(tar cf - . \
| pv -n -s ‘du -sb . | awk ’{print }’‘ \
| gzip -9 > out.tgz) 2>&1 \
| dialog --gauge ’Progress’ 7 70

You should mention that the program is aborted if a numeric option, such as -L, has a non-numeric value.

post no such file to load — mkmf

May 3rd, 2008

Filed under: Linux, Ruby — Kai @ 2:05 pm

When writing a ruby script I need an external library for Id3Tags. I tried to install it using gem (RubyGems is a packaging system -> Everything you need to know about).
It really took me some time until I could solved the problem:

Updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:1

There is no package that has the name mkmf or something like that.
Thankfully, Google led me to the answer on RubyForge. For some reason, mkmf.rb is part of the ruby1.8-dev package, and initially I had not installed that since it is described as

Header files for compiling extension modules for the Ruby 1.8

A quick & easy

sudo apt-get install ruby1.8-dev

and everything trotted along happily after that. Don’t ask why I hadn’t already installed that development package.

EDIT: Maybe, it kinda seems like, it was not my fault not install ruby1.8-dev package, it seems to be a but in Ubuntu’s package depencies.

post Several ways to grep lines

April 24th, 2008

Filed under: Linux, Ruby — Kai @ 12:17 am

Especially when accessing logfiles or large configfiles you often look for a particular pattern in it.

Everybody working with Linux shell usually appreciates grep.
I will just give you a short overview before getting around with the really worth knowing things:

All lines that match contain “EE” in general.log or mylog.log

grep -i 'd' general.log mylog.log

To lists the names of all files in the current directory whose contents mention “EE”.

grep -l 'EE' *.log


grep -lv
lists the names of all files containing one or more lines that do not match. To list the names of all files that contain no matching lines, use the -L or --files-without-match option.

You also can use regular expressions if needed.

For exclusively displaying lines starting with the string “root” just type:

grep ^root /etc/passwd

A cool addon to grep is egrep which can be used like sed (which shouldn’t be an issue here) to find & manipulate at a single blow.

This should delete all comments in the apache config.

egrep '^[^#]' /etc/apache2/apache2.conf

At least this is hardly correct, to match the comments it needs a bit more because they are most times followed by some whitespaces.
Effectively remove those lines:

egrep -v '^ *(#|$)' /etc/apache2/apache2.conf

If you’re a fan of ruby you might like this.
In ruby you need only request that your string be tested against the regular expression:

ruby -pe 'next unless $_ =~ /regex/' < test.txt

For instance to get every line of test.txt that contains a time in the given format (HH:MM:SS):

ruby -pe 'next unless $_ =~ /(^|\s)[0-9]{2}:[0-9]{2}(:[0-9]{2})(\s)/' < test.txt

To print only lines of 30 characters or greater:

ruby -pe 'next unless $_.chomp.length >= 30' < test.txt

It’s just the beginning of easy matching with ruby, as you might expect,there are many more undreamed-of possibilities.

post Conclusions on PWN to OWN contest

March 31st, 2008

Filed under: Computers, Linux, Windows — Kai @ 9:43 am

PWN to OWN challenge is over and the winner were awareded with a good deal of money and the laptop they cracked.

At 12:38pm local time, the team of Charlie Miller, Jake Honoroff, and Mark Daniel from Independent Security Evaluators have successfully compromised the Apple MacBook Air, winning the laptop and $10,000 from TippingPoint’s Zero Day Initiative. According to sources at the conference, Miller used an exploit against the Safari browser that ships standard with Mac OS X.

A security researcher on Friday exploited a critical bug in Adobe’s Flash Player to hack a notebook running Windows Vista Ultimate, the second machine to fall in this year’s “PWN To OWN” challenge.

The only unclaimed laptop by the contest’s end was a Sony Vaio running Ubuntu Linux.

What does this tell us? I think it’s not as easy as it looks…

I’m pretty sure that the Vista being cracked and not the Ubuntu had something to do with luck, it also could have been the way round. Cracking MacBook Air due a bug in Safari Browser we can assume that the usage of a browser that has a uncommon update system, like Safari has, is not recommented. When Safari 3.1 is not detected in a user’s machine, the updating software, by default, automatically selects the browser for installation.

The bug in Flash Player, which was accountable fot Vista’s downfall, had also been appearing in the Linux version. It kinda dependented on chance.

An interesting, but also alarming evolution is that operating system are becoming more and more secure which will lead attention of malware coders to individual software being installed on the target’s machine.
It’s alarming because it reduces the advantage Linux or Mac users had have because in further time most viruses, exploits used bugs in Windows. Not just because Windows has sufficiant bugs also because of the wide speaded usage of Microsoft’s OS.

Hopefully in future dangerous exploits won’t be a thread for all operating systems because a product is affected that is being used on every operating system.

ruldrurd
Next Page »
Powered by WordPress, Content and Design by Kai Bellmann
Entries (RSS) and Comments (RSS)