jueves, 31 de marzo de 2011

Conectarse a nuestro servidor nts

La dirección IP en LAN para el servidor donde tenemos instalado el servicio es:

10.0.1.43

La carpeta a la que podemos accesar es:

tourette

Debemos instalar los paquetes siguientes:

apt-get install nfs-kernel-server nfs-common portmap


Para conectarnos, sólo hay que montar el sistema de archivos ntfs en nuestro cliente.

mount -t nfs 10.0.1.43:/srv/tourette nfs/

Si se quiere montar automáticamente hay que modificar el archivo /etc/fstab y agregar lo siguiente:

#montar sistema nfs
10.0.1.43:/srv/tourette /media/nfs nfs defaults 1 2

Como poner un cliente NFS

Estos pasos están descritos aquí.

http://www.debianhelp.co.uk/nfs.htm

El Network File System (Sistema de archivos de red), o NFS, es un protocolo de nivel de aplicación, según el Modelo OSI. Es utilizado para sistemas de archivos distribuido en un entorno de red de computadoras de área local. Posibilita que distintos sistemas conectados a una misma red accedan a ficheros remotos como si se tratara de locales. Originalmente fue desarrollado en 1984 por Sun Microsystems, con el objetivo de que sea independiente de la máquina, el sistema operativo y el protocolo de transporte, esto fue posible gracias a que está implementado sobre los protocolos XDR (presentación) y ONC RPC (sesión) .[1] El protocolo NFS está incluido por defecto en los Sistemas Operativos UNIX y la mayoría de distribuciones Linux.

  • NULL: no hace nada, pero sirve para hacer ping al server y medir tiempos.
  • CREATE: crea un nuevo archivo.
  • LOOKUP: busca un fichero en el directorio actual y si lo encuentra, devuelve un descriptor a ese fichero más información sobre los atributos del fichero.
  • READ y WRITE: primitivas básicas para acceder el fichero.
  • RENAME: renombra un fichero.
  • REMOVE: borra un fichero.
  • MKDIR y RMDIR: creación/borrado de subdirectorios.
  • READDIR: para leer la lista de directorios.
  • GETATTR y SETATTR: devuelve conjuntos de atributos de ficheros.
  • LINK: crea un archivo, el cual es un enlace a un archivo en un directorio, especificado.
  • SYMLINK y READLINK: para la creación y lectura, respectivamente, de enlaces simbólicos (en un "string") a un archivo en un directorio.
  • STATFS: devuelve información del sistema de archivos.
  • ROOT, para ir a la raíz (obsoleta en la versión 2).
  • WRITECACHE: reservado para un uso futuro.

En la versión 3 del protocolo se eliminan los comandos se STATFS, ROOT y WRITECACHE; y se agregaron los siguientes:[3]

  • ACCESS: Para verificar permisos de acceso.
  • MKNOD: Crea un dispositivo especial.
  • READDIRPLUS: una versión mejorada de READDIR.
  • FSSTAT: devuelve información del sistema de archivos en forma dinámica.
  • FSINFO: devuelve información del sistema de archivos en forma estática.
  • PATHCONF: Recupera información POSIX.
  • COMMIT: Enviar datos de caché sobre un servidor un sistema de almacenamiento estable.
____________________________________________________________________________________
Instalación, en inglish porqui somos huevones

Installing NFS in Dedian

Making your computer an NFS server or client is very easy.A Debian NFS client needs

# apt-get install nfs-common portmap

while a Debian NFS server needs

# apt-get install nfs-kernel-server nfs-common portmap

NFS Server Configuration

NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

/etc/exports
/home 195.12.32.2(rw,no_root_squash) www.first.com(ro)
/usr 195.12.32.2/24(ro,insecure)

A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons.

A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.

For each options specified in /etc/exports file can be check export man pages.Click here for manpage.

If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command:

# exportfs -a

__________________________________________________________________________________

viernes, 18 de marzo de 2011

Mecanismo para monitorear la actividad de "su".

La configuración de las variables que el comando "su" utiliza se encuentra generalmente en el archivo /etc/login.defs el cual contiene, entre otras cosas, las opciónes que el comando interpretará, en las últimas versiones "su" utiliza el archivo syslog para monitorear los intentos de uso, sin embargo no guarda la actividad realizada por dicho comando y para habilitarla es necesario descomentar esta línea:


SULOG_FILE /var/log/sulog

Obviamente se puede establecer otro archivo como destino.

Determinar cuotas en Linux

Para activar las cuotas en el sistema ubuntu 10.04.

Supongamos este escenario:
"Mediante un mecanismo de cuotas, establecer límites en cuanto a la cantidad máxima de espacio asignado y la cantidad máxima de archivos a cada usuario. Concretamente quisieramos establecer un máximo de 200MB de espacio y un máximo de 1000 archivos."

Para solucionar esto debemos habilitar el manejo de cuotas en nuestro sistema Linux-


Debemos instalar los programas de gestión de cuotas. Estos son:
quotacheck y quotaon.

Ambos se encuentran el los repositorios de debian/ubuntu. Por lo que se puede instalar con aptitude. El paquete que contiene estos comandos es quota .

$ sudo aptitude install quota

Dos pasos

1.- Configuración del sistema para el uso de cuotas.

2.- Modificar el archivo /etc/fstab
(este paso debe repetirse para cada partición del disco que se quiera gestionar con cuotas.)

Debemos añadir una línea al final de los scripts de configuración. (/etc/rc.local)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#Checar cuotas
if [ -x /usr/quotacheck ]
then
echo "Verificando cuotas, esto puede llevar tiempo, vato!"
#Estos argumentos son por esto:
#-a, --all Check all mounted non-NFS filesystems in /etc/mtab
# -v, --verbose quotacheck reports its operation as it progresses. Normally it operates silently. If the option is specified twice, also the current directory is printed (note that printing can slow down the scan measurably).
# -u, --user Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked. This is the default action.
#-g--group Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked.
/usr/quotacheck -avug
echo "completado"
fi

if [ -x /usr/quotaon ]
then
echo "Activando cuotas, carnal!"
/usr/sbin/quotaon -avug
fi
exit 0

Podemos asignar diferentes cuotas para usuarios y grupos.
Supongamos que en el sistema esta un grupo de usuarios de GRASS y queremos asignarle aeste grupo una cuota de disco duro de 500GB. Es bien sabido que los mapas ocupan mucha memoria por lo que hay que restringir un mal uso del disco.
En este ejemplo chafa, el grupo de estos usuarios se puede llamar SIG.

Para cada partición, sobre la que se desee cuota, se necesitarán configurar 3 cosas:
  1. En el archivo /etc/fstab deberemos agregar la opción usrquota
  2. En el archivo /etc/fstab deberemos agregar la opción grpquota
  3. Debemos crear una base de datos de las copias.
Opción USRQUOTA
Para cada partición se le debe agregar esta opción en el archivo /etc/fstab
En nuestro sistema quedará de la siguiente forma
Más información de fstab en:
https://help.ubuntu.com/community/Fstab

#definir opción de cuotas para la partición 9
#
#/dev/sda9 / ext4 defaults,usrquota,grpquota 0 1

UUID=cdb835e7-460d-49f7-8dad-7956aeef3799 / ext4 errors=remount-ro,usrquota,grpquota 0 1


Aquí estamos especificando que la partición 9 del dispositivo sda, montado en la raíz del sistema con tipo de archivos ext4 tenga las opciones: usrquota, grpquota

Base de datos de cuotas
De
bemos crear un archivo para almacenar la información de cuotas de usuario y grupos. Estos archivos están vacios, por defecto. Se encuentran en el directorio. Debemos crear con el comando touch los siguientes archivos en la raiz de la partición.

$sudo touch quota.user
$sudo touch quota.group

Configuración de los parámetros de cuotas

El comando edquota nos da la posibilidad de crear, modificar o eliminar cuotas de usuarios y grupos.

Primero debemos definir los siguiente.

In addition to edquota, there are 3 terms which you should familiarize yourself with: Soft Limit, Hard Limit, and Grace Period.

5.4 Soft Limit

_Soft limit_ indicates the maximum amount of disk usage a quota user has on a partition. When combined with grace period, it acts as the border line, which a quota user is issued warnings about his impending quota violation when passed.

5.5 Hard Limit

Hard limit works only when grace period is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his hard limit.

5.6 Grace Period

Executed with the command "edquota -t", grace period is a time limit before the soft limit is enforced for a file system with quota enabled. Time units of sec(onds), min(utes), hour(s), day(s), week(s), and month(s) can be used. This is what you'll see with the command "edquota -t":

Más info en:
http://www.faqs.org/docs/Linux-mini/Quota.html

edquota ejecuta un editor de texto para modificar el archivo de cuotas que hemos creado. Por default el editor que ejecuta es el que está definido en la variable de entorno $EDITOR

edquote tiene varios paŕametros. (ver: http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds2/edquota.htm)

Supongamos que queremos editar el usuario juan.
PARA PODER HACER ESTO SERÁ
NECESARIO REINICIAR EL EQUIPO o volver a montar la partición.

$ sudo edquota -u juan

En terminal veremos algo así.
Disk quotas for user juan (uid 1002):
Filesystem blocks soft hard inodes soft $
/dev/sda9 24 0 0 7 0 $

los ceros indican que no hay cuiotas para la cuenta de juan.
Observemos que hay cuota para los i-nodos. Aquí podemos poner la cuota para los archivos.
Para cumplir con nuestro cometido bastará con modificar este script para que quede así.


para saber cuánto vale un bloque debemos ejecutar el comando
$sudo tune2fs -l /dev/sda9

Disk quotas for user juan (uid 1002):
Filesystem blocks soft hard inodes soft $
/dev/sda9 24 45 50 1000 950 $

Para copiar a otros usuarios podemos copiar la configuración con la opción -p


$ sudo edquota -p juan grillo


listo, lo podemos hacer pa todos los usuarios con:


Checar los siguientes comandos para la gestión de cuotas

quotacheck
quotaon
repquota


Restaurar tablas de particiones

Sacado de:

http://martybugs.net/linux/image.cgi


Creating a Backup Image of a PC

This page describes how to create a complete backup image of a PC, with focus being given to imaging a Linux PC.


Background Information
There are many different ways to backup a PC.

An offline cold backup involves taking the PC offline, with an exact copy of the contents of the HDD being made.
Cold backups are typically performed using some form of software to image either the entire HDD, or each partition on the HDD.

Online backups (also known as a hot backup) involve making a backup of a PC without interrupting its operation. There are many methods for achieving this on a linux box, including tar, rsync, etc.

A full backup refers to a complete backup, ie, everything is backed up.

Incremental backups involve only backing up the changes since the previous backup, and can provide a very efficient method to repeatedly backup a PC without creating an excessive volume of backups.

There is no single "correct" way to backup a PC - it's really a matter of selecting the appropriate method that suits your requirements.

This page details the process required to create a complete backup image of a PC, using freeware utilities. While the example provided below involves imaging a linux PC, the same approach can certainly be used to create a backup image of a Windows PC.

The partition table will be backed up, including information about any extended partitions.
Then Partition Image will be used to create a compressed image of each partition, thus consuming far less disk space than an uncompressed complete copy of each partition (such as a partition copy created using dd).


Software Used
A bootable CDROM called System Rescue CD is invaluable, as it contains all the tools and utilities required to manipulate partition tables, format partitions, as well as saving a partition to an image file, and restoring an image to a partition.

The following utilities on the System Rescue CD are particularly useful in the context of imaging PCs:
  • partimage - Partition Image
  • cfdisk - Curses based disk partition table manipulator for Linux
  • fdisk - Partition table manipulator for Linux
  • dd - convert and copy a file
  • sfdisk - Partition table manipulator for Linux
Note that Partition Image provides functionality to image a partition to a file on a local disk, but can also create image files on another server over the network, providing you are running a partimage server on another PC.
This tutorial assumes image files are being created on a local disk.


Imaging the PC
HDD Names
Linux uses a very different naming convention than Windows for hard drives. The hard drives are named after their physical connection.

Sample hard drive names are as follows:

/dev/hda master device on primary IDE channel
/dev/hdb slave device on primary IDE channel
/dev/hdc master device on secondary IDE channel
/dev/hdd slave device on secondary IDE channel
/dev/sda first SCSI hard drive
/dev/sdb second SCSI hard drive
...

Each partition on a HDD is named by appending a number to the end of the HDD name, ie, /dev/hda1 is the first partition on /dev/hda, which is the master device on the primary IDE channel.

For the purposes of this tutorial, a second HDD was added to a linux PC, to allow partitions to be imaged to the second HDD.
The linux PC has the following devices:

/dev/hda HDD being imaged
/dev/hdc target HDD onto which images will be written
/dev/hdd CDROM drive (containing SystemRescueCD)

Using the System Rescue CD
Boot the PC using the SystemRescueCD. When prompted for a keymap selection, just hit "Enter" to use the default speakup-us keymap (or select another if it's more appropriate).

Once you have a root@sysresccd prompt, you're ready to get started.

Prepare Destination Drive
The destination HDD (in my case, this was /dev/hdc) must be prepared to allow images to be written to it. If this HDD already has a filesystem on it, and has sufficient space, then there should be no need to re-partition it or re-format it.
Note that repartitioning the HDD will typically result in all data on it being lost.

I used cfdisk to create a single 4GB FAT32 partition on /dev/hdc, and then formatted it using

  mkdosfs -F 32 /dev/hdc1

A FAT32 filesystem was chosen, as it will allow this partition to be read if/when the HDD is placed into a Windows PC.
If you prefer an ext3 filesystem, format it using mkfs.ext3 /dev/hdc1 after creating the partition.

Mount The Destination Drive
To be able to access any partition on the backup drive, it must be mounted. First create a mount point:

  mkdir /mnt/hdc1

Then mount the target partition using the mount point:

  mount /dev/hdc1 /mnt/hdc1

Confirm the partition has been mounted and is available by running df -h. The output should include a line for the newly mounted partition, and should also show the amount of available space on it, similar to this:

  Filesystem            Size  Used Avail Use% Mounted on
...
/dev/hdc1 4.0G 4.0K 4.0G 1% /mnt/hdc1

The above output shows that the /dev/hdc1 partition is mounted on /mnt/hdc1 and has approximately 4GB free space.

Review The Source HDD
The HDD being imaged (/dev/hda) has three partitions on it, namely the root partition (/), the /boot partition, and a swap partition.

Below is a screenshot showing the partitions on this HDD, as displayed by cfdisk:


Backup the Partition Table
To backup the partition table to a file, we can use dd as follows:

 dd if=/dev/hda of=/mnt/hdc1/my-hda.mbr count=1 bs=512

Linux treats a filesystem or a partition as a file, and the syntax above specifies the input file to be the /dev/hda partition, and the output file is a file on our target HDD. The other parameters specify that only a single block should be copied, and we're forcing the filesize to be 512 bytes.

The output filename is arbitrary, so give it a suitable name that indicates which HDD it relates to. A ".mbr" file extension indicates it contains details relating to the master boot record.

Backup Extended Partition Information
If you have any extended partitions on the HDD being imaged, the details of the extended partitions can be saved as follows:

 sfdisk -d /dev/hda > /mnt/hdc1/my-hda.sf

This will dump the partition table contents into the file we specify, in a format suitable for easily rebuilding the partition table.
Again, the output filename is arbitrary, so use a suitable filename.

Using Partition Image
To create an image of each partition, we can use Partition Image (included on the System Rescue CD), which can be started by running partimage from a command prompt.

Note that when Partition Image is running, you can still get to a command prompt by hitting Alt-F2 to select virtual console #2 (there are six available virtual consoles when booting with the System Rescue CD). You can then revert back to the previous virtual console by hitting Alt-F1.

Backup Each Partition
In partimage, select the partition to be imaged (ie, each partition on /dev/hda except the swap partition), and specify a filename located on the previously mounted HDD (ie, /dev/hdc1 mounted as /mnt/hdc1).

jueves, 17 de marzo de 2011

Cómo agregar permisos específicos a usuarios

Sacado de:
https://help.ubuntu.com/community/Sudoers

utilizar visudo para editar

este es el archivo de configuración para apagar la compu sin permisos ni passwords para el usuario alternate

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification
User_Alias USERS = Alternate
# Cmnd alias specification
Cmnd_Alias APAGAR = /sbin/shutdown -h now, /sbin/halt, /sbin/reboot
# User privilege specification
# Especificaciones de los usuarios
root ALL=(ALL) ALL
USERS ALL= APAGAR
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL


Después en la consola para apagar bastará con poner:
logeado como usuario Alternate
$ sudo shutdown -h now

para apagar el sistema.

Montar servidor FTP en Ubuntu/Debian

Instalar vsftp version 2.3.4 desde el código fuente




Este el el link del código fuente

En el shell escribimos:

ftp vsftpd.beasts.org
Connected to vsftpd.beasts.org.
220 sphinx.mythic-beasts.com FTP server ready.
Name (vsftpd.beasts.org:root): anonymous
331 Guest login ok, type your name as password.
Password:
230- Welcome to Mythic Beasts Ltd.
230-
230- This system is for authorised users only. All access is logged.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.



Observa como en el campo de nombre de usurio dice: anonymous
Una vez conectados debemos ir a la carpeta users/cevans y de ahí descargar la versión 2.3.4

cd users/cevans

ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for '/bin/ls'.
total 6428
-rw-r--r-- 1 530 530 37024 Oct 21 2009 ftpgrab-0.1.3.tar.gz
-rw-r--r-- 1 530 530 37023 Oct 27 2009 ftpgrab-0.1.4.tar.gz
ftp> get vsftpd-2.3.4.tar.gz
local: vsftpd-2.3.4.tar.gz remote: vsftpd-2.3.4.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for 'vsftpd-2.3.4.tar.gz' (187043 bytes).
226 Transfer complete.
187043 bytes received in 1.42 secs (128.2 kB/s)

-rw-r--r-- 1 530 530 37028 Nov 7 2009 ftpgrab-0.1.5.tar.gz
drwxr-x--x 2 530 530 4096 Dec 16 2004 private
drwxr-xr-x 2 530 530 4096 Nov 8 21:00 stuff
drwxr-xr-x 22 530 530 4096 Feb 15 22:39 untar
-rw-r--r-- 1 530 530 90425 Sep 22 2001 vsftpd-0.9.2.tar.gz
-rw-r--r-- 1 530 530 92976 Nov 16 2001 vsftpd-1.0.1.tar.gz
-rw-r--r-- 1 530 530 113205 Jul 31 2002 vsftpd-1.1.0.tar.gz
-rw-r--r-- 1 530 530 115836 Oct 7 2002 vsftpd-1.1.1.tar.gz
-rw-r--r-- 1 530 530 117792 Oct 16 2002 vsftpd-1.1.2.tar.gz
-rw-r--r-- 1 530 530 120817 Nov 9 2002 vsftpd-1.1.3.tar.gz
-rw-r--r-- 1 530 530 130025 May 29 2003 vsftpd-1.2.0.tar.gz
-rw-r--r-- 1 530 530 136041 Nov 13 2003 vsftpd-1.2.1.tar.gz
-rw-r--r-- 1 530 530 136669 Apr 26 2004 vsftpd-1.2.2.tar.gz
-rw-r--r-- 1 530 530 145467 Jul 1 2004 vsftpd-2.0.0.tar.gz
-rw-r--r-- 1 530 530 189 Jul 1 2004 vsftpd-2.0.0.tar.gz.asc
-rw-r--r-- 1 530 530 146231 Jul 2 2004 vsftpd-2.0.1.tar.gz
-rw-r--r-- 1 530 530 189 Jul 2 2004 vsftpd-2.0.1.tar.gz.asc
-rw-r--r-- 1 530 530 151178 Mar 3 2005 vsftpd-2.0.2.tar.gz
-rw-r--r-- 1 530 530 189 Mar 3 2005 vsftpd-2.0.2.tar.gz.asc
-rw-r--r-- 1 530 530 153266 Mar 19 2005 vsftpd-2.0.3.tar.gz
-rw-r--r-- 1 530 530 189 Mar 19 2005 vsftpd-2.0.3.tar.gz.asc
-rw-r--r-- 1 530 530 151811 Mar 5 2005 vsftpd-2.0.3pre1.tar.gz
-rw-r--r-- 1 530 530 152681 Mar 12 2005 vsftpd-2.0.3pre2.tar.gz
-rw-r--r-- 1 530 530 189 Mar 12 2005 vsftpd-2.0.3pre2.tar.gz.asc
-rw-r--r-- 1 530 530 154857 Jan 9 2006 vsftpd-2.0.4.tar.gz
-rw-r--r-- 1 530 530 189 Jan 9 2006 vsftpd-2.0.4.tar.gz.asc
-rw-r--r-- 1 530 530 155985 Jul 3 2006 vsftpd-2.0.5.tar.gz
-rw-r--r-- 1 530 530 189 Jul 3 2006 vsftpd-2.0.5.tar.gz.asc
-rw-r--r-- 1 530 530 158516 Feb 13 2008 vsftpd-2.0.6.tar.gz
-rw-r--r-- 1 530 530 189 Feb 13 2008 vsftpd-2.0.6.tar.gz.asc
-rw-r--r-- 1 530 530 162801 Jul 30 2008 vsftpd-2.0.7.tar.gz
-rw-r--r-- 1 530 530 189 Jul 30 2008 vsftpd-2.0.7.tar.gz.asc
-rw-r--r-- 1 530 530 178636 Feb 18 2009 vsftpd-2.1.0.tar.gz
-rw-r--r-- 1 530 530 197 Feb 18 2009 vsftpd-2.1.0.tar.gz.asc
-rw-r--r-- 1 530 530 180914 May 28 2009 vsftpd-2.1.1.tar.gz
-rw-r--r-- 1 530 530 197 May 28 2009 vsftpd-2.1.1.tar.gz.asc
-rw-r--r-- 1 530 530 180548 Feb 26 2009 vsftpd-2.1.1pre1.tar.gz
-rw-r--r-- 1 530 530 197 Feb 26 2009 vsftpd-2.1.1pre1.tar.gz.asc
-rw-r--r-- 1 530 530 180958 May 29 2009 vsftpd-2.1.2.tar.gz
-rw-r--r-- 1 530 530 197 May 29 2009 vsftpd-2.1.2.tar.gz.asc
-rw-r--r-- 1 530 530 184700 Aug 13 2009 vsftpd-2.2.0.tar.gz
-rw-r--r-- 1 530 530 197 Aug 13 2009 vsftpd-2.2.0.tar.gz.asc
-rw-r--r-- 1 530 530 182050 Jul 7 2009 vsftpd-2.2.0pre1.tar.gz
-rw-r--r-- 1 530 530 197 Jul 7 2009 vsftpd-2.2.0pre1.tar.gz.asc
-rw-r--r-- 1 530 530 184140 Jul 14 2009 vsftpd-2.2.0pre2.tar.gz
-rw-r--r-- 1 530 530 197 Jul 14 2009 vsftpd-2.2.0pre2.tar.gz.asc
-rw-r--r-- 1 530 530 184329 Jul 16 2009 vsftpd-2.2.0pre3.tar.gz
-rw-r--r-- 1 530 530 197 Jul 16 2009 vsftpd-2.2.0pre3.tar.gz.asc
-rw-r--r-- 1 530 530 184420 Jul 18 2009 vsftpd-2.2.0pre4.tar.gz
-rw-r--r-- 1 530 530 197 Jul 18 2009 vsftpd-2.2.0pre4.tar.gz.asc
-rw-r--r-- 1 530 530 185226 Oct 19 2009 vsftpd-2.2.1.tar.gz
-rw-r--r-- 1 530 530 197 Oct 19 2009 vsftpd-2.2.1.tar.gz.asc
-rw-r--r-- 1 530 530 185562 Nov 17 2009 vsftpd-2.2.2.tar.gz
-rw-r--r-- 1 530 530 197 Nov 17 2009 vsftpd-2.2.2.tar.gz.asc
-rw-r--r-- 1 530 530 185554 Nov 12 2009 vsftpd-2.2.2pre1.tar.gz
-rw-r--r-- 1 530 530 197 Nov 12 2009 vsftpd-2.2.2pre1.tar.gz.asc
-rw-r--r-- 1 530 530 187122 Aug 6 2010 vsftpd-2.3.0.tar.gz
-rw-r--r-- 1 530 530 197 Aug 6 2010 vsftpd-2.3.0.tar.gz.asc
-rw-r--r-- 1 530 530 186503 Mar 18 2010 vsftpd-2.3.0pre1.tar.gz
-rw-r--r-- 1 530 530 197 Mar 18 2010 vsftpd-2.3.0pre1.tar.gz.asc
-rw-r--r-- 1 530 530 186992 Mar 26 2010 vsftpd-2.3.0pre2.tar.gz
-rw-r--r-- 1 530 530 197 Mar 26 2010 vsftpd-2.3.0pre2.tar.gz.asc
-rw-r--r-- 1 530 530 187199 Aug 19 2010 vsftpd-2.3.1.tar.gz
-rw-r--r-- 1 530 530 197 Aug 19 2010 vsftpd-2.3.1.tar.gz.asc
-rw-r--r-- 1 530 530 187229 Aug 20 2010 vsftpd-2.3.2.tar.gz
-rw-r--r-- 1 530 530 197 Aug 20 2010 vsftpd-2.3.2.tar.gz.asc
-rw-r--r-- 1 530 530 187001 Feb 15 07:58 vsftpd-2.3.3.tar.gz
-rw-r--r-- 1 530 530 198 Feb 15 07:58 vsftpd-2.3.3.tar.gz.asc
-rw-r--r-- 1 530 530 187043 Feb 15 22:38 vsftpd-2.3.4.tar.gz
-rw-r--r-- 1 530 530 198 Feb 15 22:38 vsftpd-2.3.4.tar.gz.asc
226 Transfer complete.

ftp> get vsftpd-2.3.4.tar.gz
local: vsftpd-2.3.4.tar.gz remote: vsftpd-2.3.4.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for 'vsftpd-2.3.4.tar.gz' (187043 bytes).
226 Transfer complete.
187043 bytes received in 1.42 secs (128.2 kB/s)

Verificar firma del tarball:

Para esto debemos descargar el archivo *.asc

juan@Jaguar:~/ftp$ gpg vsftpd-2.3.4.tar.gz.asc
gpg: Firmado el mar 15 feb 2011 16:38:11 CST usando clave DSA ID 3C0E751C
gpg: Imposible comprobar la firma: Clave pública no encontrada

Debemos conseguir la llave pública del sitio
Probemos...

juan@Jaguar:~/ftp$ gpg vsftpd-2.3.4.tar.gz.asc
gpg: Firmado el mar 15 feb 2011 16:38:11 CST usando clave DSA ID 3C0E751C
gpg: Imposible comprobar la firma: Clave pública no encontrada

Hay qué conseguirla, quizás en el keyserver del MIT
juan@Jaguar:~/ftp$ gpg --keyserver pgpkeys.mit.edu --recv-key 3C0E751C
gpg: solicitando clave 3C0E751C de hkp servidor pgpkeys.mit.edu
gpg: clave 3C0E751C: clave pública "Chris Evans " importada
gpg: Cantidad total procesada: 1
gpg: importadas: 1

vientos!

juan@Jaguar:~/ftp$ gpg vsftpd-2.3.4.tar.gz.asc
gpg: Firmado el mar 15 feb 2011 16:38:11 CST usando clave DSA ID 3C0E751C
gpg: Firma correcta de «Chris Evans »
gpg: AVISO: ¡Esta clave no está certificada por una firma de confianza!
gpg: No hay indicios de que la firma pertenezca al propietario.
Huellas dactilares de la clave primaria: 8660 FD32 91B1 84CD BC2F 6418 AA62 EC46 3C0E 751C

Conformémonos con esto.

ahora, compilemos el código fuente

descomir el tar

leer el archivo INSTALL

Atención a lo siguiente: (sacado del archivo INSTALL)
edit "builddefs.h" to handle compile-time settings (tcp_wrappers build,
etc).
Compilación:
Just type "make" (and mail me to fix it if it doesn't build ;-).
This should produce you a vsftpd binary. You can test for this, e.g.:

Step 2) Satisfy vsftpd pre-requisites
2a) vsftpd needs the user "nobody" in the default configuration. Add this
user in case it does not already exist. e.g.:

[root@localhost root]# useradd nobody
useradd: user nobody exists

2b) vsftpd needs the (empty) directory /usr/share/empty in the default
configuration. Add this directory in case it does not already exist. e.g.:

[root@localhost root]# mkdir /usr/share/empty/
mkdir: cannot create directory `/usr/share/empty': File exists

2c) For anonymous FTP, you will need the user "ftp" to exist, and have a
valid home directory (which is NOT owned or writable by the user "ftp").
The following commands could be used to set up the user "ftp" if you do not
have one:
[root@localhost root]# mkdir /var/ftp/
[root@localhost root]# useradd -d /var/ftp ftp

(the next two are useful to run even if the user "ftp" already exists).
[root@localhost root]# chown root.root /var/ftp
[root@localhost root]# chmod og-w /var/ftp


Instalación, a pata

cp vsftpd /usr/sbin/vsftpd
cp vsftpd.conf.5 /usr/share/man/man5
cp vsftpd.8 /usr/share/man/man8

"make install" doesn't copy the sample config file. It is recommended you
do this:
cp vsftpd.conf /etc

probemos...

Edit /etc/vsftpd.conf, and add this line at the bottom:

listen=YES

This tells vsftpd it will NOT be running from inetd.
Right, now let's try and run it!

Probemos
Ir a donde se instaló vsftpd i.e. /usr/sbin/
root@Jaguar:/usr/sbin# ftp localhost
Connected to localhost.
220 (vsFTPd 2.3.4)

Name (localhost:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.

Instalción con inetd

Hagamos todo el chunche.
Inet: Often called a super-server, inetd listens on designated ports used by internet services such as FTP, POP3, and telnet. When a TCP packet or UDP packet arrives with a particular destination port number, inetd launches the appropriate server program to handle the connection.

gopher:
The Gopher protocol /ˈɡoʊfər/ is aTCP/IP Application layer protocoldesigned for distributing, searching, and retrieving documents over the Internet. Strongly oriented towards a menu-document design, the Gopher protocol was a predecessor of (and later, an alternative to) the World Wide Web.

The Gopher protocol was first described in RFC 1436. IANA has assigned TCPport 70 to the Gopher protocol.

Setup

The file /etc/services is used to map port numbers and protocols to service names, and the file /etc/inetd.conf is used to map service names to server names. For example, if a TCP request comes in on port 23, /etc/services shows

telnet 23/tcp
The corresponding line in the /etc/inetd.conf file (in this case, taken from a machine running AIX version 5.1) is

telnet stream tcp6 nowait root /usr/sbin/telnetd telnetd -a
This tells inetd to launch the program /usr/sbin/telnetd with the command line arguments telnetd -a. inetd automatically hooks the socket to stdin, stdout, and stderr of the server program.

Generally TCP sockets are handled by spawning a separate server to handle each connection concurrently. UDP sockets are generally handled by a single server instance that handles all packets on that port.

i.e. TENEMOS QUE MODIFICAR /etc/services y /etc/inetd.conf

5a) If using standard "inetd", you will need to edit /etc/inetd.conf, and add
a line such as:

ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/vsftpd

(Make sure to remove or comment out any existing ftp service lines. If you
don't have tcp_wrappers installed, or don't want to use them, take out the
/usr/sbin/tcpd part).

inetd will need to be told to reload its config file:
kill -SIGHUP `pidof inetd`

5b) If using "xinetd", you can follow a provided example, by looking at the
file EXAMPLE/INTERNET_SITE/README. Various other examples show how to leverage
the more powerful xinetd features.