Hanne's Techtips Page

audiocds.txt

To rip track 7 from a CD and save it to the file cdda13.raw:

cdparanoia -p -d /dev/cdrom "7" cdda13.raw

To make an audio CD from a number of ripped files:

cdrecord -v speed=2 dev=0,6,0  -audio  track1.cdr track2.cdr...

aumix-commands.txt

Mute: aumix -v M
Op: aumix -v +15
Ned: aumix -v -15

badblocks.txt

mapping bad blocks away:

Boot from RedHat CDROM.

Lilo: linux rescue

Say no to mount Linux Partition, you get a shell.

badblocks -o /tmp/blocks /dev/hda5

e2fsck -l /tmp/blocks /dev/hda5

xfce-shutdown.txt

To make XFCE allow a user to shutdown without giving password
==============================================================

Insert in the sudoers file:

user hostname = NOPASSWD: /opt/xfce4/libexec/xfsm-shutdown-helper

bluetooth-nokia6230.txt

Transfer photos from nokia 6230 to Linux via bluetooth
======================================================
See http://frommars.org/2005/01/transferring-pictures-from-nokia-to.html

# yum install gnome-bluetooth bluez-utils

# /etc/init.d/bluetooth start

Turn on bluetooth on phone.

# hcitool scan
Scanning ...
        00:12:62:C5:C0:30       Nokia 6230


# hcitool cc --role=s 00:12:62:C5:C0:30

$ gnome-panel
Applications -> System Tools -> Bluetooth File sharing

On the phone select and send the photos.

On PC pop up dialog will ask you to accept.

Remember to disable blueooth on the phone and PC afterwards.

bootable-cd.txt

mkisofs  -b images/boot.img -c boot.cat -r -o kickstartibm_v1.iso cdrom/

colors.txt

Color definitions are found in:
/usr/X11R6/lib/X11/rgb.txt

cups-config.txt

To edit cups settings by hand, or just to get the file out for
transfering to another computer:

gunzip /etc/alchemist/namespace/printconf/local.adl

or

 /usr/sbin/redhat-config-printer-tui --Xexport > settings.xml

It is a XML file, you can edit it by hand if you want. I recommend doing
it in Red Hats setup tool because the format of the xml file is hard to
understand.

To import it back in:
/usr/sbin/redhat-config-printer-tui  --Ximport < settings.xml

datacds.txt

Make image
mkisofs -r -o cd_image   mydata/

Make image of a CD you already have:
dd if=/dev/cdrom of=cd_image

Mount the image:
mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom

Write CD:
cdrecord -v speed=16 dev=0,0,0  -data  cd_image

See more:
http://mirrors.sunsite.dk/ldp/HOWTO/CD-Writing-HOWTO

debian-network.txt

Network interfaces in debian are defined in /etc/network/interfaces.

dokuwikisyntax.txt

Dokuwiki syntax
===============

===== Eksempel på tabel =====

^ Heading 1      ^ Heading 2       ^ Heading 3          ^
| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
| Row 2 Col 1    | some colspan (note the double pipe) ||
| Row 3 Col 1    | Row 2 Col 2     | Row 2 Col 3        |

===== Eksempel på link =====
[[noter:hanne|Pæn tekst]]


ext3-journal.txt

Slå journal til:
tune2fs -O has_journal /dev/hda2

Slå journal fra:
tune2fs -O ^has_journal /dev/hda2

find-exec.txt

Find with the exec argument:

find ./fisk -gid 552 -exec chgrp fisk {} \;


fish.txt

Acessing remote dirs via ssh inside a file commander

In Midnight commander:
F9, Shell link:
/#sh:ip.addr:/tmp/

In konqueror:
fish://hm@ssh.itu.dk/~hm

fix-xdvi.txt

Xdvi fails.

mkdir /var/lib/texmf/pk/cx/public/
[root@stud175 root]# mkdir /var/lib/texmf/pk/cx/public/cm
[root@stud175 root]# chmod -R a+w /var/lib/texmf/

ftp-ports.txt

How to set the port inetrval ftp uses:

echo "56000 60999" >/proc/sys/net/ipv4/ip_local_port_range

gnome-tips.txt

Problem: 
GNOME and some GNOME applications, e.g. Galeon and Nautilus, will not
start and give an error message about "GConf Error".

Reason:
GConf is a system for storing the user's application preferences. Only
one gconf server should be running at the time, not to mess up your
preferences. A lock file in the user's home directory normally ensures
this.

On NFS mounted home directories with NFS locking is disabled or not
working properly, the "Gconf server" cannot make the appropriate locks
on some files in your home directories.

Solution:
Enable NFS locking

OR

In your .profile, insert the line

export GCONF_LOCAL_LOCKS=1 

gnumeric-round.txt

Problem: Rounding error in Gnumeric

When I do my time sheet in Gnumeric, sometimes it insists that the sum
of of my hours is for example 6:17:59, where "59" id seconds, eventhough
I have only typed "whole minutes" in the other fields.

Solution:
Set the format of the cells to h:mm:ss instead of [h]:mm:ss.

(http://mail.gnome.org/archives/gnumeric-list/2003-October/msg00098.html)

Bug 125441

googlecache.txt

Prevent google access
=====================

Insert the following into your web page <head> section to avoid google
indexing and caching the page:

<META NAME="GOOGLEBOT" CONTENT="NOSNIPPET">
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

See 
http://www.google.com/webmasters/remove.html

grab-kdm.txt

Making a screen grab of Kdm:
Lave et screen grab af Kdm:

Kdm runs on ip52
Ssh from other machine, or. I suppose, can be done from virtual console
on same machine:

$ ssh root@ip52
[root@ip52 root]# ps ax |grep X
11785 ?        SL     0:03 /etc/X11/X -auth
/var/lib/kdm/authfiles/A:0-HaqiT6

[root@ip52 root]# export XAUTHORITY=/var/lib/kdm/authfiles/A:0-HaqiT6
[root@ip52 root]# export DISPLAY=:0 
[root@ip52 root]# xwd -root > kdm.xwd

grub-or-lilo.txt

How to see if the box runs grub or lilo

dd if=/dev/hda bs=512 count=1 2>&1 | grep GRUB

If this does match, we have grub.

dd if=/dev/hda bs=512 count=1 2>&1 | grep LILO

This matches both grub and lilo. So check for grub first, and use this
to check for lilo against for example nt bootloader or other.

Warning: This did not work on my dell d800 at work, which runs fedora
core 1 with a 2.6 kernel from fedora development, and runs grub. No
match. Weird machine anyway, but still...

xfs-fails.txt

Possible reasons:

1) Wrong permissions on /tmp
chmod 1777 /tmp

2) Truetype font to early on the list in the config file
/etc/X11/fs/config

# paths to search for fonts
catalogue =
/usr/ttf,/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/cyrillic/,/usr/
lib/X11/fonts/100dpi/:unscaled,/usr/lib/X11/fonts/75dpi/:unscaled,/usr/lib/X11/f
onts/Type1/,/usr/lib/X11/fonts/CID,/usr/lib/X11/fonts/Speedo/,/usr/lib/X11/fonts
/100dpi/,/usr/lib/X11/fonts/75dpi/

Move the ttf dir to later in the list.

3) Disk full
Check with "df -h"

4) xfs package broken, reinstall the xfs package.

import-html-to-plucker.txt

plucker-build --db-name="Linux - Friheden til at vælge" --db-file=Friheden --home-url="http://www.sslug.dk/linuxbog/friheden/bog/index.html" --maxdepth=1 --zlib-compression --staybelow="http://www.sslug.dk/linuxbog/friheden/bog/" --stayonhost


plucker-build --stayonhost -M 3 --noimages --db-name="The Hitchhiker's Guide to the Galaxy" -H http://www.geocities.com/SiliconValley/Horizon/3250/thgttg.htm -f thhgttg --zlib-compression

ircii-tips.txt

To run ircii with 2 windows with a new server open in window number 2:
/window new
/window list
/window goto 1
/window server irc.freenode.net
/join #linux.dk


To get my nick back when someone stole it:
/msg nickserv ghost <nick> <nickserv password>
Then nickserv instructs me the rest of the way.

To ignore someone
ignore username all
ignore username none

java-in-opera.txt

How to enable Java in Opera:

File -> Preferences -> Multimedia.

In the path field, type

/usr/java/jdk/jre/lib/i386/

or wherever your java kit is installed.

Click "OK", and exit your Opera browser. The next time you start it,
java will work.

kdetips.txt

Disable auto opening of URLS:
=============================
http://www.vlug.org/pipermail/discuss/2002-November/005764.html

The icon of Klipper is in the panel, looks like a notepad
with a white sheet having a big K in it. At least here, kde 2.
Click on the icon, go to the pref's.

Thanks, I disabled the actions. I'll see if this works!

Editing the kicker panel by hand:
=================================
/usr/share/config/kickerrc

Editing global settings in an easier way
========================================
Note: just making changes logged in as root does not do the job as root
is treated as just another user. What you CAN do though is type export
KDEHOME=$KDEDIR before starting kde as root. Then KDEHOME overides
'kdehome' so instead of making changes in roots private config area it
will edit the config files in the install directory so any users will
have the modified files as their default. Make sure KDEHOME is cleared
before you start as a user though.


lastmodified.txt

How to make a last modified linie on your web pages
===================================================
In php:

<?php

$s = filectime("$SCRIPT_FILENAME");
$chg = date("F j, Y", $s);
echo("Updated on " . $chg . "\n");

eller
// outputs e.g.  somefile.txt was last modified: December 29 2002
// 22:16:23.

$filename = $SCRIPT_FILENAME;
if (file_exists($filename)) {
    echo "$filename was last modified: " . date ("F d Y H:i:s.",
filemtime($filename));
}
?>

In ssi:

http://httpd.apache.org/docs/howto/ssi.html#apachetutorial:introductiontoservers
ideincludes


Insert the lines »AddType text/html .ssi« and »AddHandler server-parsed
.ssi« in Apache's configuration file.

Use »<!--#include virtual="/includes/head.incl" -->« to include the file
"/includes/head.incl" (relative to the documentroot) in a ssi file.

"index.ssi" replaces "index.html".  "/includes/head.incl" is the file
with the menu. <!--#echo var="lastmodifyby" -->« is used to insert the
date of the last change.

(Thanks to sparre)

make-java-work-in-netscape-and-mozilla.txt

mozilla:

/usr/lib/mozilla/plugins/
sudo ln -s /usr/java/jdk1.3.1/jre/plugin/i386/ns600/libjavaplugin_oji.so
libjavaplugin_oji.so

netscape 4:
cd /usr/lib/netscape/plugins/
sudo ln -s /usr/java/jdk1.3.1/jre/plugin/i386/ns4/javaplugin.so
javaplugin.so

AND disable java plugin in netscape preferences!!


megaraid_mbox.txt

mount: error 6 mounting ext3
============================
Problem:

Kernel panic when rebooting with new kernel after upgrading to FC4 on a Dell
Poweredge 1750

Error message:

mount: error 6 mounting ext3

error dup2'ing fd of 0 to 0
error dup2'ing fd of 0 to 1
error dup2'ing fd of 0 to 2
...
switchroot: mount failed:22


Solution:
Boot with older kernel (or cd or whatever).
Replace megaraid with megaraid_mbox in /etc/modprobe.conf and make new initrd.

mount-floppy-image.txt

To mount a floppy image
========================

# mkdir /mnt/boot
# mount -o loop -t msdos boot.img /mnt/boot

mozilla-printer-icon.txt

Problem: The printer icon in mozilla's modern theme is mixed woth the
stop icon of the classic theme:

cd .mozilla/hm/blabla
rm chrome/*

mp3-tagging.txt

Title
=====
id3tag -s"Ruby" 01_Ruby.mp3
id3tag -s"The Angry Mob" 02_The_Angry_Mob.mp3
id3tag -s"Heat Dies Down" 03_Heat_Dies_Down.mp3

Track number
============
id3tag -t1 01_Ruby.mp3
id3tag -t2 02_The_Angry_Mob.mp3
id3tag -t3 03_Heat_Dies_Down.mp3

Genre
=====
id3tag -g17 *.mp3

List of genres: http://www.linuxselfhelp.com/HOWTO/MP3-HOWTO-13.html#ss13.3
Examples:
0 Blues
8 Jazz
9 Metal
13 Pop
17 Rock
32 Classical
52 Electronic

Artist
======
id3tag -a"Kaiser Chiefs" *.mp3

Album
=====
id3tag -A"Your Truly, Angry Mob" *.mp3

mp3tocdr.txt

Make a track for an audio CD from an mp3 file:

mpg123 --cdr - track1.mp3 > track1.cdr

mplayer.txt

Getting mplayer to work:
gmplayer -vo x11

mylocalmachine.txt

#!/bin/sh

echo 'PS1="\[\e[42;1m\][\u@\h:\w]\[\e[0m\] " #(giftig grøn)
export PS1' >> /root/.bashrc

sed 's/root     ALL=(ALL) ALL/root      ALL=(ALL) ALL \
hm      ALL=(ALL) ALL/' /etc/sudoers >> /tmp/sudoers
mv -f /tmp/sudoers /etc/sudoers
chmod 440 /etc/sudoers

netcard-speed.txt

See how fast my network card is running:
/sbin/mii-tool

or

ethtool eth0

netcat-dd.txt

Download image fra server
=========================

Klient:
nc server 8123 | dd of=/dev/hda bs=1M

Server:
dd if=imagefile bs=1M | nc -l 8123


Uploade image til server
========================

Klient:
dd if=/dev/hda bs=1M | nc server 8123

Server:

nc -l 8123 | dd of=imagenavn bs=1M

Upload med gzip
===============
Klient:
dd if=/dev/hda bs=1M | gzip -c | nc server 8123

Server:
nc -l 8123 | dd of=imagenavn.gz bs=1M

Download med gzip
=================
Klient:
nc server 8123 | zcat | dd of=/dev/hda bs=1M

Server:
dd if=imagefile.gz bs=1M | nc -l 8123

openoffice.org-tips.txt

Printers in Openoffice.org
==========================
Following a Server Installation, the system administrator first logs on
as user root and starts the printer administration program spadmin. The
administrator then creates a general printer configuration file called
{installpath}/share/psprint/ psprint.conf for all users. All changes are
immediately available to all users.

Openoffice.org will not start
=============================
Remove the following files:

rm -r .user52.rdb (If you use StarOffice 5.2)

rm -r .user60.rdb (OpenOffice 1.0 and StarOffice 6.0)

rm .sversionrc (all versions of Star/Open office)

If this does not solve the problem remove the openoffice directory in
your home directory. Make sure you didn't save work files in the
directory before you remove it.

Installing openoffice.org system wide
======================================
# tar xvzf OOo_1.0.0_LinuxIntel_install.tar.gz
# cd install
# ./setup /net

posgres-dump-database.txt

Dump before backup ought to have been done with:

postgresql-dump -t /var/lib/pgsql/backup/db.bak -p
/var/lib/pgsql/backup/old -d

(see /usr/share/doc/postgresql-7.1.3/README.rpm-dist)

We did:
# su - postgres
$ pg_dump mydb > /tmp/mydb.db

Restore:
=======
# su - postgres
$ createuser mydbuser
$ createdb mydb -U mydbuser
$ psql mydb < /tmp/mydb.db 

Other commands
================
See databaser: pqsl -l
Connect to database: psql -d mydbuser
(or as user mydbuser: pqsl)

Commands in pqsql
=================

\q to get out
\h for help.

postmortem.txt

Show me directories
find ./ -type d -maxdepth 1

Show me directories and symlinks
ls -l --color | grep ^[d,l]

remove-ctrl+M-in-vi.txt

This is how to remove ^M in vi:

:%s/^M//
where you press ^v before ^M.

rpm-tips.txt


Build RPM from source
=====================
rpmbuild --rebuild irssi-*.src.rpm

Rebuild RPM as ordinary user
============================
echo >~/.rpmmacros "%_topdir ${HOME}/rpm"
mkdir -p ~/rpm
cd ~/rpm
mkdir -p RPMS/{i386,i586,i686,noarch} SRPMS BUILD SOURCE SPECS

# Install source rpm foo-42-42:
rpm -i ~/foo-42-42.src.rpm

# Build foo:
rpm -ba ~/rpm/SPECS/foo.spec

Do not strip executables
========================
Put

%__os_install_post    \
       /usr/lib/rpm/brp-compress \
       /usr/lib/rpm/brp-strip-comment-note \
%{nil}

in your ~/.rpmmacros.


RPM hangs
=========
If rpm hangs on FUTEX_WAIT something - you can check this by running 
strace rpm -qv something -
then this helps:

export LD_ASSUME_KERNEL=2.4.1

sed-commands.txt


Append to line

sed 's/$/.i386.rpm/' package-list > package-list1

ssh-tunnel.txt

Scenario: I want to log into Friends machine to fix a problem for him,
but he is between a firewall or ADSL router and do not have port 22
open. I want to solve this by having him open an ssh connection to me,
and then use ssh tunneling.

Solution:

On Friend's machine:
 ssh -R 2222:localhost:22 mymachine.mydomian -l friend
Friend is asked for a password. That is the password for the "friend"
account on my machine.

On my machine:
ssh -p 2222 localhost -l friend
Now I have to type the password for the "friend" account on his machine.
And I am in.

swap.txt

Making a swap file
==================

As root:

# dd if=/dev/zero of=swapfile bs=1024 count=102400
102400+0 records in
102400+0 records out
# mkswap /swapfile
# swapon /swapfile


transparent-Eterm.txt

Get cool transparent Eterm:
Eterm --trans --tint cyan

typhoon-wireless-card.txt

Getting the typhoon (Atmel) wireless card to wok on Linux

wget http://atmelwlandriver.sourceforge.net/snapshots/atmelwlandriver-ss-20030217.tar.gz

cd /usr/src/linux
cp configs/kernel-2.4.18-i386.config .config

vi Makefile:
EXTRAVERSION = -8custom (fjern custom)

make oldconfig
make dep

cd 
tar xvzf atmelwlandriver-ss-20030217.tar.gz
(or atmelwlandriver-ss-20030830.tar.gz, perhaps a newer one exists now)
cd atmelwlandriver/
echo -e "n\n n\n y\n n\n y\n n\n n\n y\n n\n n\n n\n n" | make config
make clean; make all; make install
modprobe pcmf502rd

pcmf502rd




useragent.txt

Insert the line

user_pref("general.useragent.override", "Any Browser");

in the file "user.js"

under .mozilla/<user>/<crap>/
The file may not exist, in that case create it.

Emulate Internet Explorer (to work with bonaparte.dk):

user_pref("general.useragent.override", "Mozilla/7.0 (compatible; MSIE 6.0; Windows NT 5.1; Linux really)");

vi-tips.txt

Indent i vi
1G=G

virtual-ftp-user.txt

Problem:
I want to restrict access to a certain ftp download area to the people
who knows a specific username and password. I do not want these people
to be able to log in to the system.

Solution:

vi vsftpd.conf

#Allow guest
guest_enable=YES
#But not just any guest
guest_username=myusername

===

[root]# mkdir /etc/ftp

[root]# perl -e 'use DB_File; tie %db, "DB_File",
"/etc/ftp/users.db", O_CREAT|O_RDWR, 0600; $db{"myusername"}="mypassword"'

vi /etc/passwd:

myusername:*:503:503::/home/ftp:/bin/bash
====

vi /etc/pam.d/ftp:
#%PAM-1.0
auth       required     /lib/security/pam_listfile.so item=user
sense=deny file=/etc/ftpusers onerr=succeed
auth       required     /lib/security/pam_userdb.so db=/etc/ftp/users
#auth       required    /lib/security/pam_stack.so service=system-auth
auth       required     /lib/security/pam_shells.so
#account    required    /lib/security/pam_stack.so service=system-auth
#session    required    /lib/security/pam_stack.so service=system-auth
account    required     /lib/security/pam_pwdb.so
session    required     /lib/security/pam_pwdb.so

windowmaker-config.txt

Correspondance between global and local onfig dirs:

/usr/share/WindowMaker/ = ~/GNUStep/Library/
/etc/X11/WindowMaker/ = ~/GNUStep/Defaults

xdmcp.txt

Command line to start X from remote machine:
============================================

sudo X :1 -query <hostname> -ac

Sudo not neccesary on all distributions.

Server setup
============
/etc/gdm/gdm.conf:

[daemon]
RemoteGreeter=/usr/bin/gdmlogin

[xdmcp]
Enable=true


Troubleshooting
===============
Error: X starts but hangs, no gdm.
In the log:  gdm_slave_run: Sleeping 3 on a retry

Solution: Disable firewall on local machine, or figure out which ports
to open.

Back to Hanne's Technotes Page

Back to Hanne's HomePage



Valid HTML 4.01!

Last updated: February 10, 2010