Monthly Archives: April 2008

[TIP] View or Extract RPM Packages Content

Case:
You have an RPM package file, for example file.rpm. You want to view what files it contains, and then extract them just as if it was a .tar.gz archive. By the way, it’s a pity Konqueror doesn’t provide a reasonable context menu when you rightclick on it, but only offers to compress (like any regular [...]

[HOWTO] Grant and Revoke Remote root Access to MySQL

To grant root access from all hosts (except for localhost):

GRANT ALL PRIVILEGES ON *.* TO root@”%” IDENTIFIED BY ‘topsecret’;

To revoke root access from all hosts (except for localhost):

DELETE FROM mysql.user WHERE User = ‘root’ AND Host = ‘%’;
FLUSH PRIVILEGES;

To enable MySQL service to accept connections from all hosts change the following line in file mysql.conf:
bind-address=127.0.0.1
to
bind-address=0.0.0.0
or [...]

[TIP] Mount a Windows share on Linux

To test if your Linux machine sees the shares on the Windows box:
smbclient -L windowsbox -U username
and it prompts you for the password.
Mount the share:
mount -t smbfs -o username=john //winbox/share /mnt
and it prompts you for the password.
Notes:
1) It’s OK to use domain users in both cases (“domainusername”). You need to use quotes to escape the [...]

[TIP] Mount ISO Image File on Linux

Once you’ve downloaded an ISO image file, you can mount it as a loopback device. This will give you access to the files in the ISO without having to burn it to a CDROM first.

mount -o ro,loop image.iso /mnt/iso/

[HOWTO] Import a Directory Tree in CVS

Case:
Let the directory tree you want to put under CVS control resides in /tmp/working, and you want it to appear in the repository as ${CVSROOT}/tools/mysources.
Incantation:

cd /tmp/working
cvs import -m “Imported sources” tools/mysources vendor start

Notes:
*) Unless you supply a log message with the -m flag, CVS starts an editor and prompts for a message;
*) The string vendor [...]

[TIP] delete a line in-place with GNU sed

Case:
Suppose you have a file named testfile with the following content:

one
two
three

Say, you want to delete those lines that start with the string tw (that is two in our example). Here is the GNU sed command to use:
Incantation:

sed -i -e “/^tw.*$/d” testfile

Result:
now testfile has this content:

one
three

Notes:
*) -i stands for “in-place”, i.e. perform the command directly in [...]