このトピックでは、Windows および Linux サーバーで NAS 共有ディレクトリを照会する方法について説明します。
Windows での照会 (SMB)
- ローカルマシンにマウントされているリモートディレクトリを一覧表示します。
- コマンド プロンプトまたは PowerShell を開きます。
net useを実行して、ローカルマシンにマウントされているすべての SMB 共有ディレクトリを一覧表示します。
PS C:> net use New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- OK Z: \\1xxx5\sharepath Microsoft Windows Network The command completed successfully. - リモートホスト上の共有ディレクトリを一覧表示します。
- コマンド プロンプトまたは PowerShell を開きます。
net view \\[remote-host-ip]を実行して、リモートホスト上の SMB 共有ディレクトリを一覧表示します。
PS C:> net view \\1xxx5 Shared resources at \\1xxx5 Share name Type Used as Comment ------------------------------------------------------------------------------- sharepath Disk test Disk Home Directories The command completed successfully. - ローカルマシン上の共有リソースを一覧表示します。
- コマンド プロンプトまたは PowerShell を開きます。
net shareを実行して、ローカルマシン上の共有リソースを一覧表示します。
PS C:> net share Share name Resource Remark ------------------------------------------------------------------------------- C$ C:\ Default share D$ D:\ Default share IPC$ Remote IPC ADMIN$ C:\Windows Remote Admin The command completed successfully.
Linux での照会 (NFS/SMB)
- NFS 共有ディレクトリを一覧表示します。
- オプション 1: サーバーまたはクライアントで
showmount -e [server_ip_or_hostname]を実行します。説明hostnameサーバー上では、IP アドレスまたはホスト名を省略できます。- その他の
showmountパラメーターには、次のものがあります。-d: NFS クライアントがマウントしているディレクトリのみを表示します。-a: クライアントのホスト名と、マウントされているサーバーのディレクトリを一覧表示します。
例:
showmount -e 192.168.0.214を実行します。root@xxx:~# showmount -e xxx.xxx.x.xxx Export list for xxx.xxx.x.xxx: /home/read_only * /home/all_share * root@xxx:~#説明 アスタリスク (*) は、ディレクトリがすべてのクライアントからアクセス可能であることを示します。IP アドレスが表示されている場合、そのクライアントのみがディレクトリにアクセスできます。 - オプション 2: サーバーで
exportfs -vを実行します。root@xxx:~# exportfs -v /home/all_share <world>(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash) /home/read_only <world>(ro,wdelay,no_root_squash,no_subtree_check,sec=sys,ro,secure,no_root_squash,no_all_squash) root@xxx:~# root@xxx:~# root@xxx:~# root@xxx:~#説明 <world> は、ディレクトリが任意のホストからアクセスできることを示します。IP アドレスが表示されている場合、指定されたホストのみがディレクトリにアクセスできます。
- オプション 1: サーバーまたはクライアントで
- SMB 共有ディレクトリを一覧表示します。
サーバーまたはクライアントで
smbclient -L //[server_ip] -U [samba_username]を実行します。説明smbclientコマンドが見つからない場合は、ツールをインストールしてください。たとえば、Ubuntu ではapt install smbclientを実行できます。例:
smbclient -L //192.168.0.215 -U testを実行します。説明hostnameサーバー上では、IP アドレスの代わりにホスト名も使用できます。root@xxx:~# smbclient -L //xxx.xxx.x.xxx -U test WARNING: The "syslog" option is deprecated Enter WORKGROUP\test's password: Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers sharepath Disk Shared directory IPC$ IPC IPC Service (xxx) test Disk Home Directories Reconnecting with SMB1 for workgroup listing.