Follow by Email

Blog Archive

Search This Blog

Samba Troubleshooting

Samba Troubleshooting Most problems are caused by incorrect or incomplete configuration of the Samba server, incorrect file and directory permissions, and incorrect username and password authentication.
Share it:
Samba Troubleshooting

Most problems are caused by incorrect or incomplete configuration of the Samba server, incorrect file and directory permissions, and incorrect username and password authentication.
  • Start or stop samba properly
  • User authentication failed
  • No file and directory permissions
The following solutions are not to be understood as step-by-step instructions, but require knowledge of the basic Samba configuration.
Troubleshooting: Start or stop Samba properly
The following commands do not seem to work.
sudo service samba start
sudo service samba stop
sudo service samba restart
sudo service samba status

Sometimes the following error even comes up: "Failed to start samba.service: Unit samba.service is masked." What does that mean? This means that the service / service called "samba" does not actually exist.

You have to know that Samba consists of two services. Namely "smbd" and "nmbd". And that's exactly what you have to consider when starting, stopping and restarting. If necessary, you have to treat both services separately.
sudo service smbd start
sudo service smbd stop
sudo service smbd restart

sudo service nmbd start
sudo service nmbd stop
sudo service nmbd restart

Troubleshooting: No shares visible on the remote PC
Basically, if you have made changes to the configuration file "/etc/samba/smb.conf", then you should also check this with "testparm".
testparm -v

The option "-v" causes the default settings to be displayed as well.

Unless an error has been returned, the Samba services must be restarted or the configuration file re-read.
sudo service smbd restart
sudo service nmbd restart

Note: Restarting the Samba services stops any connections to the directory shares. With a reload, the connections would remain and only the configuration would be rewritten.

If the test of the configuration file with "testparm" was successful and you have not forgotten the restart of the Samba server or the reload of the configuration, there should actually be no problems with the Samba shares.

Assuming you have a working network connection on both sides, you should clarify if the Samba services are really up and running.
sudo service smbd status
sudo service nmbd status

Or:
ps ax | grep. * mbd

The list should contain "nmbd" and "smbd".

In addition, we can check with "netstat" whether the Samba ports (137 / udp, 138 / udp, 139 / tcp and 445 / tcp) are bound to the services.
sudo netstat -tulpn | grep mbd

When the Samba services are running and listening for the right ports, then nothing ever went wrong with the installation. Otherwise you have to try to get the services "smbd" and "nmbd" up and running.

If the Samba services are running but the shares are still not visible, troubleshooting will help tremendously if the Samba client is also installed on the server.
sudo apt-get install smbclient

By specifying the host or computer name, you can check whether the Samba server can be reached. However, only the host name is resolved to the IP address.
nmblookup raspberrypi

The same also works with the specification of the workgroup or the parameter "workgroup" from the global settings of the configuration file. "raspberrypi" in this case is the hostname of  Raspberry Pi.
nmblookup workgroup

It is really interesting to see which shares the Samba server provides. "raspberrypi" in this case is the host name of Raspberry Pi. You can also use the IP address.
smbclient -N -L raspberrypi

Here the releases should be listed. If not, then you should check with "testparm" the configuration. Or perform the forgotten restart of the Samba server so that the configuration can be adopted.

Now we go one step further and check if a user login is possible. The user in this case is "pi".
smbclient -U pi -L raspberrypi

The command line will probably ask for a password. This is the password that the user got "pi" in the Samba user administration. Not the local user and not the local user on the Samba system, but really the Samba user.

Troubleshooting: User authentication failed
For authentication, the user management is provided on the server. However, Samba uses only the configured usernames and not the passwords. Therefore, a separate password must be set up with "smbpasswd".

Show all Samba users:
pdbedit -L -w

There the appropriate user who wants to access a Samba share should be created there.

If the Samba user exists, then you should look into the comparatively confusing issue of
pdbedit -L -v

see if the field "Password last set" is empty. If this is the case, set a password via "smbpasswd".
sudo smbpasswd -a pi

After entering the password you have to enter it a second time to check it. Then you should be able to access the share.

Note: There is some indication that the Samba version used on Raspbian Jessie does not always work with Windows 7. There are always problems with the registration.

Temporarily you can also use the instruction "guest = ok" in the section "[global]" in the central
configuration file "/etc/samba/smb.conf" to ensure that no password is requested when connecting.

Troubleshooting: No file and directory permissions
Most issues have rarely been related to the configuration of the Samba server, but to the set file and directory permissions. The correct setting of file and directory permissions is extremely important.
It should be noted that the file permissions in the Samba system itself must also allow the appropriate access. The Samba rights (configuration) can not cancel the system rights.

Please refer to the examples of Samba shares for directories.
Extension: Automatically mount / mount Samba shares with "fstab"
In principle, a Samba share always consists of two pages. The server side and the client side. The Samba server was configured successfully in the best case. Now it's about setting up or automatically mount the shared directory to the local file system of a client or other server.
Share it:

Raspberry Pi

Post A Comment:

0 comments: