sâmbătă, 28 ianuarie 2012

What is swappiness and how do I change it?

The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.

* swappiness can have a value of between 0 and 100
* swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
* swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache

The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.

To check the swappiness value

cat /proc/sys/vm/swappiness

To change the swappiness value A temporary change (lost on reboot) with a swappiness value of 10 can be made with

sudo sysctl vm.swappiness=10

To make a change permanent, edit the configuration file with your favorite editor:

gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10

Save the file and reboot.

How can I move the ubuntu window buttons to the top right of the window?

In this version Ubuntu 11.10 the close, maximize and minimize window buttons are placed at the top left of the window. If you would prefer them to be at the top right of the window, as in previous versions of Ubuntu and Windows, then follow these instructions:

  1. Press Alt+F2 to open the Run Application window.

  2. Type gconf-editor into the text box and click Run to start the Configuration Editor.

  3. Open /apps/metacity/general using the side pane and double-click the button_layout item.

  4. Change the value to say

    :minimize,maximize,close

    (the position of the colon determines which side of the window the buttons appear on).

  5. Click OK and the location of the windows buttons will change immediately.

Spice Up Ubuntu/Linux Terminal With Quotes ( or motd) Each Time It Is Started

Terminal can be boring at times. What if we could add little fun factor to dull terminal? That is what I was wondering since last few days. On Ubuntu/Linux a dynamic message just like motd or to be precise a welcome message can be displayed each time you start a terminal instance even when in GUI mode ( whereas /etc/motd message is shown only on tty or at remote logins.)

For example, greeting like in following image each time you start terminal :

terminal-cowsay0

Installation :

We are going to use two programs namely “fortune” which generates random quotes and “cowsay” which adds some pictures with bubble over its head, just like in cartoons published in newspapers.

sudo aptitude install fortune cowsay


Configuration :

Sample run of “fortune | cowsay -n”

terminal-cowsay1


If you wish to see messages like above but random ones each time you start a new Terminal, you have to edit /etc/bash.bashrc file. Open it with root privileges,

gksudo gedit /etc/bash.bashrc

and add following lines at the end of the file

# Spicing up Terminal fortune | cowsay -n echo

Open new Terminal instance and the quote/motd should be displayed.


Further Customization :

If you want to have static greeting message, add following at the end of /etc/bash.bashrc file

# Spicing up Terminal cowsay YourTextHere echo

which produces :

terminal-cowsay2


cowsay comes with more fun pictures. The list can be found at /usr/share/cowsay/cows/

terminal-cowsay3


If you like any of above cartoons, then your modified line to be added in /etc/bash.bashrc file will be :

fortune | cowsay -n -f tux.cow

terminal-cowsay4

Get randomized cows each time:


Enjoy your new spicy Terminal!

joi, 26 ianuarie 2012

TestDisk, Data Recovery


TestDisk is a powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.

TestDisk can

* Fix partition table, recover deleted partition
* Recover FAT32 boot sector from its backup
* Rebuild FAT12/FAT16/FAT32 boot sector
* Fix FAT tables
* Rebuild NTFS boot sector
* Recover NTFS boot sector from its backup
* Fix MFT using MFT mirror
* Locate ext2/ext3 Backup SuperBlock
* Undelete files from FAT, NTFS and ext2 filesystem
* Copy files from deleted FAT, NTFS and ext2/ext3 partitions.

TestDisk has features for both novices and experts. For those who know little or nothing about data recovery techniques, TestDisk can be used to collect detailed information about a non-booting drive which can then be sent to a tech for further analysis. Those more familiar with such procedures should find TestDisk a handy tool in performing onsite recovery.
Operating systems

TestDisk can run under

* DOS (either real or in a Windows 9x DOS-box),
* Windows (NT4, 2000, XP, 2003, Vista),
* Linux,
* FreeBSD, NetBSD, OpenBSD,
* SunOS and
* MacOS

Source files and precompiled binary executables are available for DOS, Win32, MacOSX and Linux from the download page
Filesystems

TestDisk can find lost partitions for all of these file systems:

* BeFS ( BeOS )
* BSD disklabel ( FreeBSD/OpenBSD/NetBSD )
* CramFS, Compressed File System
* DOS/Windows FAT12, FAT16 and FAT32
* Windows exFAT
* HFS, HFS+ and HFSX, Hierarchical File System
* JFS, IBM's Journaled File System
* Linux ext2 and ext3
* Linux LUKS encrypted partition
* Linux RAID md 0.9/1.0/1.1/1.2
o RAID 1: mirroring
o RAID 4: striped array with parity device
o RAID 5: striped array with distributed parity information
o RAID 6: striped array with distributed dual redundancy information
* Linux Swap (versions 1 and 2)
* LVM and LVM2, Linux Logical Volume Manager
* Mac partition map
* Novell Storage Services NSS
* NTFS ( Windows NT/2000/XP/2003/Vista/2008/7 )
* ReiserFS 3.5, 3.6 and 4
* Sun Solaris i386 disklabel
* Unix File System UFS and UFS2 (Sun/BSD/...)
* XFS, SGI's Journaled File System
Conclusions and how to use:
this tool can be used from ubuntu live cd and then installed using internet connection or you can use an ubuntu rescue remix live cd and there is a lot of documentation on how to use it here is a formel documication from ubuntu on how to use

TestDisk on Live rescue CDs

TestDisk (not always the latest version) is included on the following free rescue CDs:

Note, TestDisk is also available on or under the following distributions, many of which have a console/rescue mode that can be used to run TestDisk or PhotoRec:

If you are new to Linux, you should read the Introduction to the Unix command line.

TestDisk on a Bootdisk

Download

Latest version of TestDisk is available from the download page


Setup Samba Server In Ubuntu


This tutorial will I will be teaching you how to setup Samba Server on Ubuntu. Using a Samba Server to share files between your Ubuntu and Windows computers, this is one of the best and easiest ways to accomplish this. So lets get started and install the required packages by running the following command.

sudo apt-get install samba

This should install the required packages however we still need to configure Samba Server so lets open up smb.conf in gedit.

sudo gedit /etc/samba/smb.conf

Now lets change the following two values in the Samba Server config.

workgroup = WORKGROUP

At the bottom of the Samba Server config add this and modify it to your needs.

[share]
comment = Ubuntu File Server Share
path = /srv/samba/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755

Now all thats left is to create the Samba Server directory and restart the Samba Services, simply go into an open Terminal and run the following commands.

sudo mkdir -p /srv/samba/share
sudo chown nobody.nogroup /srv/samba/share/
sudo restart smbd
sudo restart nmbd

Congrats! You now have a fully functional Ubuntu Samba Server!


How to install Burg boot loader in Ubuntu 11.04 and 11.10 “Oneiric Ocelot”

How to install Burg boot loader in Ubuntu 11.04 and 11.10 “Oneiric Ocelot”

Burg is a brand-new boot loader based on GRUB. It uses a new object format which allows it to be built in a wider range of OS, including Linux/Windows/OSX/Solaris/FreeBSD, etc. It also has a highly configurable menu system which works in both text and graphic mode. In this post we will show you how to install Burg in Ubuntu 11.04 natty Narhwal.
To Install Burg in Ubuntu 11.04 Natty Narwhal and Ubuntu 11.10 11.10 “Oneiric Ocelot”, Open termianl and enter the following commands :

sudo add-apt-repository ppa:n-muench/burg
sudo apt-get update
sudo apt-get install burg burg-themes

Now to make BURG integrate the HardDisk enter the following command in terminal:

sudo burg-install "(hd0)"

Remember to substitute ‘hd0′ with the drive on which your MBR is installed.

Now update burg:

sudo update-burg

Finally, run the following to test and set your theme:

sudo burg-emu


Press F2 To change theme .

Press F3 to change resolution

If you want to use another easy way to configue burg, you need to install Burg- manager, for this check our previuos post.

Here are the hot-keys defined in the boot menu:

t – Open theme selection menu
f – Toggle between folding mode
n – Jump to the next item with the same class
w – Jump to the next Windows item
u – Jump to the next Ubuntu item
e – Edit the command of current boot item
c – Open a terminal window
2 – Open two terminal windows
h – Display help dialog (only available in sora theme)
i – Display about dialog (only available in sora theme)
q – Return to old grub menu
F5/ctrl-x – Finish edit
F6 – Switch window in dual terminal mode
F7 – List the folded boot items
F8 – Toggle between graphic and text mode
F9 – shutdown
F10 – reboot
ESC – quit from the current popup menu or dialog.

Move Window Buttons Back To Right Side Ubuntu 11.10

If you are like me, then you can’t stand having the window buttons on the wrong side in Ubuntu 11.04 and up. To change the window buttons to the right side its actually a lot easier than you would have thought. Just follow these instructions and your buttons will be where they belong in a matter of minutes.

Run the following command in terminal.

gconf-editor

Now in gconf-editor navigate to “apps/metacity/general“. Inside the general folder there should be a key called “button_layout” simply change the value to this to the following. You can also change the order of the buttons if you like.

menu:minimize,maximize,close

Thats it, you can now close gconf-editor and your buttons will be fixed.

duminică, 8 ianuarie 2012

PostfixAmavisNew

PostfixAmavisNew

Introduction


In this howto, Postfix integration with amavis-new will be presented. Amavis-new is a wrapper that can call any number of content filtering programs for spam detection, antivirus, etc. In this howto, integration with Spamassassin and Clamav will be presented. This is a classical installation of Postfix + Amavis-new + Spamassassin + Clamav.


Prerequisite

You should have a functional Postfix server installed. If this is not the case, follow the Postfix guide.


Installation

To begin, install (see InstallingSoftware) the following packages:


sudo apt-get install amavisd-new spamassassin clamav-daemon

Install the optional packages for better spam detection (who does not want better spam detection?):


sudo apt-get install libnet-dns-perl libmail-spf-query-perl pyzor razor

Install these optional packages to enable better scanning of attached archive files:


sudo apt-get install arj bzip2 cabextract cpio file gzip lha nomarch pax rar unrar unzip unzoo zip zoo

Configuration

Clamav

The default behaviour of Clamav will fit our needs. A daemon is launched (clamd) and signatures are fetched every day. For more Clamav configuration options, check the configuration files in /etc/clamav.


Add clamav user to the amavis group and vice versa in order for Clamav to have access to scan files:


sudo adduser clamav amavis

sudo adduser amavis clamav

Spamassassin

Spamasssassin autodetects optional components and will use them if they are present. This means that there is no need to configure dcc-client, pyzor and razor.


The fine tuning of Spamassassin rules is beyond the scope of this guide. Please refer to the Spamassassin page.


Edit /etc/default/spamassassin to activate the Spamassassin daemon change ENABLED=0 to:


ENABLED=1

and to enable automatic rule updates change CRON=0 at the bottom to:


CRON=1

Now start Spamassassin:


sudo /etc/init.d/spamassassin start

Amavis

First, activate spam and antivirus detection in Amavis by editing /etc/amavis/conf.d/15-content_filter_mode:



use strict;


# You can modify this file to re-enable SPAM checking through spamassassin

# and to re-enable antivirus checking.


#

# Default antivirus checking mode

# Uncomment the two lines below to enable it

#


@bypass_virus_checks_maps = (

\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);



#

# Default SPAM checking mode

# Uncomment the two lines below to enable it

#


@bypass_spam_checks_maps = (

\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);


1; # insure a defined return

After configuration Amavis needs to be restarted:


sudo /etc/init.d/amavis restart


Postfix integration

For postfix integration, you need to add the content_filter configuration variable to the Postfix configuration file/etc/postfix/main.cf. This instructs postfix to pass messages to amavis at a given IP address and port:


content_filter = smtp-amavis:[127.0.0.1]:10024


The following postconf command, run as root because of the preceding sudo command, adds the content_filter specification line above to main.cf:


sudo postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024"


Alternatively, you can manually edit main.cf yourself to add the content_filter line.


Next edit /etc/postfix/master.cf and add the following to the end of the file:


smtp-amavis unix - - - - 2 smtp

-o smtp_data_done_timeout=1200

-o smtp_send_xforward_command=yes

-o disable_dns_lookups=yes

-o max_use=20


127.0.0.1:10025 inet n - - - - smtpd

-o content_filter=

-o local_recipient_maps=

-o relay_recipient_maps=

-o smtpd_restriction_classes=

-o smtpd_delay_reject=no

-o smtpd_client_restrictions=permit_mynetworks,reject

-o smtpd_helo_restrictions=

-o smtpd_sender_restrictions=

-o smtpd_recipient_restrictions=permit_mynetworks,reject

-o smtpd_data_restrictions=reject_unauth_pipelining

-o smtpd_end_of_data_restrictions=

-o mynetworks=127.0.0.0/8

-o smtpd_error_sleep_time=0

-o smtpd_soft_error_limit=1001

-o smtpd_hard_error_limit=1000

-o smtpd_client_connection_count_limit=0

-o smtpd_client_connection_rate_limit=0

-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks

Also add the following two lines immediately below the "pickup" transport service:


-o content_filter=

-o receive_override_options=no_header_body_checks


This will prevent messages that are generated to report on spam from being classified as spam.


More information can be found from "README.postfix from amavisd-new" and "D.J.Fan"


Reload postfix:


sudo /etc/init.d/postfix reload


Now content filtering with spam and virus detection is enabled.


Test

First, test that the amavis SMTP is listening:


telnet localhost 10024

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 [127.0.0.1] ESMTP amavisd-new service ready

^]


Check on your /var/log/mail.log that everything goes well. If you raise the log level, you can check every step of the content filtering: spam check, virus check, etc. Don't forget to lower the log level after your checks!


On messages that go through the content filter you should see:


X-Spam-Level:

X-Virus-Scanned: Debian amavisd-new at example.com

X-Spam-Status: No, hits=-2.3 tagged_above=-1000.0 required=5.0 tests=AWL, BAYES_00

X-Spam-Level:

Note: $sa_tag_level in /etc/amavis/conf.d/20-debian_defaults must be lower than spam hit rating for the header to appear on the message. For troubleshooting set $sa_tag_level to -999


Troubleshooting

If the filtering is not happening, adding the following to /etc/amavis/conf.d/50-user may help:



@local_domains_acl = ( ".$mydomain" );

If you receive mail for other domains, add them to the list. This information was obtained from the Amavis-New FAQ here.


If you see the following error in /var/log/syslog when amavisd is trying to scan a message:


amavis[30807]: (30807-01) (!!) ask_av (ClamAV-clamd) FAILED - unexpected result: /var/lib/amavis/tmp/amavis-20070615T125025-30807/parts: lstat() failed. ERROR\n


Try changing the permissions on /var/lib/amavis/tmp:



chmod -R 775 /var/lib/amavis/tmp


Another way to trouble shoot errors associated with Amavisd-new, Spamassassin, Postfix, or Clamav is to restart all the services with Amavisd-new being the last one to start:


sudo /etc/init.d/postfix restart

sudo /etc/init.d/spamassassin restart

sudo /etc/init.d/clamav-daemon restart

sudo /etc/init.d/amavis restart


Then check /var/log/mail.log and see if the error has gone away.


Note: $sa_tag_level in /etc/amavis/conf.d/20-debian_defaults must be lower than spam hit rating for the header to appear on the message. For troubleshooting set $sa_tag_level to -999


Amavis Performance

To increase the number of processes that amavisd-new uses above the default 2 edit the file /etc/amavis/conf.d/50-user inserting the line:


$max_servers = X;

above the line:


#------------ Do not modify anything below this line -------------

where X is the number of processes you wish amavis to use.


Amend the following line in /etc/postfix/master.cf with the same value for the max_procs (marked below as X)


smtp-amavis unix - - - - X smtp


Restart amavis and reload postfix's config


sudo /etc/init.d/amavis restart

sudo postfix reload


You can check the configuration change has taken affect by running amavisd-nanny:


sudo amavisd-nanny


For guidance on how many processes to set this value to please see:


zcat /usr/share/doc/amavisd-new/README.performance.gz | less and




Note: This guide has been tested on Ubuntu 7.10 (Gutsy Gibbon) and Ubuntu 10.04 LTS Server (Lucid Lynx)

joi, 5 ianuarie 2012

AVG ANTI-VIRUS FREE EDITION FOR LINUX

AVG Anti-Virus Free Edition for Linux
Basic antivirus protection for Linux/FreeBSD available to download for free. Free virus protection for your PC. For private and non-commercial use only.