29/4/09

Linux | Notas Servidor de DNS Bind

Ocultar la version del BIND:

- En el archivo named.conf.options o named.conf dependiendo de la Distribucion que se utilice

options {
directory "/var/cache/bind";
version ""; <--------------------- ESTA ES LA LINEA QUE SE DEBE AGREGAR!!!


- Para consultar al BIND la version instalada:

#nslookup -q=txt -class=CHAOS version.bind. 0

Linux | SSH sin password

Configuracion de SSH para poder loguearse a un Server utilizando las KEYS y sin password...


SSH Without a Password

The following steps can be used to ssh from one system to another without specifying a password.
Notes:
The system from which the ssh session is started via the ssh command is the client.
The system that the ssh session connects to is the server.
These steps seem to work on systems running OpenSSH.
The steps assume that a DSA key is being used. To use a RSA key substitute 'rsa' for 'dsa'.
The steps assume that you are using a Bourne-like shell (sh, ksh or bash)
Some of this information came from:
http://www.der-keiler.de/Mailing-Lists/securityfocus/Secure_Shell/2002-12/0083.html
Steps:

On the client run the following commands:
$ mkdir -p $HOME/.ssh
$ chmod 0700 $HOME/.ssh
$ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).

Copy $HOME/.ssh/id_dsa.pub to the server.

On the server run the following commands:
$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
$ chmod 0600 $HOME/.ssh/authorized_keys2
Depending on the version of OpenSSH the following commands may also be required:
$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
$ chmod 0600 $HOME/.ssh/authorized_keys
An alternative is to create a link from authorized_keys2 to authorized_keys:
$ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys

On the client test the results by ssh'ing to the server:
$ ssh -i $HOME/.ssh/id_dsa server

(Optional) Add the following $HOME/.ssh/config on the client:
Host server
IdentityFile ~/.ssh/id_dsa
This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

Oracle | Datapump expdp

DATAPUMP de Oracle 10g

Export.....

-expdp

expdp "'/ AS SYSDBA'" schemas= content=ALL directory=(nombre del diretory) logfile=log_expdp dumpfile=(archivo dump)

Notas:

- el "directory" lo tengo que sacar de la vista DBA_DIRECTORIES
- el logfile va a parar al directory que le especifique en directory=

28/4/09

Linux | Referencia YUM

- yum list (Listing installed packages)
- yum info (Getting package descriptions)
- yum search (Searching for packages)
- yum deplist (Viewing package dependencies)
- yum install (Installing and removing packages with yum)
- yum check-update (Checking for new package versions)
- yum clean all (Cleaning up the yum cache)

27/4/09

Solaris | Configurar la placa de Red

Cambiar la IP de la placa de red

ifconfig xl0 inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255

o...

IP -> /etc/hosts
Netmask -> /etc/netmasks
Gateway -> /etc/defaultrouter
IP (again) -> /etc/inet/ipnodes (This is new in Solaris 10)
DNS Servers -> /etc/resolv.conf

# svcadm restart network/physical

Linux | Remplazo masivo

Shell Script y Perl

perl -w -i -p -e "s/search_text/replace_text/g" *.php

En este ejemplo remplaza 2001071111 por 2008100711

perl -w -i -p -e "s/2001071111/2008100711/g" db.*

Oracle | Ver si un objeto y sus dependencias estan en uso

-- Ver si el OBJETO y sus dependencias esta en uso
SELECT DISTINCT(a.SID),a.object,b.username FROM v$access a, v$session b WHERE
a.OBJECT IN (SELECT name FROM dba_dependencies WHERE referenced_name LIKE UPPER ('nombre del objeto') )
AND
b.SID = a.SID