This topic explains how to query NAS shared directories on Windows and Linux servers.
Query on Windows (SMB)
- List remote directories mounted on the local machine.
- Open Command Prompt or PowerShell.
- Run
net useto list all SMB shared directories mounted on the local machine.
PS C:> net use New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- OK Z: \\1xxx5\sharepath Microsoft Windows Network The command completed successfully. - List the shared directories on a remote host.
- Open Command Prompt or PowerShell.
- Run
net view \\[remote-host-ip]to list the SMB shared directories on the remote host.
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. - List shared resources on the local machine.
- Open Command Prompt or PowerShell.
- Run
net shareto list the shared resources on the local machine.
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.
Query on Linux (NFS/SMB)
- List NFS shared directories.
- Option 1: Run
showmount -e [server_ip_or_hostname]on the server or the client.Note- On the server, you can omit the IP address or
hostname. - Other
showmountparameters include:-d: Displays only directories mounted by an NFS client.-a: Lists shared directories on the server and the mount points on the client.
Example: Run
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:~#Note An asterisk (*) indicates that the directory is accessible to all clients. If an IP address is displayed, only that client can access the directory. - On the server, you can omit the IP address or
- Option 2: Run
exportfs -von the server.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:~#Note <world> indicates that the directory is accessible from any host. If an IP address is displayed, only the specified host can access the directory.
- Option 1: Run
- List SMB shared directories.
Run
smbclient -L //[server_ip] -U [samba_username]on the server or the client.Note If thesmbclientcommand is not found, install the tool. For example, on Ubuntu, you can runapt install smbclient.Example: Run
smbclient -L //192.168.0.215 -U test.Note On the server, you can also use thehostnameinstead of an IP address.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.