Nowe posty

Autor Wątek: AUTOFS - problem z prawidłowym skonfigurowaniem  (Przeczytany 6082 razy)

Offline

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 170
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« dnia: 2011-02-08, 11:14:18 »
Witam.

Znalazłem w internecie opis montowania zasobów sieciowych poprzez AUTOFS. Według tego opisu program umożliwia automatyczne montowanie i odmontowywanie zdalnych zasobów. Na przykład gdy wyłączę komputer zdalny bez poprzedniego odmontowania to nic złego dziać się nie będzie.

Według opisu który znalazłem w tym miejscu zrobiłem tak.

Na początek trochę danych.
1. Adres sieciowy zasobu który chcę zamontować to

//laptop/udostepniony
laptop to nazwa sieciowa komputera na którym znajduje się udostępniony katalog o nazwie udostepniony

2. Katalog do którego chcę zamontować zdalny zasób to

/mnt/msi
3. System operacyjny Linux Mandriva 2010.2

Zgodnie z opisem

Wyedytowałem plik

/etc/autofs/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc    /etc/autofs/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#    "nosuid" and "nodev" options unless the "suid" and "dev"
#    options are explicitly given.
#
#/net    -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
Następnie wyedytowałem plik

/etc/autofs/auto.misc
i dopisałem do niego regułkę która montuje zasób sieciowy posiadający hasło.

#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

#cd        -fstype=iso9660,ro,nosuid,nodev    :/dev/cdrom

# the following entries are samples to pique your imagination
#linux        -ro,soft,intr        ftp.example.org:/pub/linux
#boot        -fstype=ext2        :/dev/hda1
#floppy        -fstype=auto        :/dev/fd0
#floppy        -fstype=ext2        :/dev/fd0
#e2floppy    -fstype=ext2        :/dev/fd0
#jaz        -fstype=ext2        :/dev/sdc1
#removable    -fstype=ext2        :/dev/hdd
/mnt/msi -fstype=cifs,rw,noperm,user=xxx,pass=yyy ://laptop/udostepniony
Z opisu zrozumiałem (nie wiem czy prawidłowo), że komp jest to nazwa zdalnego komputera. xxx to nazwa użytkownia, yyy to hasło do zasobu sieciowego.

Wchodzę do katalogu /mnt/msi a tam pusto czyli zasób nie został zamontowany. Jedyne co pozostaje mi napisać to

HELP ME co robię źle?

:(

Offline vanhelzing

  • Users
  • Prawie jak Guru
  • ****
  • Wiadomości: 314
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #1 dnia: 2011-02-10, 00:35:32 »
Cytuj
/misc    /etc/autofs/auto.misc
W auto.master masz ustalony mountpoint na /misc, więc raczej w /mnt/msi go nie zobaczysz.

Offline

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 170
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #2 dnia: 2011-02-10, 07:59:31 »
Cytat: vanhelzing
Cytuj
/misc    /etc/autofs/auto.misc
W auto.master masz ustalony mountpoint na /misc, więc raczej w /mnt/msi go nie zobaczysz.
Czyli ten wpis powinien wyglądać

/mnt/msi /etc/autofs/auto.misc
???

EDIT

Zmieniłem teraz zawartość plików na:

/etc/autofs/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/mnt/msi /etc/autofs/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
#/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/etc/autofs
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

#cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

# the following entries are samples to pique your imagination
#linux -ro,soft,intr ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd
/mnt/msi -fstype=cifs,rw,noperm,user=xxx,pass=yyy ://laptop/udostepniony
Ale dalej nie montuje się :(

Offline vanhelzing

  • Users
  • Prawie jak Guru
  • ****
  • Wiadomości: 314
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #3 dnia: 2011-02-10, 15:16:13 »
Nie używałem samby tylko nfs, ale powinno to wyglądać podobnie.

Wydziel sobie osobny katalog poza standardowym drzewem, bo po podmontowaniu autofs go przykryje. Automatycznie podmontowane zasoby są widoczne jako podkatalogi w autofs.

auto.master
/mnt/storage /etc/auto.storage --ghost --timeout=60
Podmontuje Ci /mnt/storage jako autofs z zasobami zdefiniowanymi w /etc/auto.storage. Katalog /mnt/storage będzie tworzony automatycznie przez autofs, więc nie rób tego sam. Parametr ghost powinien być dodany, timeout ustalasz doświadczalnie.

W /etc/auto.storage:
msi -fstype=cifs,rw,noperm,user=xxx,pass=yyy ://laptop/udostepniony
Ten wpis stworzy podkatalog msi w zamontowanym autofs, czyli katalog /mnt/storage/msi.

1) Nie twórz katalogów, autofs sam je stworzy (tutaj /mnt/storage i /mnt/storage/msi).
2) Ustaw prawa dostępu do plików konfiguracyjnych na 0644 (chyba, że używasz skryptów konfiguracyjnych, wtedy musisz jeszcze nadać prawo do wykonania, ale tylko wtedy).
3) Zakładam, że kernel obsługuje Ci autofs (cat /proc/filesystems) oraz startujesz usługę (daemona) autofs, więc nie zapomnij jej zrestartować po zmianach. Czasami warto też zrestartować cały system, bo trzyma różne śmieci w cache'u i wszystko magicznie zaczyna działać po restarcie.
4) Nie jestem pewien co do ustawień samej samby, ale dla nfs to działa.

Offline

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 170
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #4 dnia: 2011-02-13, 08:56:05 »
Cytat: vanhelzing
1) Nie twórz katalogów, autofs sam je stworzy (tutaj /mnt/storage i /mnt/storage/msi).
2) Ustaw prawa dostępu do plików konfiguracyjnych na 0644 (chyba, że używasz skryptów konfiguracyjnych, wtedy musisz jeszcze nadać prawo do wykonania, ale tylko wtedy).
3) Zakładam, że kernel obsługuje Ci autofs (cat /proc/filesystems) oraz startujesz usługę (daemona) autofs, więc nie zapomnij jej zrestartować po zmianach. Czasami warto też zrestartować cały system, bo trzyma różne śmieci w cache'u i wszystko magicznie zaczyna działać po restarcie.
4) Nie jestem pewien co do ustawień samej samby, ale dla nfs to działa.
Zrobiłem tak:

1.
[gienek@stacjonarny ~]$ cat /etc/autofs/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/mnt/storage /etc/auto.storage --ghost --timeout=60
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
#/net   -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
Na samym dole jest taki wpis +auto.master. Nic on nie szkodzi? Był on po zainstalowaniu więc go nie ruszałem.

2.
[gienek@stacjonarny ~]$ cat /etc/autofs/auto.storage
msi -fstype=cifs,rw,noperm,user=******,pass=********** ://laptop/udostepniony
[gienek@stacjonarny ~]$
3.
[gienek@stacjonarny ~]$ ls -l /etc/autofs/*.*
-rw-r--r-- 1 root root 3452 2010-03-15 19:07 /etc/autofs/autofs.conf
-rw------- 1 root root 2726 2010-03-15 19:07 /etc/autofs/autofs_ldap_auth.conf
-rw-r--r-- 1 root root  690 2011-02-13 07:36 /etc/autofs/auto.master
-rw-r--r-- 1 root root  607 2011-02-13 07:38 /etc/autofs/auto.misc
-rwxr-xr-x 1 root root 1237 2010-03-15 19:07 /etc/autofs/auto.net*
-rwxr-xr-x 1 root root  660 2010-03-15 19:07 /etc/autofs/auto.smb*
-rw-r--r-- 1 root root   78 2011-02-13 08:36 /etc/autofs/auto.storage
-rw------- 1 root root   35 2011-02-08 14:44 /etc/autofs/smb.auth
[gienek@stacjonarny ~]$
Zadbałem tylko o uprawnienia plików tych co w nich grzebałem czyli auto.master i auto.storage. Czy uprawnienia pozmieniać też i innym plikom?

4.
[root@stacjonarny gienek]# /etc/init.d/autofs restart
Zatrzymywanie autofs:                                    [    OK    ]
Uruchamianie autofs:                                     [    OK    ]
[root@stacjonarny gienek]#
5.
[gienek@stacjonarny ~]$ ls /mnt
msi/  storage/
[gienek@stacjonarny ~]$
[gienek@stacjonarny ~]$ ls /mnt/storage
[gienek@stacjonarny ~]$
Niestety w /mnt/storage nie pojawił się katalog msi. Co robię nadal źle? Restart komputera nie pomaga :(

Offline vanhelzing

  • Users
  • Prawie jak Guru
  • ****
  • Wiadomości: 314
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #5 dnia: 2011-02-13, 12:44:49 »
/etc/auto.master
/mnt/storage /etc/auto.storage --ghost --timeout=60
U Ciebie plik "auto.storage" jest w katalogu "/etc/autofs/auto.storage", więc powinno być:

/etc/auto.master
/mnt/storage /etc/autofs/auto.storage --ghost --timeout=60

Offline

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 170
    • Zobacz profil
AUTOFS - problem z prawidłowym skonfigurowaniem
« Odpowiedź #6 dnia: 2011-02-13, 15:27:50 »
Cytat: vanhelzing
/etc/auto.master
/mnt/storage /etc/auto.storage --ghost --timeout=60
U Ciebie plik "auto.storage" jest w katalogu "/etc/autofs/auto.storage", więc powinno być:

/etc/auto.master
/mnt/storage /etc/autofs/auto.storage --ghost --timeout=60
Działa.
Dzięki. Jesteś wielki.