Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

Yes, you can.

The solution (found thanks to is to look at the directory /var/lib/samba/usershares : it contains one file per share, and each file has a line starting with path= containing the local path

share|improve this answer

Your Answer


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.