Archivi per ‘Linux’
Postfix – Comandi utili
Postfix version:
# postconf mail_version
Postfix default settings:
# postconf -d
Postfix non-default settings:
# postconf -n
Delete one message with the named queue ID from default queues:
incoming, active and deferred
# postsuper -d queue-id
Delete all messages from the queues:
# postsuper -d ALL
Flush the mail queue:
# postfix flush
Linux: Slow SSH Login – Login Lento con SSH
Thanks to http://www.hackosis.com/2007/12/15/linux-fix-slow-ssh-login/
The Problem:
By default, most SSH installations are set to do a reverse DNS lookup on any incoming connections. If the DNS server times out, or there is no record for your IP address, it can result in a very lengthy delay when logging into your Linux server via SSH.
The Solution:
There are about 3 different solutions to this problem.
- Disable reverse lookup on the SSH server you are connecting to.Append
UseDNS no
UsePAM noto the /etc/ssh/sshd_config file on the server you are connecting to and restart the SSH daemon —
/etc/init.d/sshd restart or /etc/init.d/ssh restart.
- If you are connecting from a static IP, you may enter your host name in the /etc/hosts file.
- Call your ISP and ask them to setup reverse hostnames for customer’s IP addresses.
And enjoy your non-delay SSH login for more info check out the sshd_config man page.
Replicazione Database MySQL – Mysql replication
Sul MASTER:
ipotizzo che il master sia il 192.168.0.20
——————— /etc/my.cnf del Master 192.168.0.20 ————————————–
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 16M
log-slow-queries=/var/log/mysql-slow-queries.log
thread_concurrency = 8
log-warnings
server-id = 1
relay-log = /usr/local/mysql/data/mysql-relay-bin
relay-log-index = /usr/local/mysql/data/mysql-relay-bin.index
master-info-file = /usr/local/mysql/data/mysql-master.info
relay-log-info-file = /usr/local/mysql/data/mysql-relay-log.info
log-bin = /usr/local/mysql/data/mysql-bin
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
——————————————————————————————————————-
operazioni sul master:
mysql
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* to slaveuser@’192.168.0.25′ identified by ‘slavepw’;
FLUSH PRIVILEGES;
——————— /etc/my.cnf dello Slave 192.168.0.25 ————————————–
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# changes made to do slave
server-id = 2
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
#log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
##datadir = /var/lib/mysql
master-host=192.168.0.20
# Nome con cui lo slave si presenta al master
report-host = 192.168.0.25
master-user=slaveuser
master-password=slavepw
#master-port=3300
master-connect-retry=30
# end slave setup
log-warnings
## Risolve un bug
skip-bdb
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
——————————————————————————————————————-
operazioni sullo Slave:
mysql -u root -p
> load data from master;
Problemi e soluzioni
Appena configurato il master-slave ho avuto i seguenti errori nei log e conseguenti problemi di replica master-slave
Error reading slave log configuration
080811 15:01:08 [ERROR] Error reading slave log configuration
080811 15:01:08 [ERROR] Failed to initialize the master info structure
Ho risolto stoppando lo slave, stoppando il master e cancellando dal master i file:
/usr/local/mysql/data/mysql-relay-bin
/usr/local/mysql/data/mysql-relay-bin.index
/usr/local/mysql/data/mysql-master.info
/usr/local/mysql/data/mysql-relay-log.info
/usr/local/mysql/data/mysql-bin
Saluti a tutti
Maurizio
Slackware 12 su Asus Z99j o Aj8n – Gestione ACPI e tasti funzione
Apena installata, la mia distro preferita (ovviamente Slackware 12) ACPI aveva qualche problama.
Sulla barra non compariva l’icona del controllo delle batterie e i tasti funzione non funzionavano
Ecco come ho risolto:
In fondo al file /etc/rc.d/rc.modules ho aggiunto le seguenti righe:
#######################################################
## ACPI MAOX X ASUS
/sbin/modprobe asus_acpi
/sbin/modprobe video
/sbin/modprobe battery
/sbin/modprobe container
/sbin/modprobe button
/sbin/modprobe ac
/sbin/modprobe thermal
/sbin/modprobe processor
/sbin/modprobe fan
/sbin/depmod -ae
###########################################################à
In queso modo è comparsa l’icona delle batterie e posso gestire il risparmio energetico.
Per i tasti funzione:
in /etc/acpi ho modificato il file acpi_handler.sh come segue:
###########################################################
root@trinity2:/etc/acpi# cat acpi_handler.sh
#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case “$1″ in
button)
case “$2″ in
power) /sbin/init 0
;;
*) logger “ACPI action $2 is not defined”
;;
esac
;;
hotkey)
case “$2″ in
ATKD)
case “$3″ in
0000005e)
logger “WIFI in Accenione…”
/etc/acpi/wifi_on.sh
logger “WIFI Acceso!”
echo “WIFI Acceso!” | wall
;;
0000005f)
logger “WIFI in Spegnimento…”
/etc/acpi/wifi_off.sh
logger “WIFI Spento!”
echo “WIFI Spento!” | wall
;;
00000032)
logger “MUTE / UNMUTE AUDIO…”
MUTE=`amixer get PCM | grep Left | grep -v Right | cut -d ” ” -f 9`
if [ $MUTE == [on] ]; then
/usr/bin/amixer set PCM mute
else
/usr/bin/amixer set PCM unmute
fi
;;
00000031)
logger “Abbasso il volume…”
amixer set PCM 2-
;;
00000030)
logger “Alzo il volume…”
amixer set PCM 2+
;;
*)
logger “AA $3 AA $4″
logger “BB $3 BB $4″
;;
esac
;;
*) logger “ACPI action $2 is not defined”
;;
esac
;;
*)
logger “ACPI group $1 / action $2 is not defined $3 AAA $4 BBBB $5 CCCC”
;;
esac
###############################################################
Con questo file riesco a controllare il volume e l’attivazione della wireless dai tasti funzione su linux.
Premendo Fn+F10 attivo o disattivo l’audio
Premendo Fn+F11 abbasso l’audio
Premendo Fn+F12 alzo l’audio
e, sempre in /etc/acpi/ ho aggiunto i seguenti file:
#################WIFI_ON############################################
root@trinity2:/etc/acpi# cat wifi_on.sh
#!/bin/bash
/sbin/ifconfig eth0 down
/sbin/modprobe ipw3945
/sbin/depmod -ae
/sbin/ipw3945d –quiet
sleep 5
/sbin/dhcpcd -d -t 15 eth1
#################################################################
#######################WIFI_OFF###############################
root@trinity2:/etc/acpi# cat wifi_off.sh
#!/bin/bash
/sbin/ifconfig eth1 down
/sbin/ipw3945d –kill
/sbin/ipw3945d –kill
killall ipw3945d
/sbin/rmmod ipw3945
/sbin/depmod -ae
/etc/rc.d/rc.inet1 restart
###############################################################
poi un bel
chmod ugo+x /etc/acpi/wifi_*
In questo modo posso attivare e disabilitare la wireless tramite la combinazione di tasti
Fn+F2
Come installare VMWare server su Fedora Core 7
Una meravigliosa guida che spiega come installare vmware server su fedora 7.
http://www.howtoforge.com/vmware_server_fedora7
ecco il cuore della guida:
make[2]: *** [/tmp/vmware-config2/vmmon-only/linux/driver.o] Error 1
make[1]: *** [_module_/tmp/vmware-config2/vmmon-only] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.21-1.3194.fc7-i686′
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config2/vmmon-only’
Unable to build the vmmon module.
For more information on how to troubleshoot module-related problems, please
visit our Web site at “http://www.vmware.com/download/modules/modules.html” and
“http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html”.
Execution aborted.
This happens because VMware Server isn’t ready for a 2.6.21 kernel yet (the default kernel in Fedora 7 is 2.6.21.3). Therefore, we must patch VMware Server a little bit. This can be done as follows:
wget http://knihovny.cvut.cz/ftp/pub/vmware/vmware-any-any-update110.tar.gz
tar xvfz vmware-any-any-update110.tar.gz
cd vmware-any-any-update110
./runme.pl
The ./runme.pl command will continue the VMware Server installation. This time it should succeed, and again you can accept all default values. When it asks you
In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
you can either accept the default value or specify a location that has enough free space to store your virtual machines.
At the end of the installation, you will be asked to enter a serial number:
Please enter your 20-character serial number.
Type XXXXX-XXXXX-XXXXX-XXXXX or ‘Enter’ to cancel:
Fill in your serial number for VMware Server.
After the successful installation, you can delete the VMware Server download file and the installation directory:
cd /home/falko/Desktop
rm -fr vmware-server-distrib
rm -f VMware-server-*.tar.gz
You will now find VMware Server under Applications > Other
ATTENZIONE:Può essere causa di errore l'assenza di xinetd, quindi prima di iniziare l'installazione assicurarsi di avere xinetd:yum install xinetd
ATTENZIONE 2:Una altra possibile causa di problemi è la presenza del file/etc/vmware/not_configuredoccorre eliminarlo:rm /etc/vmware/not_configured
Suspend to ram – sospensione in ram su Fedora 7
Per abilitare il suspend to ram e il suspend to diskho modificato il /etc/grub.conf come segue:
kernel /boot/vmlinuz-2.6.21-1.3228.fc7 ro root=LABEL=/ rhgb vga=791 selinux=0 resume=/dev/sda3 quiet
In questa riga ho:to il suspend to disk e il suspend to ram
abilitato il frame buffer a una risoluzione di 1024x768x32
disabilitato il SELinux
Kismet su Fedora 7 con driver atheros (ath_pci)
Kismet su Fedora 7 con driver atheros (ath_pci)
yum install kismet
e cambiare la riga:
source=…..
in
source=madwifing_g,wifi0,atherosmadwifing_g
esci e salva.
lancia kismet….
funzionaaaa!!!
Aircrack-ng su Fedora 7 con driver atheros madwifi-ng(ath_pci)
Aircrack-ng su Fedora 7 con driver atheros madwifi-ng(ath_pci)
Seguire i seguenti passaggi per patchare i driver:
ifconfig ath0 down
ifconfig wifi0 down
rmmod wlan_wep ath_rate_sample ath_rate_onoe ath_pci wlan ath_hal ath_rate_amrr 2>/dev/null
svn checkout http://svn.madwifi.org/trunk/ madwifi-ng
wget http://patches.aircrack-ng.org/madwifi-ng-r2277.patch
cd madwifi-ng
patch -Np1 -i ../madwifi-ng-r2277.patch
make
make install
depmod -ae
modprobe ath_pci
cd ..
wget http://download.aircrack-ng.org/aircrack-ng-0.9.1.tar.gz
tar -zxvf aircrack-ng-0.9.1.tar.gz
cd aircrack-ng-0.9.1
make && make install
funzionaaaa!!!
si rimanda qui per la suite: http://aircrack-ng.org/doku.php#aircrack-ng_suite
