Code I/O

A topnotch WordPress.com site

5 Minutes on Linux: Unable to remove user shares

Leave a comment

Problem: Sharing directories in Linux using samba is common.  However, there are instances, when users who shared them are no longer on the system (probably removed).  The share names they used stay in the system as zombie entries.  When some one wants to share a directory using a name that was zombied, it is not possible.  The SMB protocol uses unique share names.

Challenge: for GUI users, one does not have a facility to unshare or manage the orphan shares.

Solution 1 (to unshare): use the command line:

net usershare list
net usershare delete sharename

Solution 2 (to remove orphan shares):

ls -l /var/lib/samba/usershares
sudo rm /var/lib/samba/usershares/sharename

Once this is done, users will be able to reuse the share name again.  Better approach is to automate removal of share entries from /var/lib/samba/usershares (owned by users) when the user is removed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s