Sunday, December 13, 2009

[Sed] Delete one or more lines from a file - The solution

[Sed] Delete one or more lines from a file - The solution: "Remove the 3rd line:

sed '3d' fileName.txt



Removal of the line containing the string 'awk':

sed '/awk/d' filename.txt



Remove the last line:

sed '$d' filename.txt




Remove all empty lines:

sed '/^$/d' filename.txt
sed '/./!d' filename.txt"

expect in bash script ? - Dev Archives

expect in bash script ? - Dev Archives: "#!/bin/bash

RESULT=`echo 'set timeout -1
spawn ssh someaddress
expect {
Password: {send -- \'mypass\r\'; exp_continue}
user@ {send -- \'dosomething\r\'; exp_continue}
user@ {send -- \'exit\r\'}
} eof | expect -f -`

echo $RESULT
}"

Saturday, December 5, 2009

Absoblogginlutely! » Dell Open Manage Server Administrator (OMSA) alert setup – updated

Absoblogginlutely! » Dell Open Manage Server Administrator (OMSA) alert setup – updated: "Dellalert.bat should now contain the following lines.

@echo off
::Dell alert program
::v1.21
::Set variables below as appropriate
::needs blat downloaded (http://tinyurl.com/2qdxea) Put blat.exe in the system path
::No longer needs blat installed as configuration is set in the environment variables.

@echo on
setlocal
set log=c:\jobs\dell.txt
set pager=destinationpageraddress@company.com
set mail=destinationemailaddress@company.com
set company=Companyname
set server=%computername%
set mailserver=mailservername
set alertfrom=fromemailaddress@company.com

date /t >%log%
time /t >>%log%
echo %* >>%log%
if {%1}=={p} blat %log% -to %pager% -server %mailserver% -f %alertfrom% -subject “%company% %server% alert – %*”
if not {%1}=={} blat %log% -to %mail% -server %mailserver% -f %alertfrom% -subject “%company% %server% alert – %*”
endlocal

The commands to specify the call to dellalert.bat are below. Note that you need to specify cmd.exe and then the batch file. As the batch file has parameters with quotes, the quotes need to escaped with backslashes (as per the information below). I highly recommend you save these commands to a batch file called conf.bat and then run the batch file – a lot easier to manage, recall and implement on multiple servers. Each line starts with omconfig – you will probably find your web browser has wrapped the lines, but if you copy/paste the content into notepad your lines should be correct.

omconfig system alertaction event=batterywarn execappath=”cmd /c \”c:\jobs\dellalert p battery probe warning\”'
omconfig system alertaction event=batteryfail execappath=”cmd /c \”c:\jobs\dellalert p battery probe failure\”'
omconfig system alertaction event=fanwarn execappath=”cmd /c \”c:\jobs\dellalert fan probe warning\”'
omconfig system alertaction event=fanfail execappath=”cmd /c \”c:\jobs\dellalert p fan probe failure\”'
omconfig system alertaction event=hardwarelogwarn execappath=”cmd /c \”c:\jobs\dellalert hardware log warning\”'
omconfig system alertaction event=hardwarelogfull execappath=”cmd /c \”c:\jobs\dellalert p hardware log failure\”'
omconfig system alertaction event=intrusion execappath=”cmd /c \”c:\jobs\dellalert chassis intrusion detected\”'
omconfig system alertaction event=memprefail execappath=”cmd /c \”c:\jobs\dellalert p memory prefailure\”'"

Wednesday, November 25, 2009

Ubuntu Forums - View Single Post - SNMP and Dell OMSA on a PE 2950 with Ubuntu 6.06LTS server.

Ubuntu Forums - View Single Post - SNMP and Dell OMSA on a PE 2950 with Ubuntu 6.06LTS server.: "SNMP and Dell OMSA on a PE 2950 with Ubuntu 6.06LTS server.
The web interface will start up with /etc/init.d/dsm_om_connsvc start

If you want it to start automatically when you boot up, run this line without the quotes.

'/usr/sbin/update-rc.d dsm_om_connsvc start 20 2 3 4 5 . stop 19 0 1 6 . >/dev/nullssh'

To enable snmp to work with OMSA, you need to enable it. Run '/etc/init.d/dataeng enablesnmp'.
This will add a line at the bottom of your /etc/snmp/snmpd.conf so OMSA can connect to SNMP via smux.

This is the line it adds. 'smuxpeer .1.3.6.1.4.1.674.10892.1'

You still need to configure your snmpd.conf to allow connections to read the snmp. Here is a sample. NOTE: public is always the default community. For added security, change it to something else.


rwcommunity public 127.0.0.1
rocommunity public 127.0.0.1
rwcommunity public servername
rocommunity public servername
trapcommunity public
trapsink servername public
trapsink servername public
syscontact Root <root@localhost>
syslocation corp

Trapsink sends traps to that server, with the community string. I do localhsot AND the servers monitoring it. ro and rwcommunity is pretty self explanatory.

NOTE: Check your /etc/default/snmpd file and remove 127.0.0.1 from the line it's on. That is extra security so only localhost can read your snmp traps. Obviously you want others to read it, so make sure to remove it. When you are done, the line should look like this:

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid' <-- don't copy and paste this in, just delete 127.0.0.1 out of that line. You need the back tics and the forum format may change them.

Now do: /etc/init.d/snmpd restart
then a /etc/init.d/dataeng restart

That should get you working for 32bit users.

64bit users, keep going.

If you cannot log in at https://servername:1311 and you keep getting log in, incorrect(and it should if you are running a 64 bit distro), you need to copy some files, as OMSA 5 uses PAM and not it's own authentication anymore.

Change /lib/security path to /lib32 in /etc/pam.d/omauth
This is what omauth will look like afterwards

auth required /lib32/pam_unix.so nullok
auth required /lib32/pam_nologin.so
account required /lib32/pam_unix.so nullok


and copy from a 32bit install (a server running a 32bit ubuntu/debian distro) theses files :

/lib/libsepol.so.1
/lib/libselinux.so.1
/lib/security/pam_unix.so
/lib/security/pam_nologin.so

copy into /lib32 on your amd64 servers.

I just run these lines on the 32bit server, to copy over to my amd64 server.

scp /lib/security/libse* root@server:/lib32/

scp /lib/security/pam_* root@server:/lib32/

then edit the /etc/pam.d/omauth as described above.

after a ldconfig (run ldconfig) you should be able to pam login to the web interface at https://server:1311

For snmp to work, I would restart a few services.

Do a /etc/init.d/snmpd restart
then a /etc/init.d/dataeng restart

If you don't have a 32 bit install, PM me, I could zip the files up and send them to you.

That should do it.

Good luck."

Tuesday, November 24, 2009

Dell PERC 6/i and RAID monitoring

Dell PERC 6/i and RAID monitoring: "Dell PERC 6/i and RAID monitoring

A few pointers for people trying to get Dell's PERC 6/i RAID monitoring working under Ubuntu, and any other linux for that matter. It also applies to PERC 5/i too, and... other stuff :-)

First, visit Dells Linux site. Have a poke about, see what's there.

Next, we need to download a tool to get information from your array. Download LSI's MegaRAID CLI tool for linux. It comes as a .RPM, so if you're an ubuntu user, you can convert it to a .deb using alien, or convert it to a .tar.gz.
# alien --to-tgz MegaCli-1.01.39-0.i386.rpm

You then have a CLI tool you can use to get all your data now! For example:
# ./opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL | grep State State: Optimal

One thing I spent a while figuring out was how to get the rebuild progress, so here's how:
# ./opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv \[32:1\] -aALL

There's also a really useful cheat sheet for common tasks

Don't forget to actually monitor this output with nagios, or your favorite monitoring tool!"

Thursday, November 19, 2009

lanmap – Network discovery tool that produces nice 2d images | Ubuntu Geek

lanmap – Network discovery tool that produces nice 2d images | Ubuntu Geek: "Lanmap Listens to all available traffic on the interface of your choice, figures out who’s talking to who, how much, using which protocols.

This information is then put into a nice human-readable 2d image (various formats are available) which can be used to understand a network’s topology.

Install lanmap in Ubuntu

sudo aptitude install lanmap

This will complete the installation

Using lanmap

lanmap syntax

lanmap [-o directory] [-e program] [-T {png,gif,svg}] [-f filtetr] [-D {#,all,raw}] [-r seconds]

[-i {?,*wildcard*,iface}] [-h] [-v] [-V]

lanmap example

lanmap -i eth0 -r 30 -T png -o /tmp/

This will create a lanmap.png file under tmp folder

You can see the same screen here

lanmap available options

-o directory – The directory in which to save the generated images. Default is the current directory.

-e program – The program to use to generate images. Default is twopi.

-T {png,gif,svg} – Output image format. Default is png.

-f filter – Traffic filter, in libpcap syntax.

-D {#,all,raw} – Debug mode; lots of output, use with caution. #: payload bytes to dump (default: 0)

-r seconds – Set the time interval between 2 consecutive graph generations. Default is 60 seconds.

-i {?,*wildcard*,iface} – Interface to use: ?: list all devices and exit *3Com*: use the first NIC with

“3Com” in it

-V – Version info.

-vv – Verbose mode, up to 3 levels (-vv, -vv09:21 29/11/2007v).

-h – Help message."

Network Discovery and Topology Mapping - Ubuntu Forums

Network Discovery and Topology Mapping - Ubuntu Forums: "I'm looking for an application to use to map an industrial ethernet network, and make a graphical network map.

I have tried nmap and it works for me at home but not at work, also it doesn't make graphical topology maps.

I'm looking for something that is easy to use and install under Kubuntu.

So far I have tried, and am not satisfied with or unable to get working

Cacti + weathermap
nessus
cheops
lanmap
AutoScan - gets stuck at update fingerprints
nagios
machinemon
scanrand
netdiscover

So if there is anything in the list that you think I really should be using please say so.

Also if there is anything not in the list that you thing will do the job for me, please tell me.

I have also tried using a few apps via wine, but not good there either.

Any advice at all would be helpful.
Thanks,"

Tuesday, November 17, 2009

Print Page - Customize Xfce 4.6 logout dialog

Print Page - Customize Xfce 4.6 logout dialog: "In a terminal emulator, Xfce terminal, xterm no matter which one:
Code:

xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false'

and
Code:

xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false'"

Friday, November 13, 2009

Intel PRO1000/VT Quad Nic IGB Driver - Untangle Forums

Intel PRO1000/VT Quad Nic IGB Driver - Untangle Forums: "How to compile the Intel IGB driver for an Intel Pro1000/VT quad port NIC.

These directions are based on a clean install of Untangle 6.0.2
lines beginning with -- need to be type in the terminal

Install a fresh copy of Untangle 6.0.2

Add your repositories

-- vi /etc/apt/sources.list

deb http://archive.debian.org/debian sarge main contrib non-free
deb http://user:metavize@updates.untangle.com/untangle stable main premium upstream

save your file with by pressing esc : wq and press enter

Note: you'll need the headers for the current kernel you are running. If you are not running Untangle 6.0.2, you may have a different Kernel. To determine your kernel version, issue a uname -a command. In my case it's 2.6.22-15


-- apt-get update
-- apt-get install make gcc linux-headers-2.6.22-15-untangle


download your nic drivers and untar

-- tar -xf igb-1.3.8.6.tar
-- cd igb-1.3.8.6
- cd src
-- make clean
-- make install
optional: modprobe igb or just reboot

You should see the additional nics in the web interface under Config->Network->Interfaces. I also then removed the 2 additional apt sources added in this document. I'm not sure if this step was necessary, but figured why not.

Also, some say that you need to add the driver/module to /etc/modules, but in my case I didn't have to. To verify that it is working, you can just issue an ifconfig -a and see the new interfaces."

Wednesday, November 4, 2009

HowTo Achieve "Ubuntu-Desktop-Minimal" - Ubuntu Forums

HowTo Achieve "Ubuntu-Desktop-Minimal" - Ubuntu Forums: "#!/bin/bash ####################################################################### # Ubuntu-Desktop-Minimal: Post-install script to install only the bare # essentials of an Ubuntu Desktop. ####################################################################### echo '[*] Installing Gnome Essentials' sudo apt-get -y install gnome-core gdm network-manager-gnome fast-user-switch-applet \ human-theme x11-xserver-utils tangerine-icon-theme gnome-themes-ubuntu ubuntu-artwork \ jockey-gtk gnome-screensaver gnome-utils echo '[*] Installing Application Essentials' sudo apt-get install -y gcalctool tsclient"

Saturday, October 31, 2009

Bring window to the front instead of launching new instance [Archive] - Ubuntu Forums

Bring window to the front instead of launching new instance [Archive] - Ubuntu Forums: "I want a launcher on my panel for Thunderbird (for example). But I want this launcer to check if an instance of Thunderbird is already open on the desktop: if it is open, then I just want to bring that window to the front; otherwise, I want to just launch Thunderbird. These days (with dapper), I think that t-bird just behaves this way without needing to mess around like this. But I'll illustrate with t-bird.

To do this, I first installed wmctrl from the universe repostirories. This is a command-line utility that can list open windows, bring them to the front etc. Then I wrote a script, using wmctrl. Then I created a launcher on the panel, which just runs the script. For thunderbird, the script looked like this (excluding the annotations in blue):

#! /bin/bash

WINTITLE='Mail/News' # Main Thunderbird window has this in titlebar
PROGNAME='mozilla-thunderbird' # This is the name of the binary for t-bird

# Use wmctrl to list all windows, count how many contain WINTITLE,
# and test if that count is non-zero:

if [ `wmctrl -l | grep -c '$WINTITLE'` != 0 ]
then
wmctrl -a '$WINTITLE' # If it exists, bring t-bird window to front
else
$PROGNAME & # Otherwise, just launch t-bird
fi
exit 0


Save this script as 'my-tbird-script' and make it executable. Click on panel, and create a 'Custom Application Launcher ... '. Make the command point to your script. Give it the t-bird icon. Change WINTITLE and PROGNAME to adapt your script to any other application.

As I said, for t-bird this is redundant now, I believe. For gnome-terminal, it is a bit tricky, because the title-bar doesn't have a 'signature' that makes it easily recognizable in the list of windows. You can work around that by changing your default profile in terminal so that the title bar always contains 'Terminal'."

Thursday, October 29, 2009

How To Install Squid in Ubuntu Linux | e-HealthExpert.org

How To Install Squid in Ubuntu Linux | e-HealthExpert.org: "note - to see only the lines that aren't blanks or don't start with a # use: sudo grep '^[^#]' /etc/squid/squid.conf"

Simple howtos

Simple howtos: "Connect to VNC behind NAT
Suppose a Windows client with VNC listening on port 5900 has to be accessed from behind NAT. On client cliwin to gate:

# ssh -R 15900:localhost:5900 user@gate

On client cliadmin (from host to gate):

# ssh -L 5900:localhost:15900 admin@gate

Now the admin can connect directly to the client VNC with:

# vncconnect -display :0 localhost"

Wednesday, October 28, 2009

help creating a cron job (ssh tunnel) - Ubuntu Forums

help creating a cron job (ssh tunnel) - Ubuntu Forums: "help creating a cron job (ssh tunnel)
i need to establish and keep alive a reverse ssh tunnel. but i only want to do this over the weekend. i need to establish the connection late friday night, and terminate the connection late sunday night.

here is the script i'm using to establish the connection:
Code:

#!/bin/sh

# $REMOTE_HOST is the name of the remote system
REMOTE_HOST=my.home.system

# $REMOTE_PORT is the remote port number that will be used to tunnel
# back to this system
REMOTE_PORT=5000

# $COMMAND is the command used to create the reverse ssh tunnel
COMMAND='ssh -N -R $REMOTE_PORT:localhost:22 $REMOTE_HOST'

# Is the tunnel up? Perform two tests:

# 1. Check for relevant process ($COMMAND)
pgrep -f -x '$COMMAND' || $COMMAND

# 2. Test tunnel by looking at 'netstat' output on $REMOTE_HOST
ssh $REMOTE_HOST netstat -an | egrep 'tcp.*:$REMOTE_PORT.*LISTEN' \
> /dev/null 2>&1
if [ $? -ne 0 ] ; then
pkill -f -x '$COMMAND'
$COMMAND
fi"

Thursday, October 22, 2009

HOWTO: Control the gnome VNC vino-server from the command line - Ubuntu Forums

HOWTO: Control the gnome VNC vino-server from the command line - Ubuntu Forums: "HOWTO: Enable and control the gnome VNC vino-server from the command line
CAVEAT: A user must already be logged into the desktop on the target machine for this to work

Here is a cool trick for remotely enabling the gnome vino VNC server (assuming that it's already been installed and configured) on a box that you only have SSH access to.

Log into the target system using SSH, and run the following command:
Code:

gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

You can also monkey with the vino server options by editing this file

/home/<userhomedir>/.gconf/desktop/gnome/remote_access/%gconf.xml

Let's say you want to disable the 'Ask you for confirmation' setting, or change the password.

Easiest way to do it:

1) On your own Ubuntu box; Go to System => Preferences => Remote Desktop. and configure the Remote Desktop Preferences to your liking, then click close.

2) Navigate to ~/.gconf/desktop/gnome/remote_access/ in your home directory, open up the %gconf.xml file, and copy the contents.

3) Establish an SSH connection to the remote box, change directory to /home/<userhomedir>/.gconf/desktop/gnome/remote_access/ directory, and backup the existing %gconf.xml file.
Code:

mv %gconf.xml %gconf.xml.bak

4) Create a new %gconf.xml file,
Code:

vi %gconf.xml

then paste in the contents for your own %gconf.xml file that you copied in step number 2.

5) Stop and start the vino server from the command line
Code:

gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled false
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

6) Connect to the target system using your vnc client. When I'm on my Ubuntu workstation, I prefer to connect securely via SSH with the following command
Code:

vncviewer -via username@somehost.com targetboxhostname:0

Last edited by srf21c; November 9th, 2006 at 11:39 AM.. Reason: add 'enable' to title for better search visibility
srf21c is offline"

Thursday, October 15, 2009

Talk:How to rebuild the Untangle kernel - UntangleWiki

Talk:How to rebuild the Untangle kernel - UntangleWiki: "Talk:How to rebuild the Untangle kernel
From UntangleWiki
Jump to: navigation, search

The following seems to be the right way of getting Untangle patches. (I didn't try to build for now, only tested the patching machinery)
Using the following apt source :

deb updates.untangle.com/public/lenny stable main premium upstream

apt-get install linux-source-2.6.26
apt-get install linux-support-2.6.26-1
apt-get install linux-patch-debian-2.6.26

tar xjf /usr/src/linux-source-2.6.26.tar.bz2
cd linux-source-2.6.26
/usr/src/kernel-patches/all/2.6.26/apply/debian -f untangle -a all"

Difference between Incremental and Differential Backup | Knowledge Base

Difference between Incremental and Differential Backup | Knowledge Base: "In what way differential and incremental backups differ from each other
Description

An incremental backup contains all changes that have been made since the latest incremental or full backup was created. If one full backup and several incremental were created, all of these backups must be saved in the same folder so that you will be able to restore the data. If one of incremental backups or a full backup is deleted, there is no way to restore the set, since all backups are dependent on each other.

A differential backup contains all changes that have been made after the full backup creation. To restore a differential backup, Acronis True Image must match the differential backup with the original one.

So, If your objective is to reduce backup size and backup time, then the best strategy would be to create incremental backups. On the other hand, if you want to increase backup reliability, by not having to rely on a chain of incremental backups, then differential backups would be the best solution.

Here is a graphical representation of the differences between full, incremental and differential backups:


Click the picture to enlarge
More information

An incremental or differential backup created after the disk is defragmented might be considerably larger than usual. This is because the defragmentation program changes file locations on the disk and backups reflect these changes. Therefore, it is recommended that you re-create a full backup after disk defragmentation."

Types_of_backup.png (PNG Image, 2005x1437 pixels) - Scaled (57%)

Types_of_backup.png (PNG Image, 2005x1437 pixels) - Scaled (57%)

Spiceworks Sponsors

Spiceworks Sponsors: "REM Login Script:for /f 'Tokens=2 Delims=[]' %%i in ('ping -n 1 '%computername%'') do set IP=%%iecho %username% logged ON %computername%, IP=%IP% @ %time% %date% >> \\servername\sharename$\%username%.txtecho %username% logged OFF %computername% @ %time% %date% >> \\servername\sharename$\%username%.txt REM Startup Script:for /f 'Tokens=2 Delims=[]' %%i in ('ping -n 1 '%computername%'') do set IP=%%iecho Started up, IP=%IP% @ %time% %date% >> \\servername\computers$\%computername%.txtREM Shutdown Script:echo Shutdown @ %time% %date% >> \\servername\computers$\%computername%.txt"

Tuesday, October 13, 2009

Download ZoneCD 1.2-7 for Linux - The ZoneCD is a WiFi gateway running on a LiveCD. - Softpedia

Download ZoneCD 1.2-7 for Linux - The ZoneCD is a WiFi gateway running on a LiveCD. - Softpedia: "ZoneCD description

The ZoneCD is a WiFi gateway running on a LiveCD.

The Public IP ZoneCD is what's known as a LiveCD. It does not install to your hard drive. It runs right from your CD-ROM. The ZoneCD is a re-master of Morphix CD which in turn is a modified version of KNOPPIX CD.

The ZoneCD is a bootable CD with a collection of GNU/Linux software pre-configured to create a WiFi gateway. ZoneCD is a mini operating system with automatic hardware detection, and support for many graphics cards, sound cards and other peripherals.

The gateway includes support for WiFi end-user authentication and web content filtering. Public IP ZoneCD is distributed under the GNU General Public License ."

Friday, October 9, 2009

Tips For Linux - How to find - Size of a directory & Free disk space

Tips For Linux - How to find - Size of a directory & Free disk space: "How to find - Size of a directory & Free disk space

This article explains 2 simple commands that most people want to know when they start using Linux. They are finding the size of a directory and finding the amount of free disk space that exists on your machine. The command you would use to find the directory size is ' du '. And to find the free disk space you could use ' df '.

All the information present in this article is available in the man pages for du and df. In case you get bored reading the man pages and you want to get your work done quickly, then this article is for you.

-

'du' - Finding the size of a directory

$ du
Typing the above at the prompt gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. The size given includes the sizes of the files and the directories that exist in the current directory as well as all of its subdirectories. Note that by default the sizes given are in kilobytes.


$ du /home/david
The above command would give you the directory size of the directory /home/david


$ du -h
This command gives you a better output than the default one. The option '-h' stands for human readable format. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.


$ du -ah
This command would display in its output, not only the directories but also all the files that are present in the current directory. Note that 'du' always counts all files and directories while giving the final size in the last line. But the '-a' displays the filenames along with the directory names in the output. '-h' is once again human readable format.


$ du -c
This gives you a grand total as the last line of the output. So if your directory occupies 30MB the last 2 lines of the output would be

30M .
30M total

The first line would be the default last line of the 'du' output indicating the total size of the directory and another line displaying the same size, followed by the string 'total'. This is helpful in case you this command along with the grep command to only display the final total size of a directory as shown below.


$ du -ch | grep total
This would have only one line in its output that displays the total size of the current directory including all the subdirectories.

Note : In case you are not familiar with pipes (which makes the above command possible) refer to Article No. 24 . Also grep is one of the most important commands in Unix. Refer to Article No. 25 to know more about grep.


$ du -s
This displays a summary of the directory size. It is the simplest way to know the total size of the current directory.


$ du -S
This would display the size of the current directory excluding the size of the subdirectories that exist within that directory. So it basically shows you the total size of all the files that exist in the current directory.


$ du --exculde=mp3
The above command would display the size of the current directory along with all its subdirectories, but it would exclude all the files having the given pattern present in their filenames. Thus in the above case if there happens to be any mp3 files within the current directory or any of its subdirectories, their size would not be included while calculating the total directory size.

-

'df' - finding the disk free space / disk usage

$ df
Typing the above, outputs a table consisting of 6 columns. All the columns are very easy to understand. Remember that the 'Size', 'Used' and 'Avail' columns use kilobytes as the unit. The 'Use%' column shows the usage as a percentage which is also very useful.


$ df -h
Displays the same output as the previous command but the '-h' indicates human readable format. Hence instead of kilobytes as the unit the output would have 'M' for Megabytes and 'G' for Gigabytes.

Most of the users don't use the other parameters that can be passed to 'df'. So I shall not be discussing them.

I shall in turn show you an example that I use on my machine. I have actually stored this as a script named 'usage' since I use it often.

Example :

I have my Linux installed on /dev/hda1 and I have mounted my Windows partitions as well (by default every time Linux boots). So 'df' by default shows me the disk usage of my Linux as well as Windows partitions. And I am only interested in the disk usage of the Linux partitions. This is what I use :

$ df -h | grep /dev/hda1 | cut -c 41-43

This command displays the following on my machine

45%

Basically this command makes 'df' display the disk usages of all the partitions and then extracts the lines with /dev/hda1 since I am only interested in that. Then it cuts the characters from the 41st to the 43rd column since they are the columns that display the usage in % , which is what I want."

Xubuntu Hardy on PE850 with Volari Z7

Xubuntu Hardy on PE850 with Volari Z7: "# xorg.conf (X.Org X Window System server configuration file) # # This file was generated by dexconf, the Debian X Configuration tool, using # values from the debconf database. # # Edit this file with caution, and see the xorg.conf manual page. # (Type 'man xorg.conf' at the shell prompt.) # # This file is automatically updated on xserver-xorg package upgrades *only* # if it has not been modified since the last upgrade of the xserver-xorg # package. # # If you have edited this file but would like it to be automatically updated # again, run the following command: # sudo dpkg-reconfigure -phigh xserver-xorg Section 'InputDevice' Identifier 'Generic Keyboard' Driver 'kbd' Option 'XkbRules' 'xorg' Option 'XkbModel' 'pc105' Option 'XkbLayout' 'us' EndSection Section 'InputDevice' Identifier 'Configured Mouse' Driver 'mouse' Option 'CorePointer' EndSection Section 'Device' #Identifier 'Videocard0' Identifier 'Configured Video Device' Driver 'sis' VendorName 'Videocard vendor' BoardName 'XGI Volari Z7/Z9' Option 'DDCMode' 'on' EndSection Section 'Monitor' #Identifier 'Monitor0' Identifier 'Configured Monitor' VendorName 'Dell' ModelName '2005FPW' HorizSync 28-84 VertRefresh 60 Option 'dpms' EndSection Section 'Screen' #Identifier 'Screen0' Identifier 'Default Screen' Device 'Configured Video Device' Monitor 'Configured Monitor' DefaultDepth 24 SubSection 'Display' Viewport 0 0 Depth 24 Modes '1280x1024' EndSubSection EndSection Section 'ServerLayout' Identifier 'Default Layout' Screen 'Default Screen' EndSection"

Monday, October 5, 2009

Tom Haws: Linux recursive global text replace

Tom Haws: Linux recursive global text replace: "Linux recursive global text replace
Unsharptech has a Linux recursive (sub-directories) global text search and replace command that really works if you are running Linux or administering/webmastering at a Linux host. I'll paste it here as a backup, but I highly recommend their page for its cool formatting.

Notes:

* there are THREE places to put your text. You have to tell grep what to find and then sed what to find and replace.
* The grep find string doesn't have to exactly match the sed find string. That's your business.
* Don't forget to put a backslash '\' (escape code) before any character you think or know is 'special'. If the command doesn't work for you, check this first and second and third. For example, periods, apostrophes, and quotation marks (double quotes) are 'special': s/3\.1416\'/3\.1416\'/



grep -rl 'what_to_find' ./ | xargs sed -i 's/what_to_find/what_to_replace_with/g'"

How to make a "Basic" .deb - Ubuntu Forums

How to make a "Basic" .deb - Ubuntu Forums: "I recently had to figure out how to make a stand-alone debian package (not intended for a repository or build system), and it took quite some patience to wade through all of the complex ways of making debs for more complex distribution channels than a simple web download.

This tutorial shows the most basic way of packaging a simple already-compiled program.

1. Decide on the name of your package. Standard debian notation is all lowercase in the following format:
Code:

<project>_<major version>.<minor version>-<package revision>

For example, you could name your first package...
Code:

helloworld_1.0-1

2. Create a directory to make your package in. The name should be the same as the package name.
Code:

mkdir helloworld_1.0-1

3. Pretend that the packaging directory is actually the root of the file system. Put the files of your program where they would be installed to on a system.
Code:

mkdir helloworld_1.0-1/usr
mkdir helloworld_1.0-1/usr/local
mkdir helloworld_1.0-1/usr/local/bin
cp '~/Projects/Hello World/helloworld' helloworld_1.0-1/usr/local/bin

4. Now create a special metadata file with which the package manager will install your program...
Code:

mkdir helloworld_1.0-1/DEBIAN
gedit helloworld_1.0-1/DEBIAN/control

Put something like this in that file...
Code:

Package: helloworld
Version: 1.0-1
Section: base
Priority: optional
Architecture: i386
Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
Maintainer: Your Name <you@email.com>
Description: Hello World
When you need some sunshine, just run this
small program!

(the space before each line in the description is important)

5. Now you just need to make the package:
Code:

dpkg-deb --build helloworld_1.0-1


And you're done!

That wasn't so hard, was it?

Just so you know, there are a lot more fields in the metadata file, and even extra whole configuration files which you can have dpkg work with, which I left out -- this is the bare bones of what's required."

Thursday, October 1, 2009

Use Joomla Menu for Virtuemart [Updated]

Use Joomla Menu for Virtuemart [Updated]: "Use Joomla Menu for Virtuemart [Updated]
Written by Thomas Kahl
Sunday, 05 October 2008 15:48

In Joomla, you can define a virtuemart-menuitem and assign a product-id (for example). This works so far. You can click on the menu item and the product flypage is opened. This way, you are able to publish modules on specific virtuemart products or pages.

The problem is, that the Itemid of the menu is not selected, when you open the product through another way (e.g. browse page, next / previous product). The Itemid is also not selected, when virtuemart has to redirect.

The reason for that is, that virtuemart searches the #__menu table for the first occurance of virtuemart and uses the menu id found as Itemid. This is mostly not the Itemid you want to have.

We have created a small script that corrects this behaviour:

You will have to edit (and backup!!!) the file '/administrator/components/com_virtuemart/classes/ps_session.php'. Find the function url(...) and replace the line in the first if-clause (should be around line 499) with the following code:
// Original Virtuemart Code:
// $Itemid = '&Itemid='.$this->getShopItemid();
// VM-Expert Hack – Start

// Strip the parameters from the $text variable and parse to a temporary array
$tmp_text=str_replace('amp;','',substr($text,strpos($text,'?')));
if(substr($tmp_text,0,1)=='?') $tmp_text=substr($tmp_text,1);
parse_str($tmp_text,$ii_arr);

// Init the temp. Itemid
$tmp_Itemid='';

$db = new ps_DB;

// Check if there is a menuitem for a product_id (highest priority)
if ($ii_product_id=intval($ii_arr['product_id'])) {
$db->query( 'SELECT id FROM #__menu WHERE link='index.php?option=com_virtuemart' AND params like '%product_id=$ii_product_id%' AND published=1');
if( $db->next_record() ) $tmp_Itemid = $db->f('id');
}
// Check if there is a menuitem for a category_id
$ii_cat_id=intval($ii_arr['category_id']);
if ( $ii_cat_id && $tmp_Itemid=='') {
$db->query( 'SELECT id FROM #__menu WHERE link='index.php?option=com_virtuemart' AND params like '%category_id=$ii_cat_id%' AND published=1');
if( $db->next_record() ) $tmp_Itemid = $db->f('id');
}
// Check if there is a menuitem for a flypage
$ii_flypage=$ii_arr['flypage'];
if ($ii_flypage && $tmp_Itemid=='') {
$db->query( 'SELECT id FROM #__menu WHERE link='index.php?option=com_virtuemart' AND params like '%flypage=$ii_flypage%' AND published=1');
if( $db->next_record() ) $tmp_Itemid = $db->f('id');
}
// Check if there is a menuitem for a page
$ii_page=$ii_arr['page'];
if ($ii_page && $tmp_Itemid=='') {
$db->query( 'SELECT id FROM #__menu WHERE link='index.php?option=com_virtuemart' AND params like '%page=$ii_page%' AND published=1');
if( $db->next_record() ) $tmp_Itemid = $db->f('id');
}
// If we haven't found an Itemid, use the standard VM-Itemid
$Itemid = '&Itemid=' . ($tmp_Itemid ? $tmp_Itemid : $this->getShopItemid());

// VM-Expert Hack - End

This code checks the menu table more detailed than virtuemart itself does it. If a matching record is found, this can be product_id, category_id, flypage or pagename, the Itemid is selected. If no match is found, the default virtuemart Itemid is selected.

There is one thing to keep in mind: as described before, virtuemart selects the first Itemid found. To make sure that this is not a “special” menuitem, add a default virtuemart menuitem before you set up the other items so this item has the lowest menu_id.

Another tip: the menu that holds the items can be invisible if you just want this feature to assign modules.

If you have SEO-Tools active, you should purge the old shop-urls, because they may use the old Itemid's.

You need this feature? Let us do the hard work: we apply this hack for you!"

Wednesday, September 30, 2009

[all variants] Multilevel Incremental Backup tool [Archive] - Ubuntu Forums

[all variants] Multilevel Incremental Backup tool [Archive] - Ubuntu Forums: "You can also try Back-In-Time (http://www.le-web.org/back-in-time/).

This is a GUI program that is very easy to use.

The premise is basically that the first time you run it it will make a complete 'snapshot' of the directory or directories you specify and back them up to a location of your choosing (you can even specify NFS shares and external storage). After the initial snapshot it will monitor the directories for any changes and will back-up only the changed files. You can specify the frequency of the back-ups and it runs in the background to keep tabs on the schedule."

Tuesday, September 29, 2009

Extension Manager : Install

Extension Manager : Install: "This module allows updating of product information via AJAX from the product browse page.
Changing product information normally takes a long time - now it's a breeze!

1. Modify your browse templates (found in /components/com_virtuemart/themes/default/templates/browse) to include the following lines:

<div class='AJAX' pid='<?php echo $product_sku ?>'>
<div class='AJAX_field' field='product_name' title='Name' content='<?php echo $product_name ?>'></div>
<div class='AJAX_field' field='product_s_desc' title='Short Desc' content='<?php echo $product_s_desc ?>'></div>
<div class='AJAX_field' field='product_desc' title='Description' content=' '></div>
<div class='AJAX_field' field='product_price' title='Price' content=' '></div>
<div href='<?php echo $product_flypage; ?>' class='AJAX_detail_link'></div>
</div>

2. Publish the VirtueMart AJAX updater module on All pages, with Access Level set to 'special' (admin only), in a position used by your template.

3. Log into the front end of your site as administrator, and browse the products. Textboxes should appear under the products, through which you can edit the product data. Please note that both price and description will be empty initially, but will work as expected.

4. It is highly recommended that you password protect the modules/mod_vm_ajax_update/AJAX directory to stop malicious use. Ask your web host how.

The AJAX updater uses JQuery. If your site already uses prototype, or a similar javascript framework, they may conflict.

If you are keen to be able to change the SKU using AJAX, please email me at josh@neonascent.com . It is a possible future improvement."

Sunday, September 27, 2009

[all variants] [SOLVED] /etc/crontab doesn't change cron.daily time - Ubuntu Forums

[all variants] [SOLVED] /etc/crontab doesn't change cron.daily time - Ubuntu Forums: "Re: [SOLVED] /etc/crontab doesn't change cron.daily time
Well, I already figured out the problem (well its not really a problem, more me figuring out how cron interacts with anacron). My changes to /etc/crontab were taking effect, but it wouldn't run cron.daily because anacron exists. So I needed to change the time cron calls anacron by changing /etc/cron.d/anacron. Or I could have taken out the test for anacron, but then cron.daily would get run by both cron and anacron everyday.

You edit user crontabs with crontab -e, but /etc/crontab you edit directly.

Thanks for the help."

Thursday, September 24, 2009

Kernel panic - not syncing: Attempted to kill init! - Page 2 - LinuxQuestions.org

Kernel panic - not syncing: Attempted to kill init! - Page 2 - LinuxQuestions.org: "My kernel build steps.

rpm -ivh kernel-*.src.rpm
cd /usr/src/redhat
rpmbuild -bp SPECS/kernel-2.6.spec
cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
cp (previous version directory)/.config .
make menuconfig
cp -a .config config_org
make mrproper
cp -a config_org .config
make oldconfig
make
make modules
make modules_install
make install # <--(It seems installing by prep image)
#? This install method is not bootable-->: installkernel 2.6.18-92.1.22.el5 arch/x86_64/boot/bzImage System.map
vi /boot/grub/grub.conf # edit grub menu item
and default menu number(0-...).

Please test this method guys."

script to clear log files - LinuxQuestions.org

script to clear log files - LinuxQuestions.org: "find -type f -exec cat /dev/null > {} \;"

Wednesday, September 23, 2009

dpkg-reconfigure xserver-xorg alternative on Lenny? - LinuxQuestions.org

dpkg-reconfigure xserver-xorg alternative on Lenny? - LinuxQuestions.org: "Don't Xorg -configure or xorgconfig or xorgcfg work on Debian platforms?"

[SOLVED] Lenny xorg.conf? - Linux Forums

[SOLVED] Lenny xorg.conf? - Linux Forums: "# apt-get uninstall xorgconf.xorg
# apt-get install xorgconf.xorg

This solved the issue."

Debian User Forums • View topic - HOWTO: Choose the resolution YOU want in xorg.conf

Debian User Forums • View topic - HOWTO: Choose the resolution YOU want in xorg.conf: "HOWTO: Choose the resolution YOU want in xorg.conf

Postby tukuyomi » 2008-05-06 12:31
Xorg has been recently updated to 7.3 and apparently uses xrandr to set the best resolution for you.
It works well in most cases, but sometimes, you'll want to set X to start in a resolution YOU choose.
Of course, the first thing you do is to tweak your xorg.conf as you did it for about x years now and happily press [CTRL][ALT][<--] and ..? wtf o_O the resolution has not changed.
After having checked twice your xorg.conf, you're still stucked in that resolution and your desktop is unusable due to all icons in your gnome-panel that are not visible anymore...
So, how to modify xorg.conf to your needs? Here is it!
Say you want a resolution set to 1600x1200 at 75Hz, you use gtf tool to output a Modeline that'll be used in xorg later:

Code: Select all
$ gtf 1600 1200 75

# 1600x1200 @ 75.00 Hz (GTF) hsync: 93.97 kHz; pclk: 205.99 MHz
Modeline '1600x1200_75.00' 205.99 1600 1720 1896 2192 1200 1201 1204 1253 -HSync +Vsync


Now, open your xorg.conf, then find Section 'Monitor' then add those two lines as in the following -example- code:

Code: Select all
Section 'Monitor'
Identifier 'Configured Monitor'
Modeline '1600x1200_75.00' 205.99 1600 1720 1896 2192 1200 1201 1204 1253 -HSync +Vsync
Option 'PreferredMode' '1600x1200_75.00'
EndSection


Then, find Section 'Screen' and add this example code:

Code: Select all
Section 'Screen'
Identifier 'Default Screen'
Monitor 'Configured Monitor'
DefaultDepth 24
SubSection 'Display'
Depth 24
Modes '1600x1200_75.00'
EndSubSection
EndSection


Be sure that Modes string is the same as above!

... And that's all? I hope so, let's save this file and restart your X server."

Tuesday, August 11, 2009

Monday, August 10, 2009

blogger - Google Blog Search

blogger - Google Blog Search: "scobleizer"

How to Update Joomla 1.5 Versions

How to Update Joomla 1.5 Versions: "Now, let's say you're running Joomla! 1.5.3 and you want to update to Joomla! 1.5.7
You can access the Joomla! update listing at http://joomlacode.org/gf/project/joomla/frs/. Copy the link location to Joomla_1.5.3_to_1.5.7-Stable-Patch_Package.tar.gz and type:
wget http://joomlacode.org/gf/download/frsrelease/8375/31007/Joomla_1.5.3_to_1.5.7-Stable-Patch_Package.tar.gz

wget is a command to download a package file from another server to your server.

Now type:
gzip -d Joomla_1.5.3_to_1.5.7-Stable-Patch_Package.tar.gz
The tar.gz file now has a .tar extension so type:
tar -xvf Joomla_1.5.3_to_1.5.7-Stable-Patch_Package.tar

The package is extracted and Joomla! is updated. If all goes well and Joomla! appears to be stable, you can delete the site_backup.tar file form your server."

Thursday, August 6, 2009

How to check CPU load in command line - Ubuntu Forums

How to check CPU load in command line - Ubuntu Forums: "How to check CPU load in command line
top displays all sorts of CPU/Memory/Process information.

I believe that there is also ntop for monitoring network stuff but I've never used this myself.

free -m will show you stats about RAM usage in MB

uptime will show you the load average for the past 1min, 5mins and 15mins

cat /proc/cpuinfo will give you general information about the CPU(s)"

Wednesday, August 5, 2009

IOL Jobs :: Advice & News

IOL Jobs :: Advice & News: "The seven attributes of success
Adriaan Groenewald
05 August 2009 at 06h00
I attended the Discovery Invest Leadership Summit on July 22. There were some prominent speakers, including Adrian Gore, Wendy Luhabe, Malcolm Gladwell, Richard Branson, Mathews Phosa and others.

Overall the day was very interesting. In this column, however, I want to focus on the contribution of Adrian Gore, Discovery's CEO.

He discussed seven simple attributes, which, according to him, successful individuals or leaders possess and often support with actuarial argument or thinking, in a way that even I could understand.

I will never be able to convey the seven attributes as he did but, in brief, I will do my best.

He believes that successful people/leaders:

1. Are positive and optimistic: This does not mean they walk around with a smile and never see the obstacles or challenges. They have an innate belief that they can find a way. They have a positive disposition and, therefore, invariably make better decisions.

2. Set dreams and goals: Common sense, which we all understand intellectually, unfortunately is not always common practice. They make time to dream, think big and then set goals to get there.

3. Have a sense of urgency: An innate understanding that time is limited and therefore act accordingly. It is so true that some people live as though they will be on this earth forever.

Gore used the example that when one turns 40 one tends to believe that there is still 50 percent of life left over. But this is not true. Think of it this way. As a young child the third year in your life felt exceptionally long.

Why? Because when you looked at it in context it was in fact one third of your life.

When you turned 10, a year was one tenth of your life, which means a year felt shorter than when you were three, but it still felt long. The, when you turn 40 - as I did over a year ago - a year goes much faster because it is one fortieth of your life, and so on.

Actuarially, at the age of 40 when one analyses this philosophy, more than 80 percent of one's life is actually past and this does not even take into account the fact that one's health and often energy starts deteriorating. The moral of the story is that you have less time than you think you have, so make the best of it!

4. Never stop learning: Successful people keep learning new things. An interesting principle to consider here is that the more you learn the more your capacity to learn even more increases.

An example is that one's first semester of year three at university often has as much work as one's entire first year had. So, the more we learn, the more we are able to learn. This principle counterbalances the age challenge in a way. In other words, while time and health may deteriorate quickly, we can make up for this by acquiring more knowledge and wisdom.

5. Persistent: Successful leaders always feel they can squeeze out more time, productivity, profit or whatever. Gore played a video in which Tim Noakes addressed the audience on research which proved that getting tired during exercise is 'all in the head'.

This means that athletes can almost always do more. Successful leaders always persist in trying to do more themselves and in getting others to achieve more.

6. The power of innovation: In essence, successful people are almost always different to the norm. So, to be successful one must be different, which means by implication that innovation plays a critical role in being successful.

7. Integrity and honesty: I have written a lot about this and the link between integrity, honesty and being authentic. To be successful one sacrifices a great deal, and to make all this worthwhile one had better be proud of what one does and how one gets there.

If not, how does one look at oneself in the mirror?

Perhaps we can somehow arrange another event where Adrian Gore can speak of these attributes. It really is worthwhile hearing him speak."

Useful tip: Run LiveCD and eject CD - Knoppix.net

Useful tip: Run LiveCD and eject CD - Knoppix.net: "Now we can copy to HD / RAM while running from CD, which basically also allows changing the applications that run from the CD! Changing is just limited by the number of cloop devices, which is sad :-/ due to a bug (?) in cloop ...

Code:

# copy to HD
mount /mnt/hda6
rsync -avP /cdrom/KNOPPIX /mnt/hda6/

# load from HD
losetup /dev/cloop1 /mnt/hda6/KNOPPIX/KNOPPIX
mount /dev/cloop1 /KNOPPIX

# remove CD
umount -l /cdrom
eject /dev/cdrom

# fill in /cdrom again (optional)
# either through --move or --bind
mount --bind /mnt/hda6 /cdrom



Thats it.

Possibilities are of course again unlimited. This could create an ISO on the fly from the CD and then insert it, copy to NTFS partitions and whatever you have not even thought of.

I'm still working on a solution to put out the CD cleanly without risking cloop to not be able to read some blocks ... (when you can't change to another backing device)

Possibly you could just copy (e.g. videoplayer) whats necessary to ramdisk and then run from there ...

cu

Fabian"

Tuesday, August 4, 2009

Extension Manager : Install

Extension Manager : Install: "This component rewrites Joomla! URLs to be Search Engine Friendly. It has plugins, for handling various components, can work without .htaccess, build up meta tags automatically or manually, and more. Please note this is still beta software, which means that we are still in the debugging process and some functions or behaviors may change in next version.
sh404SEF installed succesfully! Please read the following
If it is the first time you use sh404SEF, it has been installed but is disabled right now. You must first edit sh404SEF configuration (from the sh404SEF Components menu item of Joomla backend), enable it and save before it will become active. Before you do so, please read the next paragraphs which have important information for you. If you are upgrading from a previous version of sh404SEF, then all your settings have been preserved, the component is activated and you can start browsing your site frontpage right away.

IMPORTANT : sh404SEF can operate under two modes : WITH or WITHOUT .htaccess file. The default setting is now to work without .htaccess file. I recommend you use it if you are not familiar with web servers, as it is generally difficult to find the right content for a .htaccess file.

Without .htaccess file : simply go to sh404SEF configuration screen, review parameters, and save config. You can now browse the frontpage of your site to start generating SEF URL.
With .htaccess : you must activate this operating mode. To do so, go to sh404SEF configuration, select the Advanced tab, locate the 'Rewrite mode' drop-down list and select 'with .htaccess'. Then Save configuration and answer Ok when prompted to erase URl cache. However, before you can activate sh404SEF, you have to setup a .htaccess file. This file content depends on your hosting setup, so it is nearly impossible to tell you what should be in it. Joomla comes with the most generic .htaccess file. It will probably work right away on your system, or may need adjustments. The Joomla supplied file is called htaccess.txt, is located in the root directory of your site, and must be renamed into .htaccess before it will have any effect. You will find additional information about .htaccess at extensions.Siliana.com/.

IMPORTANT: sh404SEF can build SEF URL for many Joomla components. It does it through a 'plugin' system, and comes with a dedicated plugin for each of Joomla standard components (Contact, Weblinks, Newsfeed, Content of course,...). It also comes with native plugins for common components such as Community Builder, Fireboard, Virtuemart, Sobi2,... (full list on our web site). sh404SEF can also automatically make use of plugins designed for other SEF components such as OpenSEF or SEF Advanced. Such plugins are often delivered and installed automatically when you install a component. Please note that when using these 'foreign' plugins, you may experience compatibility issues.
However, Joomla having several hundreds extensions available, not all of them have a plugin to tell sh404SEF how its URL should be built. When it does not have a plugin for a given component, sh404SEF will switch back to Joomla 1.0.x standard SEF URL, similar to mysite.com/component/option,com_sample/task,view/id,23/Itemid,45/. This is normal, and can't be otherwise unless someone writes a plugin for this component (your assistance in doing so is very much welcomed! Please post on the support forum if you have written a plugin for a component).

You will also find more documentation, including on how to write plugins for sh404SEF at extensions.Siliana.com

Please read the documentation : it is available on sh404SEF main control panel"

Monday, August 3, 2009

APT HOWTO - Basic Configuration

APT HOWTO - Basic Configuration: "2.2 How to use APT locally

Sometimes you have lots of packages .deb that you would like to use APT to install so that the dependencies would be automaticaly solved.

To do that create a directory and put the .debs you want to index in it . For example:

mkdir /root/debs

So, inside the directory /root, create an empty file, with any name. That is because an APT repository needs a file known as 'override', it may be empty, but it has to exist. One may use the following command to create this file:

touch file

Inside this file you may want to define some options to override the ones the ones that come with the package. It looks like follows:

package priority section

package is the name of the package, priority is low, medium or high and section is the section to which it belongs. It is enough to leave the file empty/

Still in the /root directory do:

dpkg-scanpackages debs file | gzip > debs/Packages.gz

In the above line, file is the 'override' file, the command generates a file debs/Packages.gz that contains various informations about the packages, which are used by APT. To use the packages, finally, add:

deb file:/root debs/

After that just use the APT commands as usual. You may also generate a sources repository. To do that use the same procedure, but remember that you need to have the files .orig.tar.gz, .dsc and .diff.gz in the directory and you have to use Sources.gz instead of Packages.gz. The program used is also different. It is the dpkg-scansources. The command line will look like this:

dpkg-scansources debs | gzip > debs/Sources.gz

Notice that dpkg-scansources doesn't need an 'override' file. The sources.list's line is:

deb-src file:/root debs/"

Web - Setting Joomla Directory Permissions

Web - Setting Joomla Directory Permissions: "Setting Joomla Directory Permissions
Topic: Web Posted:2006-08-13
Printer Friendly: Print

spacerspacer
The main thing that needs to be changed during a Joomla install is the directory permissions. Here is a shot of the install application before fixing the permissions:

administrator/backups Unwriteable
administrator/components Unwriteable
administrator/modules Unwriteable
administrator/templates Unwriteable
cache Unwriteable
components Unwriteable
images Unwriteable
images/banners Unwriteable
images/stories Unwriteable
language Unwriteable
mambots Unwriteable
mambots/content Unwriteable
mambots/editors Unwriteable
mambots/editors-xtd Unwriteable
mambots/search Unwriteable
mambots/system Unwriteable
media Unwriteable
modules Unwriteable
templates Unwriteable


Here is the sequence of commands to set the permissions for the web server account (apache):

chgrp apache administrator/backups
chgrp apache administrator/components
chgrp apache administrator/modules
chgrp apache administrator/templates
chgrp apache cache
chgrp apache components
chgrp apache images
chgrp apache images/banners
chgrp apache images/stories
chgrp apache language
chgrp apache mambots
chgrp apache mambots/content
chgrp apache mambots/editors
chgrp apache mambots/editors-xtd
chgrp apache mambots/search
chgrp apache mambots/system
chgrp apache media
chgrp apache modules
chgrp apache templates
chmod g+w administrator/backups
chmod g+w administrator/components
chmod g+w administrator/modules
chmod g+w administrator/templates
chmod g+w cache
chmod g+w components
chmod g+w images
chmod g+w images/banners
chmod g+w images/stories
chmod g+w language
chmod g+w mambots
chmod g+w mambots/content
chmod g+w mambots/editors
chmod g+w mambots/editors-xtd
chmod g+w mambots/search
chmod g+w mambots/system
chmod g+w media
chmod g+w modules
chmod g+w templates


Now the installation check looks like this:

administrator/backups Writeable
administrator/components Writeable
administrator/modules Writeable
administrator/templates Writeable
cache Writeable
components Writeable
images Writeable
images/banners Writeable
images/stories Writeable
language Writeable
mambots Writeable
mambots/content Writeable
mambots/editors Writeable
mambots/editors-xtd Writeable
mambots/search Writeable
mambots/system Writeable
media Writeable
modules Writeable
templates Writeable"

Techy Title Here: Benchmarking Untangle Gateway

This summary is not available. Please click here to view the post.

Authenticate to Active Directory with Ubuntu

Authenticate to Active Directory with Ubuntu: "Authenticate to Active Directory with Ubuntu
Friday, 10 July 2009 08:04 John Ciacia

While Linux is a fantastic operating system, when it comes to user rights management, Active Directory is far superior than anything Linux currently implements. As a result many businesses and organizations implement the technology. For a longtime it was extremely difficult to get a Linux operating system to authenticate with active directory--configuring multiple services and managing to get them to work with each other, let alone work with Windows was a task best left for those with years of Linux administration experience. However, in recent years as Linux has become more user friendly, and it should be no surprise that authenticating with active directory has become easy too. In the past few days I have been working with an Open Source software called likewise-open which is in the official Ubuntu repositories. Below is a quick guide to getting started and some tips/issues I have found.
Authenticating with likewise-open 4.1 (from Ubuntu 8.04 Repository)

1. Install likewise-open

# sudo apt-get install likewise-open

2. Join the domain

# sudo domainjoin-cli join your.fqdn domain_admin

For example:

# sudo domainjoin-cli join example.com Administrator

REBOOT
3. Update rc.d

# sudo update-rc.d likewise-open defaults

4. 4. Start likewise-open

# sudo /etc/init.d/likewise-open start

Using the Default Domain with likewise-open 4.1

To use the default domain (and avoid using DOMAIN\user to login) append the following line to /etc/samba/lwiauthd.conf

winbind use default domain = yes

Authenticating with likewise-open 5.1 (from Ubuntu 9.04 Repository)

1. Install likewise-open5

# sudo apt-get install likewise-open5

2. Join the domain

# sudo domainjoin-cli join your.fqdn domain_admin

For example:

# sudo domainjoin-cli join example.com Administrator

REBOOT
3. Update rc.d

# sudo update-rc.d likewise-open defaults

4. Start likewise-open

# sudo /etc/init.d/lsassd start

Using the Default Domain with likewise-open 5.1

To use the default domain (and avoid using DOMAIN\user to login) uncomment the following line in /etc/likewise-open5/lsassd.conf

assume-default-domain = yes

Giving Domain Administrators sudo Privileges

Append the following line to /etc/sudoers

%your.fdqn\\domain^admins ALL=(ALL) ALL

Known Issues

* After rebooting the computer and logging in you are given the error “Domain Controller unreachable, using cached credentials instead. Network rsource may be unavailable.” Likewise does not start correctly. You have to login as a local admin and run the following command and then users will be able to login.

# sudo /etc/init.d/likewise-open restart

Issue seems to be resolved with likewise-open5

* If you are having issues authenticating wirelessly, make sure your wireless connection is established. In many instances, wireless will only connect after you login.
* Samba does not hide hidden windows shares

This article was reprinted with permission from John Ciacia's blog."

Manage your Active Directory from Linux with adtool

Manage your Active Directory from Linux with adtool: "Manage your Active Directory from Linux with adtool

Active Directory is one of those Microsoft tools that so many have no choice but to use. Although I much prefer LDAP because it is so much easier to set up and manage. But for much of the enterprise world Active Directory is the tool used. Does this mean you are locked into managing Active Directory from a Windows machine? No. If you are a creature of the command line you can manage your AD from the Linux command line. It’s not that difficult and, in the end, will give you many more options to keep your AD server managed.

Of course it is not just a matter of working on the Linux end of things. There is one issue to settle on the MS end. You have to activate Secure LDAP on your AD Server. This process goes beyond the scope of this article, but the steps are pretty clear.

Enable SLDAP

Here are the steps to enable Secure LDAP on your Windows 2003 AD server (I will leave out the details):

1. Create an Active Directory domain controller certificate request.
2. Create a Certification Authority.
3. Sign the certificate request by the Certification Authority.
4. Export the root certificate Certification Authority.
5. Import the root certificate Certification Authority onto the Domain Controller.
6. Import the LDAP Server certificate onto the Domain Controller.
7. Set up the UMRA (LDAP Client) computer.
8. Verify Secure LDAPS using SSL.

Installing adtool

Fortunately adtool will be found in your distributions’ repositories. So all you have to do is follow these steps:

1. Fire up Synaptic (or whichever Add/Remove Software utility you use).
2. Do a search for “adtool” (no quotes).
3. Mark the results for installation.
4. Click Apply to install.
5. Close Synaptic.

Configuring adtool

This is a bit of configuration you need to handle before you can use adtool on your AD server. First create the file (if it doesn’t exist) /etc/adtool.cfg and add the following contents:

uri ldaps://YOUR.DOMAIN.HERE
binddn cn=Administrator,cn=Users,dc=domain,dc=tld
bindpw $PASSWORD
searchbase dc=domain,dc=tld

Where YOUR.DOMAIN.HERE is the actual address to your Active Directory server.

Where PASSWORD is the password for the AD user that has proper permissions to manage the AD server.

You will also need to make sure the following is in your /etc/ldap/ldap.conf file:

BASE dc=YOUR,dc=DOMAIN,dc=HERE
URI ldaps://YOUR.DOMAIN.HERE
TLS_REQCERT allow

Without the above configuration you will not be able to accept the SSL certificates from the server.

Basic usage

The basic usage of the adtool command is simple. Of course you will have to understand Active Directory in order to really understand the usage of this tool. Below I will give you samples of commands to handle the basic tasks for AD. Any information in ALL CAPS would be altered to fit your needs.

Create a new organizational unit:

adtool oucreate ORGANIZATION NAME ou=user,dc=DOMAIN,dc=COM

Add a user:

adtool useradd USER ou=ORGANIZATION ou=user,cd=DOMAIN,dc=COM

Set a user password:

adtool setpass USER PASSWORD

Unlock a user:

adtool unlock USER

Create a group

adtool groupcreate GROUP ou=user,cd=DOMAIN,dc=COM

Add a user to a group:

adtool groupadd allusers USER

Add an email address for the user:

adtool attributereplace USER mail EMAIL@ADDRESS

Final thoughts

We’ve only really scratched the surface of this powerful tool. But from this you should be able to see how easy adtool can be as well as how helpful it is."

Saturday, August 1, 2009

Gnome - change vino server password

Gnome - change vino server password: "Gnome - change vino server password


This guide is based on a Fedora 9 install.
All commands are run from a user account and not root.

To check current vino server settings

cat ~/.gconf/desktop/gnome/remote_access/%gconf.xml


To change the current vino server password

NewPassword=`echo -n 'newpassword' | base64`
gconftool-2 --type string --set /desktop/gnome/remote_access/vnc_password $NewPassword


Restart the vino server

gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled false
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true"

Shell script to change password - LinuxQuestions.org

Shell script to change password - LinuxQuestions.org: "And now, I've found what does work for me, in my limited case of what I needed. If this solution works for you too, then here it is:

Code:

echo [passwd] > /tmp/[password file]
passwd --stdin [user] < [file with password]"

Create Users And Change Passwords With A Bash Script | HowtoForge - Linux Howtos and Tutorials

Create Users And Change Passwords With A Bash Script | HowtoForge - Linux Howtos and Tutorials: "Create Users And Change Passwords With A Bash Script
Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by fakrul (Contact Author) (Forums) on Fri, 2007-03-16 16:33. :: Linux
Create Users And Change Passwords With A Bash Script

These two scripts are very important for the system admin who regularly works with mail servers and somehow forgets to backup his system username and password! Let’s say somehow we lost the usernames and passwords of the mail server. In this case the admin has to manually create all the users and then change the passwords for all the users. Tedious job. Let’s make our life easier.

First create a file which contains all the user name. Something like this:

nurealam
nayeem
mrahman
farid
rubi
sankar

Save the file as userlist.txt. Now create the following bash file:

#!/bin/sh
for i in `more userlist.txt `
do
echo $i
adduser $i
done

Save the file and exit.

chmod 755 userlist.txt

Now run the file:

./userlist.txt

This will add all the users to the system. Now we have to change the passwords. Let's say we want username123 as password. So for user nayeem the password will be nayeem123, rubi123 for user rubi and so on.

Create another bash file as follows:

#!/bin/sh
for i in `more userlist.txt `
do
echo $i
echo $i'123' | passwd –-stdin '$i'
echo; echo 'User $username’s password changed!'
done

Run the file. All the passwords are changed."

Changing password via a script - The solution

Changing password via a script - The solution: "Changing password via a script
Bookmark Bookmark & Share
Last update on October 29, 2008 06:44 AM by jak58
Published by jak58

Changing password via a script

*
o Method 1: passwd
o Method 2: chpasswd




Method 1: passwd

Conventionally the command use to change password on Linux based system is passwd
, the option related to this command is รข€“stdin ,an this is all done throughout a pipe.

echo -e 'new_password\nnew_password' | (passwd --stdin $USER)


Method 2: chpasswd

Another alternative is to use the chpasswd, explain as below:

echo 'password:name' | chpasswd



Note that the first method can be use to change psssword on Samba based system:

echo -e 'new_password\nnew_password' | (smbpasswd -a -s $USER)"

tips [Splashy]

tips [Splashy]: "update-initramfs -u -t -k `uname -r`"

Thursday, July 30, 2009

Recursive touch - I blog, therefore I am

Recursive touch - I blog, therefore I am: "Recursive touch
Published on Sat 30 Jun 2007 06:06 ( 2 years, 1 month ago)
Shell script Linux/Unix

'touch' is a unix command used to change the time of a file or directory, touch a directory will not touch the files inside.

To touch recursively, it's simple with the help of 'find' and 'xargs':

e.g.



find . | xargs touch


will touch all files and directories recursively under current directory.

Since directory or filename may contain spaces, the shell script need some additional parameteres:



find '$1' -type f -print0 | xargs -0 touch"

Tips For Linux - Understanding file permissions and modifying them using chmod - Page 2

Tips For Linux - Understanding file permissions and modifying them using chmod - Page 2: "Frequently used numeric parameters for chmod
755
The general preferred permissions for almost all the files on your disk
700
Extremely private data
500
Extremely private data that you would not like to accidentally modify. So write protect it
775
General files used when working as a Group (Others can only view/execute your files)
770
Important files used when working as a Group (Others cannot do anything with your files)
750
Allowing group to view your files but no write access (Others cannot do anything with your files)
777
Something you should never want to do ;-)"