Some Samba Basics

By | June 9, 2017

Samba is a protocol that makes file sharing across a network easy (great if you have your own home server). This post has a few samba basics – commands and operations to help you configure and run your samba shared folders.

Setting up samba

Read about how you can setup and configure Samba for a simple home server.

Restart samba

If something goes wrong, turning Samba off and on again can be a solution.

Read this response for more details.

Start Samba Service

sudo service smbd start

Stop Samba Service

sudo service smbd stop

Restart Samba Service

sudo service smbd restart

Find the name of the Samba Service

If you’re not sure of your Samba service name, you can list your services with this command:

service --status-all

samba basics - samba service name

List samba users

It can be useful to be able to list current Samba users. You can do this with:

sudo pdbedit -L -v

pdbedit is a tool for working with the database of Samba users. The -L flag lists users, and -v makes the output verbose.

Reset samba passwords

To reset the password of a samba user, you can add the user name to samba again:
Code:

sudo smbpasswd -a user-name

If you aren’t sure of the user names, see ‘List Samba Users’, above.

Clear windows connection cache

If you do change the password on a Samba user account, you may find you have trouble connecting via windows. One solution to this is to clear the windows connection cache.

First run net use to see what connections are stored. In this case I hvae a stored connection to my Lubuntu file server.

samba basics - net use

If I was having trouble with this connection I would run net use /delete \\LUBUNTU\IPC$ to remove it. The output confirms this connection has been removed.

samba basics - net use delete

If we try to list connections, we will be told there are none:

samba basics - no entries

A new connection will be added the next time we try to connect to our Samba folder via windows explorer.