Archive for 'Linux'

1. Install the required package:

sudo apt-get install cryptsetup

2. Create a partition on the USB-stick:

sudo cfdisk /dev/sdX

3. Encrypt the partition:

sudo luksformat -t ext2 /dev/sdX
Creating encrypted device on /dev/sdX...
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:

Entering the USB-stick into Ubuntu will bring up the following window:
unlockencryptedusbstick

To edit the label of the USB-stick (by default it’s just ‘disk’) use e2label for ext filesystems and mtools for fat filesystems. Details: https://help.ubuntu.com/community/RenameUSBDrive

Tagged with , , , .

Dropbox is a fabulous tool for file synchronization between Mac, Linux and Windows. I use it to keep my files in sync on my Laptop and Workstation at home. It has even a webinterface where I can access my files online from everywhere. And the greatest part of Dropbox is that I don’t see it – it’s completely working in the background without user interaction. That makes it one of the best software I know.

dropbox

But of course Dropbox has a disadvantage: A server is required for synchronization. Whereas the Dropbox client is available for public to download, the server component is not. That means we have to use the Dropbox servers provided by the Dropbox team which are located on Amazon’s cloud. I would not advise anybody to store sensible or private data somewhere on the Internet where others have full control over the data. So what to do? There is no other synchronization software around today that provides the functionality Dropbox does*, but what about privacy of my data? Easy: encryption.

This is how to setup an encrypted directory inside the Dropbox synchronization folder on Ubuntu:

1
2
3
4
sudo apt-get install encfs
mkdir /home/$USER/DropboxEncrypted
mkdir /home/$USER/Dropbox/Encrypted
encfs /home/$USER/Dropbox/Encrypted /home/$USER/DropboxEncrypted

DropboxEncrypted will contain the unencrypted files (if mounted with encfs) and Encrypted inside the Dropbox directory will contain the encrypted files.

There are some disadvantages I know of:

  • Access to the encrypted files with the Dropbox webinterface won’t work (because they are encrypted)
  • Every client which need access to the encrypted files needs encfs installed (available on Mac and Linux)
  • Maybe more

To get rid of the desktop icon on Gnome one can use this command:

1
gconftool-2 -t bool -s /apps/nautilus/desktop/volumes_visible false

And to mount the encrypted directory with a nice graphical interface use this shell script (as Gnome panel command for example):

1
2
3
#!/bin/sh
/usr/bin/encfs --extpass='zenity --entry --hide-text --title="Password" --text="Please enter your password to mount DropboxEncrypted."' ~/Dropbox/Encrypted/ ~/DropboxEncrypted/
/usr/bin/nautilus ~/DropboxEncrypted &

mountdropboxencrypted

Conclusion: Dropbox is really great software, it works extremely well. But it is not acceptable (at least for me) to store sensible or private data on a remote server. Encryption is a workaround, but I hope that there will be other tools providing similar services than Dropbox in the future. iFolder and Wizbit could get an alternative, but they are not ready yet.

* If you know of one good alternative, please notify me immediately :)

Update: Nice blog entry on how to automount encrypted filesystems: http://obensonne.bitbucket.org/blog/20100130-encfs-keyring.html

Tagged with , , , , , .

Redmine is a very interesting free project management web application based on Ruby on Rails. Unfortunately it’s not that easy to install the components necessary to get Redmine up and running on a Debian server. Therefore I describe what I’ve done here.

First we will install the Ruby packages from Debian:

1
apt-get install ruby rake rubygems libmysql-ruby librmagick-ruby

It’s possible to have an own user account for Redmine. This user needs to have the GEM_PATH set. In addition to that we prepare some directories and install rails with Gem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
adduser --home /opt/redmine --disabled-login redmine
su - redmine
redmine:~$ echo export "GEM_PATH=$HOME/gems" > ~/.bashrc
redmine:~$ mkdir gems
redmine:~$ gem install -i $GEM_PATH rails -y
redmine:~$ gem install -i $GEM_PATH rails -y
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.2.2
Successfully installed rake-0.8.3
Successfully installed activesupport-2.2.2
Successfully installed activerecord-2.2.2
Successfully installed actionpack-2.2.2
Successfully installed actionmailer-2.2.2
Successfully installed activeresource-2.2.2
Installing ri documentation for rake-0.8.3...
Installing ri documentation for activesupport-2.2.2...
Installing ri documentation for activerecord-2.2.2...
Installing ri documentation for actionpack-2.2.2...
Installing ri documentation for actionmailer-2.2.2...
Installing ri documentation for activeresource-2.2.2...
Installing RDoc documentation for rake-0.8.3...
Installing RDoc documentation for activesupport-2.2.2...
Installing RDoc documentation for activerecord-2.2.2...
Installing RDoc documentation for actionpack-2.2.2...
Installing RDoc documentation for actionmailer-2.2.2...
Installing RDoc documentation for activeresource-2.2.2...
 
gem update --system
rake db:migrate RAILS_ENV="production"
rake redmine:load_default_data RAILS_ENV="production"

Now let’s get Redmine:

1
2
3
4
5
wget http://rubyforge.org/frs/download.php/49319/redmine-0.8.0.tar.gz
tar xvfz redmine-0.8.0.tar.gz 
mv redmine-0.8.0 redmine 
chown -R redmine:nogroup files log tmp
chmod -R 755 files log tmp

Of course Redmine needs a database:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mysql -u root -p
mysql> create database redmine;
mysql> grant all privileges on redmine.* to someone@localhost \
   identified by 'password'
mysql> exit
 
/opt/redmine/redmine# cp config/database.yml.example config/database.yml     
 
$editor config/database.yml
production:
   adapter: mysql
   database: tracks
   host: localhost
   username: someone
   password: password
   socket: /var/run/mysqld/mysqld.sock

That’s all for the basic Redmine installation, let’s test it!

1
/opt/redmine/redmine#  ruby script/server -e production

We should now be able to open Redmine on our server using http and port 3000 (eg http://myserver:3000).
The default Administrator login is admin/admin (change it immediately!).

Most people don’t want to start Redmine using the ruby command so we integrate Ruby and Redmine into Apache using another great product: Passenger:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
gem install passenger
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Successfully installed fastthread-1.0.1
Successfully installed rack-0.9.1
Successfully installed passenger-2.0.6
3 gems installed
Installing ri documentation for fastthread-1.0.1...
Installing ri documentation for rack-0.9.1...
Installing ri documentation for passenger-2.0.6...
Installing RDoc documentation for fastthread-1.0.1...
Installing RDoc documentation for rack-0.9.1...
Installing RDoc documentation for passenger-2.0.6...
 
passenger-install-apache2-module 
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.6.
 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.
 ...
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

The Passenger installation suggests some configuration and that’s excactly what we do:

1
2
3
4
5
6
7
8
9
10
/etc/apache2/mods-available# cat passenger.load 
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
/etc/apache2/mods-available# cat passenger.conf 
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /usr/bin/ruby1.8
 
a2enmod passenger
Module passenger installed; run /etc/init.d/apache2 force-reload to enable.
/etc/init.d/apache2 force-reload
Forcing reload of web server (apache2)... waiting .

That should be it – now we can access Redmine on Ruby through Apache. You might want to use some VirtualHost configuration for it or something else – that’s Apache configuration.

Feel free to comment :)

Tagged with , , , , , , , , .

Eclipse looks clumsy and a lot of space is wasted with the default themes in Gnome on Ubuntu:
eclipse-Clumsy

This can be improved with some gtk-theme magic:

gtk-icon-sizes="panel-menu=16,16 : gtk-menu=16,16 : gtk-button=16,16 :
gtk-small-toolbar=16,16 : gtk-large-toolbar=16,16 : gtk-dialog=32,32 : gtk-dnd=32,32"
 
style "compact" {
font_name="Sans 8"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
xthickness=0
ythickness=0
}
class "GtkWidget" style "compact"
 
style "compact2" {
xthickness=1
ythickness=1
}
 
class "GtkButton" style "compact2"
class "GtkToolbar" style "compact2"
class "GtkPaned" style "compact2"

I saved those lines into my eclipse directory as gtkrc-compact. Then I created another file, which is executeable and used to start eclipse:

#!/bin/sh
#GTKRCFILE=Clearlooks
GTK2_RC_FILES=gtkrc-compact ./eclipse

Now it looks much nicer:
eclipse-Thin

Tagged with , , .