[ImoLUG] Un "utile" script per montare filesystem della nostra rete con tunneling ssh

Daniele Tampieri daniele.tampieri@ieee.org
Mer 11 Gen 2012 13:25:13 CET


Bello. Lo includiamo nella prossima
Newsletter?

Ciao
Daniele

2012/1/11 Luca Lama <angelus491@gmail.com>:
> #!/bin/sh
> #needed nmap, sshfs, fusermount
> #this script helps you to find and mount other filesystem you have access to
> with ssh
> #
> #
>
> echo "want you to mount or umount?"
> read c
> a="mount"
> b="umount"
> if [ "$c" = "$a" ] #un modo terribile di confrontare due stringhe
> then
>    echo "insert one of the network addresses below within the format
> xxx.xxx.xxx.0/24 if there are none you are not connected to any network"
>    ifconfig |grep inet:
>    echo "address="
>    read addr
>    echo "select from the hosts below"
>    nmap "$addr"
>    echo "host="
>    read host
>    ping -c 1 -w 1 $host >/dev/null;
>    if [ ! $? -eq 0 ]
>    then
>        echo " $host is not connected press enter to exit"
>        read c
>        exit 1
>    fi
>    echo mounting...
>    mkdir ~/Scrivania/sftp
>    sshfs $host:/ ~/Scrivania/sftp
>    if [ ! $? -eq 0 ]
>    then
>        rm -r ~/Scrivania/sftp
>        exit 1
>    fi
>    sleep 1s
> elif [ "$c" = "$b" ]
> then
>    if [ ! -d ~/Scrivania/sftp ]
>    then
>        echo "it wasn't mounted press enter to exit"
>        read c
>        exit 1
>    fi
>    echo umounting...
>    fusermount -u ~/Scrivania/sftp
>    sleep 2s
>    rm -r ~/Scrivania/sftp
> else
>    echo "quit"
> fi
> exit 0
> _______________________________________________
> ImoLUG mailing list
> imolug@lists.linux.it
> http://lists.linux.it/listinfo/imolug
> Connettivita' offerta da Waymedia - http://www.waymedia.it/


Maggiori informazioni sulla lista ImoLUG