Jaunty Jackalope is On

Yesterday Jaunty is really released. Now let's try it on and get the fastest Ubuntu boot with ext4.

welcome to utux-utux

The place where you can get any news, tipsn and tutorials about linux. I'cant explain any further informations about this site. Just open the tux image on the left side. ^_^

Showing posts with label Linux Tips. Show all posts
Showing posts with label Linux Tips. Show all posts

Repositioning Avant Window Navigator

Repositioning on Avant Window Navigator are unimplemented yet. But you can do some trick to do that. Just edit manual the AWN. Open gconf-editor (or gconftool) find the key /apps/avant-window-navigator/bar/bar_pos. Just do trial and error practice to find the best position. Don't forget to restart the AWN after.

NVIDIA Driver Manual Installation on OpenSUSE


Go to Yast>Software>Software Management

Search for and install these packet
make
gcc
kernel-source

Now download the latest Nvidia driver from here: http://www.nvidia.com/object/linux_display_amd64_71.86.06.html

Now log out and press "Ctrl+Alt+F1". You should be in command line mode, now here log in as root. Type "root" as your user name and then your root password and press enter. Now type "init 3" without the quotes! to kill the x. Locate the file you downloaded before. Than give these command:
chmod +x NVIDIA-Linux-x86-173.14.09-pkg1.run
./NVIDIA-Linux-x86-173.14.09-pkg1.run


Follow the installer and let it compile the kernel module for you.

Once everything is done and you are back in command line mode then type these commands......REMEMBER you are still logged in as "root"
nvidia-xconfig
nvidia-xconfig --composite
nvidia-xconfig --render-accel
nvidia-xconfig --add-argb-glx-visuals -d 24M


Now you can restart the machine by pressing "Ctrl+Alt+Del".
Enjoy! If the next kernel update breaks your xorg then just recompile the nvidia driver.

Samba VScan


Samba is the only protocol connecting Windows and Linux. And we already knew that Windows is lack of virus, worm, trojan, etc. Of course all of our writeable samba shares may get infected. So what should we do??
We can install antivirus scanner on Windows. But that's not the point because we still get infected from all of our network. So if one of them infected the samba file(s), it will spread all over network.
The cleverest thing we can do is scanning all over the files that will be write to samba. If you asking me how? Here's the answer. We can put antivirus to our samba module. So every file in samba will automatically scanned before. If the file get infected by virus, worm, etc, it will be reject and quarantine automatically. So our samba share won't be infected.
And the how to?? You can read and practice it by yourself here and here.

Rainlendar on Ubuntu

This time I would like to show you all how to install rainlendar on Ubuntu Inteprid Ibex. First, download the software on this site. Pick the free deb formatted file.
Then double clicks the file.
  • Click Install Package
  • Fill the root password
  • Go to Application | Office | Rainlendar2

Check Files Size Using ls Command

Sometimes we meet trouble in disk capacity. If we work within CLI, how do we know which files had the biggest size? Today, those kind of troubles won't be exist any longer. Just type the ls command with -h option.
Example, I want to check the files inside the /var directory. I just type the command below.
ls -lsah /var
I you confuse, just type man ls.

Simple Ubuntu Remastering with Remastersys

All of us had known that we could remaster Ubuntu with reconstructor, right? I thought that it'll works like remasterme on PClinuxOS, making live CD of a Linux system. But it's totally different. Reconstructor is less powerfull then remasterme.
Reconstructor only change the settings an Ubuntu iso then implement into the new one. But remasterme can back system of a PC up. So It'll be usefull and easier when we want to clone the settings to many PC's.
Fuih...
Then, what should we do? Is there any remasterme in other distro (ex: Ubuntu)? I've asking over Uncle Goog but nonsense.
I've tried to change the rpm of PClinuxOS remasterme to deb over alien. The conversion and installation in Ubuntu was success, but back then I found nothing the binary of remasterme. What a silly..
And the very last time I've found an application that works just like remasterme. And thanks God it made just for Ubuntu, named remastersys. Here's the how to.
1. Edit the repository apt-get
gedit /etc/apt/source.list
2. Add the following line
deb http://www.remastersys.klikit-linux.com/repository remastersys/
3. Refresh the and install remastersys
apt-get update
apt-get install remastersys

Now you are ready using remastersys to create a remaster iso of your system or just only back your data up.

Add Mass of Clarkconnect Users From Text File

Don't even try to add user from shell with useradd in Clarkconnect. Why? It's because the linux user database is also used for the ldap database (see previous posting of me). If you do it, even the user is registered to linux user but the user won't be able login with his ldap account. You can only add the user within webconfig. The fact is database for linux user and ldap user is different.
The problem begin here. What about adding mass of users, for me 6000, users to the ldap systems. I've thoughted we can easily solve the problem with shell script. Right? But that's actually wrong. So what we gonna do now?
After look after Clarkconnect forum, I founded it. A script to add mas of users automatically from text file. But don't worry, this time the ldap user also would be made.

First, made a text file for username named user_list.txt and put it to /tmp folder. Form for the text is:
USERNAME1:UID:PASSWORD:FIRSTNAME LASTNAME
USERNAME2:UID:PASSWORD:FIRSTNAME LASTNAME
USERNAME3:UID:PASSWORD:FIRSTNAME LASTNAME
....etc

You can easily convert your database to .csv file type and replace the commas (,) with (:).

Then make the main script named user.php. This script can you put within your home folder.
#!/usr/webconfig/bin/php -q

///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2003-2007 Point Clark Networks.
//
///////////////////////////////////////////////////////////////////////////////
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
///////////////////////////////////////////////////////////////////////////////

/*****************************************************************************/
/* D E P E N D E N C I E S */
/*****************************************************************************/

require_once("/var/webconfig/api/User.class.php");
require_once("/var/webconfig/api/File.class.php");
require_once("/var/webconfig/api/UserManager.class.php");
error_reporting(0);

$file = new File("/tmp/user_list.txt");
if (!$file->Exists()) {
echo "File not found.\n";
return 1;
}

$lines = $file->GetContentsAsArray();
foreach ($lines as $line) {
$userinfo = array(
'dn' => null,
'sn' => null,
'cn' => null,
'givenName' => null,
'uid' => null,
'title' => null,
'o' => null,
'ou' => null,
'roomNumber' => null,
'street' => null,
'postOfficeBox' => null,
'postalCode' => null,
'l' => null,
'st' => null,
'c' => null,
'telephoneNumber' => null,
'facsimileTelephoneNumber' => null,
'kolabFreeBusyFuture' => 60,
'pol' => array('anyone' => 4),
'alias' => '',
'delegate' => '',
'cyrus-userquota' => '',
'kolabDeleteflag' => false,
'pcnFTPPasswordFlag' => true,
'pcnMailPasswordFlag' => true,
'pcnPPTPPasswordFlag' => true,
'pcnProxyPasswordFlag' => true,
'pcnWebconfigPasswordFlag' => true,
'pcnSambaPasswordFlag' => true,
'pcnWebPasswordFlag' => true,
);

$profile = explode(":",$line);
$user = new User($profile[0]);
if ($user->IsValidUsername($profile[0])) {
$username = strtolower($profile[0]);
$userinfo['uid'] = $username;
$userinfo['password'] = $profile[2];
$userinfo['verify'] = $profile[2];
}else{
echo "Invalid username (" . $profile[0] . ").";
return 1;
}
// protect root
if ($username == 'root') {
echo "Skipping root account...\n";
continue;
}

// protect system account
if ((int)$profile[1] < 1000) {
echo "Skipping system account (UID < 1000)...\n";
continue;
}

list($first, $last) = explode(" ", $profile[3]);

if ($user->IsValidFirstName($first)) {
$userinfo['givenName'] = $first;
} else {
echo "Invalid first name (" . $first . ").";
return 1;
}
if ($user->IsValidLastName($last)) {
$userinfo['sn'] = $last;
} else {
echo "Invalid last name (" . $last . ").";
return 1;
}

try {
$user->Add($userinfo);
$userinfo = null;
echo "User $username successfully imported!\n";
} catch (UserAlreadyExistsException $e) {
echo "User $username already exists...skipping.\n";
} catch (Exception $e) {
echo "Adding user $username failed - " . $e->GetMessage() . "\n";
echo "Bailing on user import...\n";
return 1;
}
}
return 0;
// vi: syntax=php ts=4
?>


The last one is just execute it
./user.php

Hope it helps for you all. And I also hope that the next version of Clarkconnect add function to add many users automatically just by import the file with webconfig.
^_^

How to install run file extension

Fuh.. After installing OpenSuse 11 at my computer now I had to HP LaserJet 1020 printer driver installed. First download the driver at sourceforge. It seems OK since all of HP printer tipes could be detected with this hplip diver. But now I got a new problem how to install run file I've had.
It's said that You just run it like common script. So I tried this command
./hplip-2.8.6.run
But... Why it doesn't work???
I thought a little bit and..
Upszz... I've forgotte to do this one before =P.
chmod +x hplip-2.8.6.run

Kill Unresponding Proccess

In Windows, we can go to task manager and kill unresponding proccess. How did we do in linux? Is there a task manager? Let's find the answer here.

find PID
First time to know is Proccess ID, that is number given to running proccess. Give this command to your shell something like this.
# ps -aux | grep opera

You'll get result like this

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
502 3815 2.1 37.9 168372 94132 ? S 12:36 5:50 /usr/lib/opera/9.24/opera -style klearlook
502 3828 0.0 0.2 2656 592 ? S 12:36 0:00 /usr/lib/opera/plugins/operaplugincleaner 3815
502 4227 6.2 7.2 50476 18060 ? SNl 16:58 0:14 /usr/lib/opera/plugins/operapluginwrapper 19 23 /usr/lib/mozilla/plugins/libflashplayer.so
root 4237 0.0 0.3 2952 792 pts/2 S+ 17:01 0:00 grep --color opera


The PID is in italic. And to kill the process is just give the command below:
# kill -9 4237

The option -9 is special kill the proccess.

Booting Faster

A lot of services that is running on startup makes the system little bit longer to up. You should check properly what services you want start at startup and what services you don't.
Is it hard to you?
If yes you can try ntsysv. It can get launched both in Text Mode and GUI mode. Let's get our system booting faster.

Repair Lost GRUB

Someone still use Dual Boot Linux and Windows maybe accidentally remove Linux Boot Loader (GRUB) or repair the MBR with XP Cd. How to repair it?
1. Just prepare a System Rescue CD
2. Go to terminal and get in to grub with command
grub
3. After you'r in, get information from your disk
grub> find /boot/grub/stage1
You'll get result about partition contains stage1 file.
4. Select one you want to reinstall grub into and then type this
example my grub in hda4 (maybe the result named hd0,4)
grub> root (hd0,4)
then
grub> setup (hd0,4)
if it's over, then quit
grub> quit

Finish!

DeepFreeze for Linux (Advance)

I have writen bout DeepFreeze for Linux before. But here, this script more compleks with Graphical Interface. Then, Let's Freeze your Linux.

Make a bash script named deepfreeze with this content first.

#!/bin/bash
# Deepfreeze a la Linux
# Backup before use, Use At Your Own Risk
# Copyleft 2007 by A. Hardiena
# Translated by fortmunir

Xdialog --title "Deepfreeze ala Linux" \
--menubox " Welcome to Deepfreeze ala Linux." 17 65 3 \
"Install" "Install Deepfreeze" \
"Remove" "Remove Deepfreeze"
"Abort" "Abort Installer" 2>/tmp/checklist.tmp.$$

choice=`cat /tmp/checklist.tmp.$$
rm -f /tmp/checklist.tmp.$$

case $choice in
"Install"

ask=`mktemp -q /tmp/menu.XXXXXX`
header="Deepfreeze ala Linux"
size="9 60"
content="Home folder you want to protect."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask
if [ ! $?= 0 ]; then exit 0
fi

directory=`cat $ask`
check=`cat /etc//rc.d/rc.local | grep `# Deepfreeze System'`
temporary=" Deepfreeze System"

if [ "$check" == "$temporary" ]; then
sed -i "/# Deepfreeze/d" /etc/rc.d/rc.local
rm /home/$directory.tar.gz
fi
# Processing Deepfreeze and put to /etc/rc.d/rc.local
cd /home/
rm $directory.tar.gz
tar -cf $directory.tar $directory
gzip --best $directory.tar
cat << EOF >> /etc/rc.d/rc.local
# Deepfreeze System
cd /home/ # Deepfreeze do not manual editing this line
rm -f /home/$directory # Deepfreeze do not manual editing this line
# Deepfreeze has ended here
EOF
# Check if autorecovery has errorr
if [ $? = 0 ]; then
content="Deepfreeze home $directory success."
else
content="Deepfreeze home $directory failed."
fi

Xdialog --title "Header" --magbox "$content" $size
;;
Remove)
ask=`mktemp -q /tmp/menu.XXXXXX`
header="Deepfreeze ala Linux"
size="9 60"
content="Home folder you want to protect."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask

if [ ! $? = 0 ]; then
exit 0
fi

directory=`cat $ask`


If your distro doesn't use rc.d but init.d, You should change position of rc.local from /etc/rc.d/ to the right directory.

The last step is change the mode
chmod +x deepfreeze

Just double cliks it to activate. Or type in your console sh deepfreeze.

Choose Your Right Distro(s) Now

Are you newbie in Linux? Or, Are you getting problem to choose Linux Distro(s) you want installed on your PC?
The answer is here. Just surf to this site and get your right distro.
Have a nice experience with Linux.

Lost Your Root's Password

Root is an administrator user in linux. It has unlimited power to configure the system. But, what you gonna do if you forget the password?
There are several ways to recover your root's password. The easiest way is using livecd. All you need is only livecd/dvd from any linux distros like PClinuxOS, Ubuntu, Mandriva Live, OpenSUSE live and etc.

And here the steps are:

1. Boot your linux livecd
2. Mount your old existing linux partition
ex: mount /dev/hdb1 /mnt/old-system
/dev/hdb1 is root (/) partition of your old linux system
/mnt/old-system refers to your directory in livecd
3. Edit the /etc/shadow file on your root partition
vi /mnt/old-system/etc/shadow
4. remove the encrypted passwords in the root's line
result from the step 3

root:452342342342342342342342342342423
bin:*:13612:0:99999:7:::
daemon:*:13612:0:99999:7:::
..............
Remove the red one.

root:
bin:*:13612:0:99999:7:::
daemon:*:13612:0:99999:7:::
..............
5. Reboot your old system. Now the root's password is empty.

Ext3 in Windows

It's get annoying when we had to reboot our computer first to take some files in Linux. But this case was resolved with EXT2-FS. You can mount your ext2 or ext3 to Windows drive. So you can read or write the system easily.

Disk Formatting in Linux

Since yesterday my flash disk error. My Windows can't detect it properly. So I couldn't format it. Then I plug it into my PClos, even the flash can't be detected too at least I still can format it.
Don't worry, in Linux we can format with fat32 file system. So it still can be read in Windows. Here is the command to format using fat32:
mkfs.vfat /dev/sda1

Finally I am thinking about this,
Why Windows could't do that??
Or Was Linux "too" good, than ...??
:P

How Many Disk Space Left

There's many effect related to disk capacity, so you need to know about it. Problem that usually occur is:
1. /home full, user except root can't login.
2. /var full, your program can't runs and there wouldn't be logs.

Just type this command
df -h
And waste your unusefull files.

Looking Files in Linux?

The easiest way to look for file(s) in Linux we can use command locate. Just simply type locate (file you want to)
example:
locate http

You can combine with grep, so you can find files more specific.
locate http | grep etc

It will find all of files named http in directory etc.

For using locate, you need to make index firts with command updatedb. The complete command will be.
updatedb
locate http | grep etc

Run Level

Run Level is a mode of operation in one of the computer. There's six type or mode of operation in Linux. The configuration system allows you to choose one of them at once.

The Options
0 - Halt
1 -
Single user
2 -
Not used/User definable
3 -
Full multi-user, console logins only
4 -
Not used/User definable
5 -
Full multi-user, with display manager as well as console logins
6 -
Reboot

The command
init(space)(number of the options above)
Example, I want to change from GUI to text mode. So I should type on the console/terminal:
init 3

You had to be root to do this command.
This way absolutely usefull to fix Linux configuration system, like my post before.

Crontab The Timer

Did you usually do something Like download Linux Iso(s) in the middle of the night? (cheap internet traffic reason)Or you have to do something in the future but in the same time you must meet your boss?
The best solution is using crontab.

Command

Just type these command below to use crontab:

crontab -e # Edit your crontab file, or create one if it doesn't already exist.
crontab -l # Display your crontab file.
crontab -r # Remove your crontab file.
crontab -v # Display the last time you edited your crontab file.

File Syntax

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)


Example

A line in crontab file like below removes the temporary files from /home/myuser/tmp each day at 7:00 AM.

* 17 * * * rm /home/myuser/tmp/*
 

different paths

college campus lawn

wires in front of sky

aerial perspective

clouds

clouds over the highway

The Poultney Inn

apartment for rent