Tag Archives: ubuntu

Examples of APG

Generate random password with apg.

Quick tip.

If you want to generate a random password, you could use /dev/random, but it is more complex than using apg (Automated Password Generator).

So, to install apg on Fedora, run this command:

# yum install apg

Useful parameters:

  • -a algorithm choose algorithm
    • 1 – random password generation according to password modes
    • 0 – pronounceable password generation
  • -n num_of_pass           generate num_of_pass passwords
  • -m min_pass_len         minimum password length
  • -x max_pass_len          maximum password length
  • -l spell generated password
  • -t print pronunciation for generated pronounceable password

Some examples:

Examples of APG
Examples of APG. Click to zoom.

Short and useful tip: How to make “tail -f” beep on each new line.

Just in case you do not know, tail prints the last ten lines of the indicated file. Like this:

tail /var/log/yum.log

Furthermore, if you want to print more lines you can do it with -n parameter:

tail -n 20 /var/log/yum.log

But I think the most interesting parameter for tail  is -f. This parameter allows tail to “follow” the file. New data is displayed as the file grows.

Now, using sed  we can append to each new line, a bell sound:

tail -f /var/log/yum.log | sed -e $'s/$/\a/'

Notice that ‘$’ escape sequences will only work on bash.

This was tested on Fedora 16.

Configuring BIND9 Master / Slave on Ubuntu.

I know it is strange to set up this type of configuration on an Ubuntu Desktop, but we had to do it for Internet Services class, and it gave problems to me and most of my class.

I am going to use two virtual machines, both running Ubuntu Desktop. First step is installing bind9.

# apt -get install bind9

The test domain will be “etg.local”

  • Master dns:
    • IP:  192.168.7.1
    • name: dns1
  • Slave dns:
    • IP: 192.168.7.2
    • name: pc02 (with dns2 CNAME)

Be careful with using underscore on names.

MASTER

We are going to start by editing /etc/bind/named.conf.local, to define our zone. I am going to define just one zone. You may want to define also a reverse zone.

named.conf.local

named.conf.local

Notice that the “type” of this host is master, that is important. We also can see that I used absolute path to the file, because I did not specified any directory on the options.

Allow-transfer, allow-update and also-notify are allowing our slave dns to transfer the zone(s) file(s).

This is my zone file:

Zone file

Zone file

 

We must pay attention to thenames to be fully qualified if they include domain name, and both servers must be declared with NS register.

Finally we configure our DNS, this is my configuration file /etc/resolv.conf

/etc/resolv.con

/etc/resolv.conf

SLAVE

Here comes the tricky part, at least with Ubuntu Desktop.

First, we configure /etc/resolv.conf to be equally as in master. Search parameter must be “etg.local” and nameserver “127.0.0.1″

Now, we declare our zone, pay attention:

Zone declaration on slave

Zone declaration on slave

As you may see, we declared the type of this server as slave, and we set who is its master(s).

Now it should replicate our zone from master server, but it won’t until we do a couple more of steps to avoid errors of writing permission.

We have to edit the file /etc/apparmor.d/usr.sbin.named

Default usr.sbin.named

Default usr.sbin.named

We have to find the line highlighted in red.

r stands for read, read permission. So we can deduce that it does not have permission to write the zone, that is the because it gives us permission errors.

We change that line to this:

Modified usr.sbin.named

Modified usr.sbin.named

And the last step is giving all permissions to the the bind group in the bind folder:

# chmod -R 775 /etc/bind

Now we restart first the bind server of the master and then the slave with:

# /etc/init.d/bind9 restart

Then if we want to check the log file to see if everything went fine (slave):

# tail -f /var/log/syslog
Syslog

Syslog

I highlighted some important messages. It tells us that the zone transfer went fine. Now we finally take a look to our recently replicated zone file.

Note: In the next screenshot you will se that the serial is 2. You can transfer with serial, I just added another register (see www) to show you that it really works

Replicated zone

Replicated zone

 

And that’s all, it should work now.

How to install MySQL 5.1 on Ubuntu

 

# apt-get install mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server-5.1 mysql-server-core-5.1 mysql-admin mysql-gui-tools-common mysql-query-browser

With this packages we install mysql client, mysql server and some administration tools.

Packages to install

Packages to install

Later, we will be asked to set up a root password:

Asking for root password

Asking for root password

Be sure to remember that password.

Once it is installed we can run MySQL Administrator to manage our recently installed server.

MySQL Administrator Connection

MySQL Administrator Connection

It’s highly recommended to create other user to work

Creating a new user

Creating a new user

With MySQL Administrator you also can manage backups or check server’s health for example.

And finally, with MySQL Query Browser you can que to your server; create new databases, insert values, sql queries, etc.

Creating a new database with Query Browser

Creating a new database with Query Browser

 

Enable “delete key” on GNOME3 (Fedora 15 and Ubuntu 11.04)

By default, we can’t delete files in Nautilus 3 with delete key, as we did always, because it’s deactivated.

For  enable this on Fedora 15, go to terminal and write this down:

$ gsettings set org.gnome.desktop.interface can-change-accels true

Then go to a nautilus window, click on Edit menu and put the mouse over (don’t press, only hover) ”Delete” and press delete key. You will see the new shortcut at the right.

Once you’ve done it, I recommend to turn it off again:

$ gsettings set org.gnome.desktop.interface can-change-accels false

If you use ubuntu you can use dconf-editor. Press ALT+F2 and write dconf-editor and then follow this path: org > gnome > desktop > interface and check can-change-accels.

Then, do the same as in Fedora, but you may have to hit the key twice.

Don’t forget to uncheck the box for preventing changing other shortcuts.