Running with Ruby

Tag: ubuntu (page 1 of 12)

Ruby – Installation and compilation from sources on Debian

If you don’t want to use Ruby from your repositories and you don’t want (or can’t because of some reason) to use RVM, here’s a quick howto download and compile Ruby from sources (all the commands should be executed with sudo or as a super user):

First a small update and some neccessery libs:

sudo su
apt-get update

# Not sure if all of them are required but nothing bad will happen if you just install them

apt-get install build-essential bison openssl libreadline6 libreadline6-dev \
libyaml-dev libxml2-dev libxslt-dev zlib1g zlib1g-dev libssl-dev autoconf \
libc6-dev ncurses-dev libaprutil1-dev libffi-dev libcurl4-openssl-dev libapr1-dev

Then we should go here and download the most recent stable version:

# Still as root
cd ~
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz

Of course we need to unpack it:

tar -xvf ruby-2.1.2.tar.gz
# go to where it was unpacked
cd ruby-2.1.2/

and now the whole installation process:

./configure  
make  
make test  
make install 

and a small cleanup:

cd ~
rm -rf ruby-2.1.2*

To test it, just:

ruby -v
# output: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

Ubuntu 14.04 Gnome keyring (Seahorse) auto unlock when auto login

Seahorse doesn’t unlock your keyring when you have auto login enabled. The funny thing is that even if you set up an empty password, you will still have to unlock it manually. Maybe it’s a bug, maybe it’s a security feature. Either way, if you have an encrypted LVM like I do, and you shutdown your computer when you don’t need it having to unlock keyring each time can be a real pain in the ass. First you need to unlock whole system, then you skip login (because of the auto login), but you still need to unlock keyring.

Luckily there’s a really simple solution to this:

Change your keyring password

First, you need to change your keyring password. Use unique pass-phrase that you don’t use anywhere else because it’s going to be stored in plain text. To do this, press ALT+F2, type seahorse and press enter. You will see following window:

keyring1

Go to View and select By keyring. You should see something like this:

keyring2Right click on Login Keyring (the first one) and Change password. Then just provide an old one (should be the same as you account password) and a new one.

Create a simple Python script

Now you have a new keyring password. To unlock it automatically, we will use a simple Python script, that will be executed each time you are auto logged in:

#!/usr/bin/python

import gnomekeyring
gnomekeyring.unlock_sync(None, 'your keyring password');

save it as a hidden file somewhere in your home directory (I used ~/.keyring).

Now add executing rights:

chmod +x ./.keyring

You can also execute it to check if it’s working:

[~]$ ./.keyring 

If it doesn’t you will see an error explanation:

[~]$ ./.keyring
Gkr-Message: secret service operation failed: The password was invalid
Traceback (most recent call last):
  File "./.keyring", line 3, in <module>
    gnomekeyring.unlock_sync(None, 'PyGaCQbiacPUPgFcJrwjIsEcz');
gnomekeyring.IOError

Add your keyring script to autostart (auto startup)

Just ffollow this article and in a command field put: /home/mencio/.keyring

That’s all. After that, you should have automatically unlocked keyring after your auto login.

Olderposts

Copyright © 2017 Running with Ruby

Theme by Anders NorenUp ↑