Managed Services - How to set a customer's Samba passwords

Last Updated: 05/06/2014
Back to:
One Column
Two Column


In order to use any samba shares, a new customer must be added to the samba password file. Follow the steps below to create a samba account for the new customer.

This tutorial applies to the following operating system(s):
  • MAC

1. Gather the information

Make sure you know the username of the customer. The username "buffalor" for Ralphie Buffalo will be used for the purposes of this tutorial. Substitute the real username where appropriate. Chip Buffalo, with the username "buffaloc" will be used as a replacement for your username.

Determine on which server the person should have his/her samba account created.

You will need "sudo" access on the server to set a customer's samba password. If you do not, or are unsure, contact MS&C at trouble@<machinename>, where <machinename> is the server in question. The server "mailserver" will be used as an example in this tutorial.

2. Log in and ensure the account exists

Make sure the person has an account on your server. Log into your server with an ssh client using a command similar to the one below. Note that this is not necessarily the machine the person was working on but its server. You do not need to have an X server running.

Visual representation of step above.

You should now have a command prompt on the server.

Visual representation of step above.

Run the command "finger" followed by the username of the person to see if he/she has an account. If finger returns "no such user", he/she does not have an account. Otherwise finger will return the account details. You can create an account if necessary using adduser.

Visual representation of step above.

3. Create the samba password entry

If the customer was just added to the server, you first must sync the system password file with the samba password file. To do this, run /usr/local/etc/addtosamba with sudo. You can skip this command if the user has a pre-existing account.

Visual representation of step above.

Now you can set the customer's password with "smbpasswd <username>":

Visual representation of step above.

It may prompt you first for your sudo password, then twice for the user's samba password.

4. Have the customer change his/her password

The new customer should now be able to access any samba shares using the password you set. He/she can change his/her samba password by running the command "smbpasswd" at a command prompt on the server. Note this is not run with sudo.

Visual representation of step above.

It will prompt once for the previous samba password and twice for the new one.

The customer is now properly added to samba on your server.

Was this helpful?

Back to top