Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a practical way, e.g. net command or other cli to get a list of all shares defined on a Linux server (Ubuntu distribution) listing not only the share name but also the full path to the local shared directory? Without having to look at samba config files or user shares files.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

No, you cant

smbclient -L 

Shows the shares, but you have to look this up in your smb.conf to find the path.

share|improve this answer

Try this script ... feel free to improve it

#!/bin/bash
while read line; do
    [[ "$line" =~ ^\[ ]] && name="$line"
    [[ "$line" =~ ^[[:space:]]*path ]] && echo -e "$name\t$line"
done </etc/samba/smb.conf
share|improve this answer
    
Nice one, I'll try it. Meanwhile I guess it will miss usershares –  a1an May 31 '12 at 12:12
    
Confirmed to miss usershares, I've improved on your script to include them –  a1an Jun 18 '12 at 12:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.