Who's Using Samba?

By Sandra Henry-Stocker  Add a new comment

Samba provides a set of tools that allow Unix systems to share resources with their Windows counterparts and is both easy to set up and remarkably reliable. Still, there are times when you might want to take a look at who is using your Samba services. When these occasions arise, the smbstatus command can tell you a lot, but not all of its output is necessarily easy to understand.

Some of the Samba output looks like the table below.

PID     Username      Group         Machine
-------------------------------------------------------------------
897       gregp         devguys       dragonfly   (10.9.9.123)
934       karens        devguys       butterfly   (10.9.9.101)
915       mannyg        devguys       tadpole     (10.9.9.134)

This output shows the process IDs of the smbd process for each active user's process. We then see the username and user group for each user, plus the system name and IP address of the client they are using to access the Samba shares.

The next section provides some of the same and some additional information. Here we see the time each user mapped the shared resource on the client system.

Service      pid     machine       Connected at
-------------------------------------------------------
gregp        897   dragonfly     Wed Feb 18 08:01:14 2009
karens       934   butterfly     Wed Feb 18 09:23:57 2009
mannyg       915   tadpole       Wed Feb 18 08:42:46 2009

If you request a brief report using the -b option, you will only see the first table shown above. With a full report (no options), you will also see a list detailing the file locks that are in place. As with any type of file system, Samba needs some way to keep multiple users from attempting to update a file at the same time. One way it does this is by providing something called opportunistic locks or "oplocks" for short. As you can see in the listing below, one column in the locked files report describes oplocks that are placed on files that are being used by the various Samba users.

Locked files:
Pid     Uid      DenyMode     Access      R/W       Oplock   SharePath   Name   Time
----------------------------------------------------------------------------------------
897   4056    DENY_NONE  0x2019f    RDWR    EXCLUSIVE+BATCH  /homes/gregp   

.metadata/.lock   Wed Feb 18 08:32:05 2009
897   4056    DENY_NONE  0x2019f    RDWR    EXCLUSIVE+BATCH  /homes/gregp   

.metadata/.plugins/org.eclipse.cdt.core/sms-latest.1234971877375.pdom   
Wed Feb 18 10:41:28 2009
1252  1111    DENY_NONE  0x100001 RDONLY  NONE             /spare .   Wed Feb 18 

11:53:00 2009
1252  1111    DENY_NONE  0x20089   RDONLY  EXCLUSIVE+BATCH  /homes/racheller   smb.conf  

 Wed Feb 18 14:45:42 2009

Exclusive oplocks are fairly straightforward. A Samba user opens a file and nobody else can touch it. These locks are fairly efficient, especially if the user is making a lot of changes to the file. Sometimes even exclusive locks can be broken by the server, however, which then instructs the client to send any updates it has cached.

Batch oplocks implies that updates to locked files are grouped together so that multiple connections don't have to be set up, used and then shut down.

The locked files report will give you some idea about the files that Samba users are updating. Since the locks themselves are handled by Samba and the SMB (Server Message Block) or CIFS (Common Internet File System) protocols, you don't need to be too concerned about them beyond noting their use.

ITworld LIVE

IT Management/StrategyWhite Papers & Webcasts

White Paper

The Cloud: Reinventing Enterprise Collaboration

Collaboration and content sharing are not, of course, new concepts. But cloud computing has changed the nature of collaboration, content sharing, document storage and project management to enable more efficient, faster-acting and cost-effective enterprises. According to a new study by IDG Research, the vast majority of knowledge workers (86%) placed a very high level of importance on collaborating with internal coworkers and external stakeholders, and having access to the most up-to-date corporate information. Read how organizations are realizing massive productivity gains by transitioning their content management solutions to cloud-based models.

White Paper

Empowering Your Mobile Worker

Today's most productive employees are mobile, and your company's IT strategy must be ready to support them with 24/7 access to the business information they need across a range of mobile devices.See how corporations are meeting the many needs of their mobile workers with the help of Box.

White Paper

Market Landscape Report: Online File Sharing and Collaboration in the Enterprise

The trend toward "consumerization" marches onward in IT; more and more end-users are choosing their own hardware plaforms and software applications in lieu of the IT-sanctioned business tools provided by their companies. These end-users are looking to tackle issues like data sharing, portability, and access from multiple intelligent endpoint devices, creating a conundrum for IT as it needs to balance business enablement, ease of access, and collaborative capacity with the need to maintain control and security of information assets. This need for balance is one of the drivers of the fast growing online file sharing and collaboration segment of the SaaS market. This paper examines the market drivers, inhibitors, and top vendors in this segment, including Box, Citrix Sharefile, Dropbox, Egnyte, Nomadesk, Sugarsync, Syncplicity and YouSendIt.

White Paper

Sharing Simplified - Consolidating File-sharing Technologies

Employees need to share content with colleagues within their organization and outside. Yet, ECMs make it hard to share content within a business and impossible between organizations. Read how one company consolidated multiple file sharing technologies to increase productivity and reduce complexity.

White Paper

Content Sharing 2.0: The Road Ahead

A growing number of companies are taking advantage of the natural synergies that exist between cloud-based IT services and content access and sharing. Legacy content management and collaboration systems simply weren't designed to meet the evolving requirements of today's IT and business managers, as well as the needs of content users. Box provides cloud-based content storage, access and collaboration services that require virtually no user training and supports file access and delivery on almost all popular PC and mobile devices. Read how Box let companies rapidly implement a cost-effective and secure content storage and sharing system that can easily expand to accommodate any size and number of files.

See more White Papers | Webcasts

Ask a question

Ask a Question