Archive

Archive for October, 2013

Take screenshot of a selected area

October 30, 2013 Leave a comment

Problem
You want to take a screenshot of a selected area of the screen.

Solution
Launch gnome-screenshot and choose “Select area to grab”.

Classic way
I used to take a screenshot of the whole screen (under Ubuntu just press the PrtScn button), then crop it with Gimp. You can also copy the screenshot to the clipboard and paste it to Gimp.

Links
Read more here.

Categories: ubuntu Tags: ,

DigitalOcean rocks

October 29, 2013 Leave a comment

Do you know DigitalOcean? If not, then go check out their home page.

You can buy a virtual private server (VPS) at them for 5 USD only. It has 512 MB RAM, 20 GB SSD, and 1 TB transfer limit. For this price you get a (virtual) server with root access. Then you do with it whatever you want. Do you want to host your PHP home page? Do you want to try how to host a Python or Rails web app.? Just create a VPS and play with it. It’s also a good way to learn more about system administration.

They have professional support, they reply within minutes. They have excellent tutorials. They have promos! Follow them on Twitter to keep up-to-date.

There is a site called DigitalOcean Promo Code that collects promotional codes :)

Categories: ubuntu Tags: ,

HTML Best Practices for Beginners

October 28, 2013 Leave a comment

If you need to create HTML pages from time to time, here are some great tips:

30 HTML Best Practices for Beginners

Categories: html Tags:

Lua

October 26, 2013 Leave a comment

I’ve never used Lua but I heard a lot about it. Here is a post that lists its good and bad parts:

Lua: Good, bad, and ugly parts

Categories: programming Tags:

Upgrade to Ubuntu 13.10

October 24, 2013 Leave a comment

Since last week I have upgraded 3 machines on Ubuntu 13.10. Everything went flawlessly. After restart I had the feeling that I still have the 13.04 :) So far this upgrade has been the easiest.

Well, on one machine the date and time indicator disappeared from the top panel, but a

killall unity-panel-service

solved the issue. (Tip from here.)

Update (20140228)
It is added to my jabbatron installer script under the main menu entry “(140) Ubuntu“.

Categories: ubuntu Tags: ,

Awesome images

October 23, 2013 Leave a comment
Categories: Uncategorized Tags:

FTL: Faster than Light

October 14, 2013 Leave a comment

The last weekend I was at the RuPy 2013 conference in Budapest, Hungary. It was awesome! I met lots of cool people who share the same interests as me. I had a great time.

During the conference some guys played a game that turned out to be FTL: Faster than Light. I also tried it and it’s really addictive :) It’s multi-platform; it runs flawlessly on my Linux box.

FTL

Some links:

Thanks Füli for showing me how to play this game :)

Update (20131111)
A free update is on its way! Teaser video here.

Categories: games, ubuntu Tags:

run a script as another user without password

October 8, 2013 Leave a comment

You can run a program/script/command as another user the following way (example):

sudo -u www-data /bin/date

That is: /bin/date is executed in the name of www-data and you get the output. However, it asks for your password.

Question: how to execute the command above without a password check?

Solution

Create the file /etc/sudoers.d/date_test :

jabba ALL=(www-data) NOPASSWD: /bin/date

Meaning: allow the user “jabba” to execute “/bin/date” in the name of “www-data” and ask no password.

You should read /etc/sudoers.d/README, it contains important pieces of information:

  • the file you create cannot contain ‘~‘ or ‘.
  • the file must have 0440 rights
  • the command at the end of the lines must have absolute path

Tip from here.

Categories: bash, security Tags: , ,

setfacl / getfacl

October 8, 2013 Leave a comment

With ACL (Access Control List) you can set exactly who can access your files and directories. With ACL you can set things like “nobody can read this file except user XY”, or “no one can write this directory except the user Z”.

With setfacl you can set the ACL rights. With getfacl you can ask the ACL rights of a file/folder.

Example #1
You have a pmwiki installation that runs on an Apache webserver. PmWiki has a directory called “wiki.d” that must be writable too, otherwise you cannot edit your wiki from a browser. Behind the scenes it’s Apache’s www-data user who wants to write in this directory.

A naive approach is to “chmod 777 pmwiki/wiki.d”. In this case anyone with a shell access to the server can modify the content of this folder.

A better way is to give the necessary grants to Apache’s www-data user:

setfacl -R -m u:www-data:rwx $HOME/public_html/pmwiki/wiki.d

Thanks to Jeszy for the tip.

Example #2
You have a web application that uses an SQLite database. Again, the www-data user would like to write into it. In addition, www-data must be able to write to the directory too that contains the database file.

$ cd /home/jabba/public_html/myapp
# say we have here an sqlite.db file
$ setfacl -m u:www-data:rw sqlite.db
$ setfacl -m u:www-data:rwx .

To grant rights to a group, use “g:groupid:rights” instead of “u:userid:rights“.

Categories: bash, security, ubuntu Tags: , ,

MD5 decrypter

October 2, 2013 Leave a comment

MD5 is a hash, not an encryption. From this hash value you cannot restore the original content. However, you can take a dictionary, hash every word in it with md5, then compare the original md5 value with them. If there is a match, your md5 is cracked.

MD5Decrypter.co.uk allows you to input an MD5 hash and search for its decrypted state in our database, basically, it’s a MD5 cracker / decryption tool… We have a total of just over 43.745 billion unique decrypted MD5 hashes since August 2007.” (source)

So, if you store your passwords in md5 format and someone has access to them, they are not safe at all… If an md5 hash is generated from a weak password, it can be cracked in an instant with the tool above.

OK, but… how should I store the passwords then?
See this post for a great tip: How to store and verify a password?

Categories: security, Uncategorized Tags: , , ,