以下のエントリを/etc/fstabに含め、/path/to/mount/dirに//192.168.12.3/share をマウントすることを考える。これではおそらくパッケージ不足でマウントに失敗。
# grep smbfs /etc/fstab //192.168.12.3/share /path/to/mount/dir smbfs username=hoge,gid=1000,uid=1000,iocharset=utf8,rw,defaults,noauto 0 0 # mount /path/to/mount/dir mount: unknown filesystem type 'smbfs'
必要なパッケージ (smbclient) をインストールしたつもり。これでもsmbfsファイルシステムが見つからないといわれる。
# apt-get install smbclient Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: cifs-utils The following NEW packages will be installed: smbclient 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 5,568 kB of archives. After this operation, 43.1 MB of additional disk space will be used. Get:1 http://ftp.jp.debian.org/debian/ wheezy/main smbclient i386 2:3.6.6-6 [5,568 kB] Fetched 5,568 kB in 4s (1,322 kB/s) (Reading database ... 72914 files and directories currently installed.) Unpacking smbclient (from .../smbclient_2%3a3.6.6-6_i386.deb) ... Processing triggers for man-db ... Setting up smbclient (2:3.6.6-6) ... # mount /path/to/mount/dir mount: unknown filesystem type 'smbfs'
/etc/fstabのsmbfs部分をcifsで書き換え。マウントすると今度はメッセージが変わる。読み込み専用でマウントしようとしたけどだめだったらしい。
# sed -i -e 's/smbfs/cifs/' /etc/fstab # grep cifs /etc/fstab //192.168.12.3/share /path/to/mount/dir cifs username=hoge,gid=1000,uid=1000,iocharset=utf8,rw,defaults,noauto 0 0 # mount /path/to/mount/dir mount: block device //192.168.12.3/share is write-protected, mounting read-only mount: cannot mount block device //192.168.12.3/share read-only
cifs-utilsをインストール。これは smbclient の suggests に載っている。再度マウント。マウントに成功。
# apt-get install cifs-utils Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: keyutils The following NEW packages will be installed: cifs-utils keyutils 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/109 kB of archives. After this operation, 339 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Selecting previously unselected package cifs-utils. (Reading database ... 72940 files and directories currently installed.) Unpacking cifs-utils (from .../cifs-utils_2%3a5.5-1_i386.deb) ... Selecting previously unselected package keyutils. Unpacking keyutils (from .../keyutils_1.5.5-3_i386.deb) ... Processing triggers for man-db ... Setting up cifs-utils (2:5.5-1) ... Setting up keyutils (1.5.5-3) ... # mount /path/to/mount/dir Password: # df | grep /path/to/mount/dir //192.168.12.3/share 488384508 243017176 245367332 50% /path/to/mount/dir
smbclient は不要かもしれないので purge して再度マウントテスト。マウントに成功するので、smbclientは削除しておく。
# umount /path/to/mount/dir # apt-get purge smbclient Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: smbclient* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 43.1 MB disk space will be freed. Do you want to continue [Y/n]? Y (Reading database ... 72973 files and directories currently installed.) Removing smbclient ... Processing triggers for man-db ... # mount /path/to/mount/dir Password: # !df df | grep /path/to/mount/dir //192.168.12.3/share 488384508 243017176 245367332 50% /path/to/mount/dir
windows 10 のファイル共有に debian 9 から接続
# mount \ -t cifs \ //192.168.XXX.YYY/share \ /path/to/mountpoint \ -o vers=3.0,sec=ntlmsspi,username=windowsuser,gid=linuxuser,uid=linuxuser,iocharset=utf8,dir_mode=0755,file_mode=0644 \ ; # grep \ 'cifs' \ /etc/fstab \ ; //192.168.XXX.YYY/share /path/to/mountpoint cifs vers=3.0,sec=ntlmsspi,username=windowsuser,gid=linuxuser,uid=linuxuser,iocharset=utf8,dir_mode=0755,file_mode=0644,rw,defaults,noauto 0 0 # mount \ /path/to/mountpoint \ ;
windows 7 のファイル共有に debian 9 から接続してもうまくいかない
# mount -t cifs //192.168.22.4/share /path/to/mountpoint --verbose -o vers=2.0,sec=ntlmv2,username=windowsuser Password for windowsuser@//192.168.22.4/share: ****** mount.cifs kernel mount options: ip=192.168.22.4,unc=\\192.168.22.4\share,vers=2.0,sec=ntlmv2,user=windowsuser,pass=******** mount error(112): Host is down Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) # smbclient --list 192.168.22.4 --user windowsuser --max-protocol SMB2 WARNING: The "syslog" option is deprecated Enter windowsuser's password: Connection to 192.168.22.4 failed (Error NT_STATUS_CONNECTION_REFUSED) # smbclient --debuglevel 10 --list 192.168.22.4 --user windowsuser --max-protocol SMB2
- Nbtss: SESSION REQUEST, Length =68 PacketType: SESSION REQUEST, 129(0x81) - Flags: Add 0 to Length Reserved: (0000000.) Extension: (.......0)Add 0 to Length Length: 68(0x44) - CalledName: *SMBSERVER <0x20> File Server Service Name: *SMBSERVER - CallingName: LINUXSERVER <0x00> Workstation Service Name: LINUXSERVER
- Nbtss: NEGATIVE SESSION RESPONSE, Length =1 PacketType: NEGATIVE SESSION RESPONSE, 131(0x83) - Flags: Add 0 to Length Reserved: (0000000.) Extension: (.......0)Add 0 to Length Length: 1(0x1) ErrorCode: Error: Called name not present. 130(0x82)
> netstat -nato