Tuesday, 2 December 2008

Quick and Simple Samba configuration

The first step is to create a share folder on your hard drive; for instance, /disk2/data. After that, you need to edit the smb.conf file, found in /etc/samba, and make it look something like this:

# Global parameters[global]
workgroup = HOME
netbios name = SAMBA
server string = Samba Server %v
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
preferred master = No
local master = No
dns proxy = No
security = User

# Share[Data]
path = /disk2/data
valid users = nik
read only = No
create mask = 0777
directory mask = 0777

You can copy and paste this into your conf file or make changes to your existing one.

The workgroup name needs to be the workgroup of your Windows computers, or your domain name. The netbios name is what will appear when you access the Linux computer from Windows. I am currently running a Windows domain with this setup, so I have the preferred master and local master set to no to avoid both servers from attempting to be the master browser. This will eliminate network conflicts on your Windows computers that can cause network-related outages.

For the share details, specify the valid users, or set them up later. In that section you can allow users to create their own folder and files for all to access.

The next step is to add users by the following command:

# useradd -c “Sohail Shaikh” soh
# smbpasswd -a soh
New SMB password: secret
Reenter SMB password: secret
Added user soh

Next, run the testparm command to ensure that the conf file is valid.
If it returns no errors, restart Samba with the command /etc/rc.d/rc.samba restart

Now you’re ready to test Samba.

On a Windows computer, you can either map a drive to the Samba server or access the drive using the Start-Run command and typing \\Samba\data,
“Samba” being the server name and “data” being the shared folder.

One disclaimer: this setup serves a small network or a home network. 

No comments:

Post a Comment

Next previous home