How to list Windows shares from terminal?
Solution 1
If you've already used Nautilus to connect to the shares you're interested in, then the mounts for those shares are available in ~/.gvfs
So I've gone to my nautilus and typed smb://192.168.1.10/data into my location bar, which has mounted the share. Then :
scaine@GroovyTosh:~/.gvfs$ ls -al
total 20
dr-x------ 3 scaine scaine 0 2010-12-31 18:47 .
drwx------ 68 scaine scaine 20480 2010-12-31 19:42 ..
drwx------ 1 scaine scaine 0 2010-10-05 19:57 data on 192.168.1.10
scaine@GroovyTosh:~/.gvfs$
If you need to list available shares, then as Danny says, you use smbclient. In my case, I use "share" security model (not recommended!), so I don't need the -U parameter :
scaine@GroovyTosh:~/.gvfs$ smbclient -L 192.168.1.10
Enter scaine's password:
Domain=[Mine] OS=[Unix] Server=[Samba 3.5.4]
Sharename Type Comment
--------- ---- -------
Data Disk Core Data
Backups Disk Daily RSnapshot backups
IPC$ IPC IPC Service (Core)
Domain=[Mine] OS=[Unix] Server=[Samba 3.5.4]
Server Comment
--------- -------
CORE Core
Workgroup Master
--------- -------
Mine CORE
scaine@GroovyTosh:~/.gvfs$
Solution 2
smbclient may be able to list the shares available on a windows machine, but not the machines.
http://www.samba.org/samba/docs/man/manpages-3/smbclient.1.html
smbclient -L <windows-box> -U <username>
Solution 3
smbclient -U windowsUserName%password -L windowsHost -W domainName
Related videos on Youtube
Zabba
Updated on September 17, 2022Comments
-
Zabba over 1 year
Here is a simple scenario I have:
- Windows 7 is sharing a folder (D:\Projects).
- Full Control permissions have been given to the folder.
- In Ubuntu 10.10, I can see the Windows shares from Places -> Network menu.
- I can create a folder in the shared Projects folder from Nautilus
How do I
ls
those same folders (displayed in Nautilus) from the terminal? (mount
andls /mnt
do not list those Windows shares)Ps. Details on what I am doing:
- Using Ubuntu as a "headless" VM using VirtualBox.
- Accessing Ubuntu via PuTTY
- Ability to give complete access to the Ubuntu VM for the Windows shared folder