Solved

Linux: How do I get a list of SAMBA shares and their corresponding folders?

Posted on 2014-12-04
5
286 Views
Last Modified: 2014-12-08
We are running Linux openSUSE 12.2.
How do I get a list of SAMBA shares and their corresponding folders?
0
Comment
Question by:bax2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:mbertl
ID: 40480255
You can get that with: smbclient -L <host> -U <user> and then you get asked for the password. Enter the password for that given username and you get a list like this:

[11:28:02][s1gny@opteron.local]
[/home/s1gny]$ smbclient -L localhost
Enter s1gny's password:
Domain=[SUPERNET] OS=[Unix] Server=[Samba 4.1.1]

      Sharename       Type      Comment
      ---------       ----      -------
      camera-archiv   Disk      
      scan            Disk      
      tmp             Disk      
      raid5           Disk      
      daten           Disk      
      root directory  Disk      
      iX-6850         Printer   Samsung CLX-6220 Series (samsung)
      Stylus-Photo-R320 Printer   EPSON Stylus Photo R320
      clx6220         Printer   clx6220
      IPC$            IPC       IPC Service (Opteron (4.1.1))
      s1gny           Disk      Home Directories
Domain=[SUPERNET] OS=[Unix] Server=[Samba 4.1.1]

      Server               Comment
      ---------            -------

      Workgroup            Master
      ---------            -------
0
 
LVL 12

Accepted Solution

by:
andreas earned 500 total points
ID: 40480401
The folders to the respective shares can be found in the samba configuration which can be found in

/etc/samba/smb.conf

each share has a section [sharename] and in this section there is an option
path = where you can see which path on the filesystem the share is shareing.

over the smb-protocol there is no way to find this out.
0
 

Expert Comment

by:Lelio Michele Lattari
ID: 40480424
testparm
0
 

Author Comment

by:bax2000
ID: 40486284
/etc/samba/smb.conf   works well but how can I pipe it to a file and keep the same neat formatting?
If I use >  to pipe to a text file it does not keep the format.
0
 
LVL 12

Expert Comment

by:andreas
ID: 40486322
try

cat smb.conf |grep -v -e global -e logon -e homes | grep -e '\[' -e 'path' >~/out.txt

Open in new window


this will put only the share names in [] and the corresponging paths in the output file. the rest will be cut away.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question