When you set up user-level security in Samba, Windows and Unix systems must provide a password to the Samba server to share resources. Since Samba is Unix software, you must configure users and passwords on your Linux or Mac computer using the smbpasswd program included with Samba. After you specify a security level in Samba's configuration file and create Unix and Samba users with sharing permissions, your Windows machine seamlessly integrates with the Samba server on your network.
Make a copy of the default Samba configuration file in the /etc/samba directory. If you've already set up your Samba configuration file, you don't need to make another copy, but you must confirm that Samba's security level is set to user, which is the default. Open a terminal window and enter the following command to copy the configuration file:
sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf
This command keeps a copy of the default file in case you want to start over.
Open /etc/samba/smb.conf in a text editor. The default file contains most of the settings needed to use Samba, but you must specify your Windows workgroup name in the Global section. You may also want to use password encryption by uncommenting lines 64 and 65, which begin with “encrypt passwords” and “smb passwd file,” respectively. To uncomment these lines, delete the semicolon at the beginning of each line.
Uncomment lines 73, 74 and 75, which contain “unix password sync,” “passwd program” and “passwd chat” parameters. If you don't want to sync Windows and Linux password changes over the network, skip this step. Refer to the Samba website for a detailed explanation of all the smb.conf sections and parameters (link in Resources). The lines mentioned above are the only ones that affect password changes. After confirming your settings for these options, you can close your text editor.
Enter “sudo smbpasswd username” (without quotes) at the prompt, substituting the username of the account whose password you want to change for “username.” You're prompted for your Unix password and then for the new Samba password. Confirm the new Samba password when prompted to apply the changes, which immediately take effect across the network.
Tips & Warnings
- Restrict access to your Samba server by creating a separate Unix account for file sharing. For user-level security in Samba, your Samba and Unix usernames must match. To create a Unix user, enter the following command in a terminal window:
- sudo useradd username
- Substitute the new user's name for “username” in the command. To create a matching Samba user, execute the following command:
- sudo pdbedit -a -u username
- Substitute the Unix username for “username” in this command. You're prompted to enter a new password for the Samba user, but the password doesn't need to be the same as your Unix password. After setting up a separate Unix account for Samba, you can move, copy or link files to the new user directory located at /home/username. Linking files and folders leaves the data in place but gives you two access points to the data. Create soft links with the following command:
- sudo ln -s /path/to/file /path/to/link/location
- The “path/to/file” parameter refers to the original file location, and “path/to/link/location” refers to the new user directory.
- Information in this article refers to Samba 4.1.9. It may vary slightly or significantly with other versions.
- Photo Credit Ron Chapple Stock/Ron Chapple Studios/Getty Images
How to Make a Debian Domain Controller
Type the following command, then press "Enter" to create an administrative password for Samba and restart the service: ... How to Change...
How to Set Up a Home Network Between Linux & Windows
... and Samba on a Linux desktop. ... How to Change Your Samba Password; How to Setup a Linux Server for a...
Printer Sharing With No Password
... save and enter a HomeGroup password. The users will not be required to log ... How to Reset a Homegroup Password....
How Do I Change My Password on Yahoo!
How to change your password on Yahoo!. ... Changing Internet password regularly is one of the Internet security measures that protect us...
How to Change the Host Name on an Ubuntu Server
How to Change the Host Name in Linux. Each computer in a network has an IP address (e.g.,220.127.116.11) ... How Do I...