Automatic sysLogs Report To Email

January 14, 2010 Comments off

install packages:

# yum install ssmtp logwatch

Edit /usr/share/logwatch/default.conf/logwatch:

MailTo = androus@gawab.com
Range = Yesterday
Detail = 10
Service = xxx
mailer = /usr/sbin/ssmtp -t

The available  services are on /usr/share/logwatch/scripts/services

to config ssmtp you can check

Mail Forwarder Post

then:

# logwatch

and check your e-mail!

Categories: linux tips Tags: , , , ,

Setting Full Duplex mode Ethernet Interface

January 8, 2010 1 comment

You can check what mode is enabled before:

# ethtool eth1

to change:

# nano /etc/sysconfig/network-scripts/ifcfg-eth1
ETHTOOL_OPTS="speed 1000 duplex full autoneg off"

Restart Interface:

# ifdown eth1 && ifup eth1

Confirm:

# tail -30 /var/log/messages
# ethtool eth1
Categories: networking Tags: , , , , , ,

User Management Commands

January 7, 2010 Leave a comment

SAMBA
smbpasswd -x foo (delete samba user)
smbpasswd -a foo (create samba user)

LINUX
useradd -M foo (create user with no home directory)
useradd -c “name” -M foo (create user with real name)
userdel -r foo (delete user’s files and home directory)
userdel foo (delete only user entry)
usermod -a -G group user (add an existent user to a group)
useradd -g group user (add a new user to a group)
useradd -G group1,group2,group3 user (add user to a list of groups)
groupadd name_group (create a group)
id -nG user (show groups for user)
groupdel (delete an existent group)
adduser (verbose command to create users)

DEFAULT FILES:
default user add file on Red Hat (/etc/default/useradd)
default user add file on Debian (/etc/adduser.conf)

Categories: linux tips Tags: , , , , ,

Enable USB ports For VirtualBox

January 7, 2010 Leave a comment

For Mandriva 2009.1 – 2010.0 :

# adduser vboxusers foo
# cat /etc/group | grep vboxusers
# mkdir /vbusbf

add to /etc/fstab

none /vbusbf usbfs rw,devgid=501,devmode=664 0 0 #devgid is the output id number for vboxusers
# mount -a

For mandriva 2009.0 :

edit /etc/rc.sysinit

if [ ! -d /proc/bus/usb ]; then
 modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664
else
 mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664
fi

note: devgid is the output id number for vboxusers.

Restart

Categories: linux tips Tags: , , ,

Synchronizing Date with NTP

January 4, 2010 2 comments

If you want to synchronize your system time every x times… then you can make an script and enable it on crontab jobs:

# crontab -l
# crontab -e
*/5 * * * * ntpdate -u swisstime.ethz.c
# crontab: installing new crontab

After 5 minutes…

# date
Categories: linux tips Tags: , , , ,

Simple Backup / Restore DataBase in postgresql

December 31, 2009 1 comment

TO make a database backup in postgreslq server you use pg_dump and psql commands.

First, locate the database:

# psql -l --username postgres --password

Then:

# pg_dump --username postgres name_db --file /dir/dir/backup.sql

To restore the database:

First create database with its respective name and roles:

# psql postgres
# postgres=# CREATE DATABASE name_db ENCODING 'UTF-8';
# postgres=# CREATE ROLE root LOGIN;

Restoring:

# psql name_db < /dir/dir/backup.sql

That’s all.

Follow

Get every new post delivered to your Inbox.