Monday, September 13, 2010

Compartir directorio por HTTP por medio de Python

Primero ubicarce en el directorio que se va a compartir con el comando cd

escribir el siguiente comando:
$ python -m SimpleHTTPServer

Serving HTTP on 0.0.0.0 port 8000 ...

localhost.localdomain - - [18/Aug/2010 13:50:03] "GET / HTTP/1.1" 200 -

localhost.localdomain - - [18/Aug/2010 13:50:04] code 404, message File not found

localhost.localdomain - - [18/Aug/2010 13:50:04] "GET /favicon.ico HTTP/1.1" 404 -

El resultado es que si se abre un browser y se apunta la direccion ip del computador en el que se digito este comando en el puerto 8000 se va a ver el contenido del directorio que se compartió. Por ejemplo:
Resultados SimpleHTTPServer

Resultados SimpleHTTPServer

Opcionalmente se puede especificar un numero de puerto distinto del default (8000) simplemente agregandolo al final del comando, por ejemplo para utilizar el puerto 8500 el comando quedaria asi:
$ python -m SimpleHTTPServer 8500

Serving HTTP on 0.0.0.0 port 8500 ...

Para detener el servicio basta con digitar CTRL+C.
No sobra advertir que esta utilidad de Python debe ser utilizada con cuidado ya que podriamos exponer información delicada de manera inadvertida sin protección alguna.

Thursday, July 08, 2010

Reseteo Password Root

It is possible to boot a system and log on to the root account without knowing the root password as long as one has access to the console keyboard.

This is a procedure which requires no external boot disks and no change in BIOS boot settings. Here, "Linux" is the label for booting the Linux kernel in the default Debian install.

Solution 1

At the lilo boot screen, as soon as boot: appears (you must press a shift key at this point on some systems to prevent automatic booting and when lilo uses the framebuffer you have to press TAB to see the options you type), enter:

boot: Linux init=/bin/sh

This causes the system to boot the kernel and run /bin/sh instead of its standard init. Now you have gained root privileges and a root shell. Since / is currently mounted read-only and many disk partitions have not been mounted yet, you must do the following to have a reasonably functioning system.

init-2.03# mount -n -o remount,rw /
init-2.03# mount -avt nonfs,noproc,nosmbfs
init-2.03# cd /etc
init-2.03# vi passwd
init-2.03# vi shadow

(If the second data field in /etc/passwd is "x" for every username, your system uses shadow passwords, and you must edit /etc/shadow.) To disable the root password, edit the second data field in the password file so that it is empty. Now the system can be rebooted and you can log on as root without a password. When booting into runlevel 1, Debian (at least after Potato) requires a password, which some older distributions did not.

It is a good idea to have a minimal editor in /bin/ in case /usr/ is not accessible
Also consider installing the sash package. When the system becomes unbootable, execute:

boot: Linux init=/bin/sash

sash serves as an interactive substitute for sh even when /bin/sh is unusable. It's statically linked, and includes many standard utilities as built-ins.

Solution 2

Boot from any emergency boot/root disk set. If /dev/hda3 is the original root partition, the following will let one edit the password file just as easily as the above.

# mkdir fixit
# mount /dev/hda3 fixit
# cd fixit/etc
# vi shadow
# vi passwd

The advantage of this approach over the previous method is one does not need to know the lilo password . But to use it one must be able to access the BIOS setup to allow the system to boot from floppy disk or CD, if that is not already set.

Salva vida

Friday, March 05, 2010

Montar una unidad remota a través de SSH

Montar una unidad remota a través de SSH


1º -Instalar los paquetes:
aptitude install sshfs fuse-utils

2º- Cargar el módulo de fuse y lo meterlo en /etc/modules para que cargue al inicio:
modprobe fuse
echo fuse >> /etc/modules

3º- Dar permiso al usuario que montará la carpeta, estos permisos serán efectivos cuando cierre la sesión y vuelva a logearse en el sistema:
addgroup touzas fuse

4º- Crear un directorio en donde montar el directorio remoto e introducir el comando para montarlo:
mkdir /media/directorio_local
$ sshfs usuario_remoto@servidor_remoto:/directorio_remoto /media/directorio_local

Fuente

Monday, February 15, 2010

Notas Administración Remota en Linux

Conectarse a un escritorio:

1. Desde el equipo local, lanzar un servidor X mínimo con una terminal:

xinit /usr/bin/xterm -- :1 &

2. A partir de aquí existen dos opciones: conectar vía ssh – lo que impone un tráfico adicional que a menudo empeora el tiempo de respuesta durante la conexión – o conectar directamente si se considera que la red es lo suficientemente segura.

2. 1. Por ssh:

ssh -fY máquinaremota/usr/bin/wmaker

2.2. Directamente permitiendo el acceso con xhost:

xhost +máquinaremota
ssh -f máquinaremota /usr/bin/wmaker -display máquinalocal:1

Fuente: muylinux

Tuesday, January 05, 2010

nmap

sudo nmap -v -sS -O xxx.xxx.xxx.xxx

sudo nmap -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 xxx.xxx.xxx.xxx

Tuesday, December 29, 2009

Citrix ICA Client Linux

Obtener el archivo tarball desde la pagina de descarga de citrix

Una ves descargado el archivo tarball, se necesita desempaquetarlo. Se debe colocar en una locacion temporal y descomprimir el archivo. Para el ejemplo, se va a utilizar el directorio /tmp/citrix/. Al crear el directorio temporal, mueva el tarball al directorio e ingrese al mismo:

mkdir /tmp/citrix/

mv linuxx86.tar.gz /tmp/citrix/

cd /tmp/citrix/

Ahora desempaque el archivo tarball:

tar zvxf linuxx86-xx.x.xxxxxxx.tar.gz


Ahora ejecutar el comando de instalacion, para el cual se debe de estar logueado como super usuario (root). Cambiarse a root (utilizando su, o lo que sea).

Ejecute el script de instalacion, y continue con las instrucciones tal cual se muestran:

./setupwfc

Una ves culminado el proceso de instalacion se debe de modificar el usuario y grupo al cual pertenece el directorio oculto /home/$user/.ICAClient

Reiniciar el navegador

Monday, December 28, 2009

Busqueda y Destruccion

find directorio_busqueda -name '*.extension_a_eliminar*' -exec rm -rfv {} \;
Enlace a lo proyecto Spread Open Media