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 Do I Change My Password on Yahoo!
Although Yahoo does not offer a way to recover your account password, the company does provide a Password Helper service to help...
How to Set Up a Home Network Between Linux & Windows
You can set up a home network complete with a shared file server and print server by installing the Common Unix Print...
How to Change the Host Name on an Ubuntu Server
Ubuntu is a free Linux operating system. The host name on a Ubuntu server system, and other operating systems, is a word...
Printer Sharing With No Password
Microsoft Windows 7 enables easy networking with the new HomeGroup feature. Using HomeGroup, you may access printers and other network resources without...
How to Make a Debian Domain Controller
A domain controller is a server used on a Windows network to authenticate user names and passwords. Instead of storing this information...