Gentoo Blog

The ultimate Gentoo Blog
  • rss
  • Home
  • About

Ubuntu 10.04 Lucid Window Buttons On The Left

Simon | March 9, 2010

To get the close and minimize buttons back on the right hand side do the following:

1. Press Alt + F2 and enter:

gconf-editor

2. navigate to /apps/metacity/general/button_layout

3. set the key value to:

:maximize,minimize,close

Thats it log out or restart metacity and your buttons should appear back on the right hand side.

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

chmod change files or directories recursively to the same value

Simon | February 11, 2010

Recursively change all files in your current working directory including files in subdirectories to 644:

find . -type f -print0 | xargs -0 chmod 644

Recursively change all directories in your current working directory including subdirectories to 755:

find . -type d -print0 | xargs -0 chmod 755

Kommentare
Keine Kommentare »
Kategorien
Gentoo, Stuff, Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

Debian Lenny Possible missing firmware /lib/firmware/bnx2-09-4.0.5.fw for module bnx2

Simon | February 1, 2010

If you see this message after running aptitude upgrade with a Kernel update:

W: Possible missing firmware /lib/firmware/bnx2-09-4.0.5.fw for module bnx2

Do not reboot your server or you will be left without any network. Please edit your apt sources.list file and add the non-free repo. For example it could look like this:

deb http://ftp.hosteurope.de/pub/linux/debian/ lenny main non-free
deb-src http://ftp.hosteurope.de/pub/linux/debian/ lenny main non-free

deb http://security.debian.org/ lenny/updates main non-free
deb-src http://security.debian.org/ lenny/updates main non-free

Please edit the line for your standard apt server and for security.debian.org to receive possible security updates. Then run

aptitude update

Now we can install the missing firmware for our broadcom network card:

aptitude install firmware-bnx2

Check if the firmware has been installed correctly:

web99:~# ls -lha /lib/firmware/
total 212K
drwxr-xr-x 2 root root 112 2010-02-01 12:25 .
drwxr-xr-x 11 root root 4.2K 2010-01-20 15:36 ..
-rw-r--r-- 1 root root 104K 2009-08-04 07:00 bnx2-06-4.0.5.fw
-rw-r--r-- 1 root root 101K 2009-08-04 07:00 bnx2-09-4.0.5.fw

We need this version bnx2-09-4.0.5.fw which you can see in the reported error message above.

Thats it you can carry on and reboot your server.

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

Ubuntu Karmic mount Windows partition as user

Simon | January 9, 2010

With Ubuntu versions prior to Karmic you could mount windows partitions as a normal user. After typing in the root password you could allow the user to mount a windows partition after ticking the box remember this the user could do this himself in the future. Easy going that’s how it should be with Ubuntu for some reason that does not work any more. And this is the solution:

1. Create a file named:

vi /var/lib/polkit-1/localauthority/50-local.d/nautilus.pkla

2. Copy the following content into the file:

[Allow users to mount with nautilus]
Identity=unix-group:simon
Action=org.freedesktop.devicekit.disks.filesystem-mount-system-internal
ResultAny=no
ResultInactive=no
ResultActive=yes

That’s it easy once you know how it’s done.

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

Ubuntu Karmic change CPU Frequency as user

Simon |

With Ubuntu versions prior to Karmic you could change the CPU Frequency as a normal user. After typing in the root password you could allow the user to change the CPU Frequency after ticking the box remember this the user could do this himself in the future. Easy going that’s how it should be with Ubuntu for some reason that does not work any more. And this is the solution:

1. Create a file named:

vi /var/lib/polkit-1/localauthority/50-local.d/gnome-cpufreq.pkla

2. Copy the following content into the file:

[Allow users to set the CPU frequency]
Identity=unix-group:simon
Action=org.gnome.cpufreqselector
ResultAny=no
ResultInactive=no
ResultActive=yes

That’s it easy once you know how it’s done.

Kommentare
1 Kommentar »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

HP ProLiant Support Pack CD for Debian lenny and Ubuntu 9.04 Jaunty

Simon | November 26, 2009

Nice collection of support tools monitoring apps for snmp and a CLI for the HP raid controller. Definitely worth looking at if you are running debian or ubuntu boxes on HP proliant servers:

HP ProLiant Support Pack CD

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

Useful Mysql Commands

Simon | November 6, 2009

when you seeĀ  a # it means use the command from the unix shell. When you see mysql> it means from a MySQL prompt after logging into MySQL.

To login (from unix shell) use -h only if needed.

# [mysql dir]/bin/mysql -h hostname -u root -p

Create a database on the sql server.

mysql> create database [databasename];

List all databases on the sql server.

mysql> show databases;

Switch to a database.

mysql> use [db name];

To see all the tables in the db.

mysql> show tables;

To see database’s field formats.

mysql> describe [table name];

To delete a db.

mysql> drop database [database name];

To delete a table.

mysql> drop table [table name];

Show all data in a table.

mysql> SELECT * FROM [table name];

Returns the columns and column information pertaining to the designated table.

mysql> show columns from [table name];

Show certain selected rows with the value “whatever”.

mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";

Show all records containing the name “Bob” AND the phone number ‘3444444′.

mysql> SELECT * FROM [table name] WHERE name = "Bob" AND phone_number = '3444444';

Show all records not containing the name “Bob” AND the phone number ‘3444444′ order by the phone_number field.

mysql> SELECT * FROM [table name] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number;

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444′.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444';

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444′ limit to records 1 through 5.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444' limit 1,5;

Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

mysql> SELECT * FROM [table name] WHERE rec RLIKE "^a";

Show unique records.

mysql> SELECT DISTINCT [column name] FROM [table name];

Show selected records sorted in an ascending (asc) or descending (desc).

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

Return number of rows.

mysql> SELECT COUNT(*) FROM [table name];

Sum column.

mysql> SELECT SUM(*) FROM [table name];

Join tables on common columns.

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password'));
mysql> flush privileges;

Change a users password from unix shell.

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password 'new-password'

Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

# mysql -u root -p
mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere');
mysql> flush privileges;

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe --skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

Set a root password if there is on root password.

# mysqladmin -u root password newpassword

Update a root password.

# mysqladmin -u root -p oldpassword newpassword

Allow the user “bob” to connect to the server from localhost using the password “passwd”. Login as root. Switch to the MySQL db. Give privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> grant usage on *.* to bob@localhost identified by 'passwd';
mysql> flush privileges;

Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO user (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('%','databasename','username','Y','Y','Y','Y','Y','N');
mysql> flush privileges;

or

mysql> grant all privileges on databasename.* to username@localhost;
mysql> flush privileges;

To update info already in a table.

mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = 'user';

Delete a row(s) from a table.

mysql> DELETE from [table name] where [field name] = 'whatever';

Update database permissions/privilages.

mysql> flush privileges;

Delete a column.

mysql> alter table [table name] drop column [column name];

Add a new column to db.

mysql> alter table [table name] add column [new column name] varchar (20);

Change column name.

mysql> alter table [table name] change [old column name] [new column name] varchar (50);

Make a unique column so you get no dupes.

mysql> alter table [table name] add unique ([column name]);

Make a column bigger.

mysql> alter table [table name] modify [column name] VARCHAR(3);

Delete unique from table.

mysql> alter table [table name] drop index [colmn name];

Load a CSV file into a table.

mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1,field2,field3);

Dump all databases for backup. Backup file is sql commands to recreate all db’s.

# [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

Dump a table from a database.

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

Create Table Example 1.

mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

Create Table Example 2.

mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default 'bato');

Kommentare
1 Kommentar »
Kategorien
Gentoo, Stuff, Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

Ubuntu Karmic Koala Comming this week

Simon | October 26, 2009

On Thursday the 29th the next Ubuntu release Karmic Koala will hit the download mirrors

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

xen missing gpg key

Simon | October 23, 2009

If you get the following error message after installing xen tools and running aptitude update

W: GPG error: http://updates.vmd.citrix.com etch Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 841D6D8DFE3F8BB2
W: You may want to run apt-get update to correct these problems

Issue the following command:

wget -q http://updates.vmd.citrix.com/XenServer/5.5.0/GPG-KEY -O- | apt-key add -

This will download the current gpg key from the citrix update server and add the key to apt. You should see an ok message after thats done run

aptitude update The error message should be gone

Kommentare
Keine Kommentare »
Kategorien
Ubuntu/Debian, Xen/Vmware
RSS Kommentare RSS Kommentare
Trackback Trackback

Encrypted home and swap partition on Ubuntu 9.10 Karmic

Simon | October 16, 2009

I have always wanted to encrypt my /home partition on my notebook. Due to lack of time and the worries of data lose i never got round to it. But now the time has finally come. Please be careful following this howto if you do anything wrong you may erase all of you data. You have been warned!

aptitude install cryptsetup libpam-mount

We will start of with the swap partition which is easy. First deactivate your swap partition you may need to remove it from /etc/fstab and reboot if it is in use.:

swapoff /dev/sda7

Then fill your swap with random data from /dev/urandom

dd if=/dev/urandom of=/dev/sda7 bs=1M

Configure encrypted swap in /etc/crypttab and /etc/fstab

cat /etc/crypttab

cryptoswap /dev/sda7 /dev/urandom cipher=aes-cbc-essiv:sha256,size=256,hash=sha256,swap

cat /etc/fstab

/dev/mapper/cryptoswap none swap sw 0 0

Okay thats it reboot to test. If you call top from a shell you should see a normal swap partition. Then try and run the follow command you should see something like this:

cryptsetup status cryptoswap
/dev/mapper/cryptoswap is active:
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sda7
offset: 0 sectors
size: 8401932 sectors
mode: read/write

Ok your swap partition is done lets move on to /home make sure you have an empty partition for this all data on the partition will be deleted. You’ve been warned

Fill your new home partition with random data.

dd if=/dev/urandom of=/dev/sda8

Initialize the partition and set initial key. Please make sure to set a good password and do not forget it otherwise your data is gone.

cryptsetup -c aes-cbc-essiv:sha256 -y -s 256 luksFormat /dev/sda8

Create a device mapping

cryptsetup luksOpen /dev/sda8 cryptohome

Now you can create a file system on cryptohome

mkfs.ext4 -j -m 1 -O dir_index,filetype,sparse_super /dev/mapper/cryptohome

Okay give your new home a test by closing it reopening it and finally the first mount


cryptsetup luksClose cryptohome
cryptsetup luksOpen /dev/sda8 cryptohome
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.
mkdir -p /mnt/cryptohome
mount /dev/mapper/cryptohome /mnt/cryptohome
touch /mnt/cryptohome/linux
ls /mnt/cryptohome/
lost+found linux

We can also confirm that it works by issuing the command

cryptsetup status cryptohome
/dev/mapper/cryptohome is active:
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sda8
offset: 2056 sectors
size: 20978771 sectors
mode: read/write

Now would be a good time to move your current home data to this partition. And umount the partition:

umount /mnt/cryptohome
cryptsetup luksClose cryptohome

To mount this partition at boot time do the following. The boot process will stop and you will be prompted for a password:

First edit /etc/cryptotab

cryptohome /dev/sda8 none luks

Then edit /etc/fstab and add

/dev/mapper/cryptohome /home/ ext4 relatime,errors=remount-ro 0 2

Automatically mount when logging in i will write this part shortly so stay tuned.

Kommentare
8 Kommentare »
Kategorien
Ubuntu/Debian
RSS Kommentare RSS Kommentare
Trackback Trackback

« Previous Entries

 

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Links

  • AGF Clan
  • Gentoo
  • http.net
  • michael-fuchs.net

Categories

  • confixx/Plesk
  • fun
  • Gentoo
  • iptables
  • news
  • Stuff
  • Ubuntu/Debian
  • Xen/Vmware

Search Blog

rss RSS Kommentare valid xhtml 1.1 design by jide powered by Wordpress get firefox