[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 2 Probleme: Mount und Gateway



Moin,

On Thu, Sep 27, 2007 at 07:52:59AM +0200, Stefan Heinrich wrote:
> Hallo,
> 
> habe da zwei Probleme mit meinem Debian "Etch":
> 
> a) Mount
> Meine </etc/fstab> sieht folgendermaßen aus:
> 
> # /etc/fstab: static file system information.
> #
> # <file system> <mount point> <type> <options> <dump> <pass>
> proc /proc proc defaults 0 0
> /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
> /dev/hdd1 /home ext3 usrquota,grpquota 0 2
> /dev/hda5 /tmp ext3 defaults 0 2
> /dev/hdb6 /usr ext3 defaults 0 2
> /dev/hda6 /var ext3 defaults 0 2
> /dev/hdb5 none swap sw 0 0
> /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
> //fscera/dateien$ /media/dateien smbfs username=***,password=***,rw,auto 0 
> 0
> //fscera/exact$ /media/exact smbfs username=***,password=***,rw,auto 0 0
> //fscera/install$ /media/install smbfs username=***,password=***,rw,auto 0 
> 0
> 
> Nun muss ich aber nach dem Systemstart mit <mount -a> die 
> Netzwerklaufwerke manuell "holen" denn automatisch werden die drei 
> Netzlaufwerke nich eingebunden. Warum macht Debian das nicht automatisch? 
> Was (und wo) muss ich anders konfigurieren?

Es gibt eine andere Möglichkeit: Anstelle der statischen Einträge kann das 
Subsystem "autofs" verwendet werden.  Dazu muss das Paket autofs
installiert werden:

  sudo apt-get install autofs

Es ist mir unklar, warum die Netzwerklaufwerke unter /media erscheinen 
sollen.  Dieses Verzeichnis ist eigentlich nur für lokal eingesteckte
Medien gedacht.  Ich schlage deshalb vor, ein Pseudo-Verzeichnis 
"/cifs" oder "/smb" zu verwenden.  Ich mache das normalerweise so, dass
ich dazu in die Datei /etc/auto.master folgende Zeile eintrage:

  /cifs   /etc/auto.cifs

Die Datei /etc/auto.cifs existiert im Paket autofs noch nicht und muss 
angelegt werden.  Ich habe da folgendes Skript drin:
----------- 8< ---- 8< ------- schnipp schnapp ------- 8< ---- 8< -----------
#!/bin/bash

# $Id$

# This file must be executable to work! use chmod 755 /etc/auto.cifs !
# To make use of it, you probably have to customize the following
# line:
mountopts="-fstype=cifs,file_mode=0644,dir_mode=0755,uid=user,gid=users"

# For each Samba- or Windows-Server you want to access, you have to 
# create and provide a so called credfile containing two lines 
#   username=user
#   password=secretpassword
# with the user name and password needed to login on that server.

key="$1"
if echo "$key" | grep -q '/'
then # Prevent endless recursion
     exit 1
fi
credfile="/etc/auto.cifs.$key"
if [ ! -e "$credfile" ]
then credfile="/etc/auto.smb.$key"
fi
smbclientopts=""

for P in /bin /sbin /usr/bin /usr/sbin
do
        if [ -x $P/smbclient ]
        then
                SMBCLIENT=$P/smbclient
                break
        fi
done

[ -x $SMBCLIENT ] || exit 1

if [ -e "$credfile" ]
then
        mountopts=$mountopts",credentials=$credfile"
        smbclientopts="-A "$credfile
else
        smbclientopts="-N"
fi

$SMBCLIENT $smbclientopts -gL $key 2>/dev/null \
   | awk -v key="$key" -v opts="$mountopts" -F'|' -- '
        BEGIN   { ORS=""; first=1 }
        /Disk/  { if (first) { print opts; first=0 }; 
	          sub(/ /, "\\ ", $2); 
		  print " \\\n\t /" $2, "://" key "/" $2 }
        END     { if (!first) print "\n"; else exit 1 }
        '
----------- 8< ---- 8< ------- schnipp schnapp ------- 8< ---- 8< -----------
Dieses Skript ist eine Variation des im Paket autofs enthaltenen Skriptes
/etc/auto.smb  Der wesentliche Unterschied ist die Sache mit den 
sogenannten "credential"-Dateien:  Für jeden Windows bzw. Samba-Server
muss eine Datei namens "/etc/auto.cifs.SAMBASERVERNAME" angelegt werden,
die je zwei Zeilen für Username und Passwort enthält.  Diese Dateien
müssen aus Sicherheitsgründen die Rechte 600 oder 400 haben, damit 
nur root sie lesen kann.

Gruß, 
Peter Funk
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)



Reply to: