Samba Tutorial

Posted: March 22, 2009 in Open Source, Open Source Tutorial
Tags: , , ,

what thing is that?

“Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.” Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

The Samba server application, smbd, is a daemon that runs in the background. It provides access to those directories and printers that are to be shared. Access can be controlled by user name and password.

The two client applications serve different purposes. The smbfs application allows a remote directory to be mounted just as a device like a CD-ROM or hard disk can be mounted in Linux. Any application can then access files on the remote device via this mounted directory. The smbfs application runs as a daemon like the smbd application.

The smbclient is similar in form and function to the ftp application that works with an FTP server like the ftpd daemon on Linux. The difference is that the smbclient works with any SMB server such as smbd or Windows 95 with File And Printer Sharing For Microsoft Networks loaded. The smbclient can only move files to and from an SMB server. It does not allow another application to access these files until they are transferred by smbclient.

First we need…

1. LINUX OS, we use Debian Lenny 5.0
2. Samba 3.2.5
3. A text editor, vim, gedit, etc…
4. Basic knowledge of Linux
5. Network
6. You are administrator of the system

And… Lets begin….

1. Ensure you has installed samba, smbclient should print some version information.

$ smbclient –V

2. Open terminal, and become root

$ su

3. smb.conf just a example configuration, rename it, and we will make one

# mv /etc/samba/smb.conf /etc/samba/smb.conf.old

4. make new one

# vim /etc/samba/smb.conf

5.general configuration of smb.conf, mainly have this parts :

[global]

[home]

[folder1]

[folder2]


6. [global]
Anything in here applies to Samba as a global setting. There is some configuration info here that is important so that Samba and your Windows pc’s will function properly.

This is the name of your network group. It is important that both Samba and Windows are in the same workgroup.
workgroup = WORKGROUP

netbios name is what you will see in your Windows pc “Network Neighborhood” for your Samba server.You can name this anything you wish. If you leave it blank, it will default to your host name.
netbios name = Samba

Samba can work with encrypted or unecrypted passwords. However, Windows 98, Windows NT, and Windows 2000 utilize encrypted passwords. The only time that this should be set to no is when you have any older Windows systems running on your network ie: Windows 95, Windows 3.x. If this is the case you will have to do some registery modifications to your Windows 98, NT, 2000 to allow them to send unencrypted passwords accross the network. Not the most secure situation though.
encrypt passwords = yes

Most people will find that this option gives better performance :

SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY

6. [homes]
When you create a user on your Linux pc (more on this later) it will automatically create a home folder for you in /home/yourusername. Think of this as your “My Documents” for Linux.

By default Samba will always make any directory read only for security reasons, so we need to let Samba know that we want to be able to write to this directory.
read only = no

only browserable by the user, for security
browseable = no

7. [Freeshare]
This will create a share for freeshare storage. Again lets go over the share parameters for this.
This tells us the directory is found on the Samba server as /home/azer/freeshare, later when we map the network drive on the Windows pc, it will be seen as “Freeshare” in Network Neighborhood
path = /home/azer/freeshare

This share will show in in Network Neighborhood as “Freeshare”
browseable = yes

Specifies anyone can access and view the contents of /home/azer/freeshare
public = yes

comment = write your comment here

For security and practical reasons set this share so that only azer and nanang can delete or add files. You can add as many names as you wish to this line ie:, sudeki, tukil, shofy etc.
write list = azer, nanang

To exclude any person from being able to access this share altogether
invalid users = verly, tegar

These names are the logon names from Windows, and are not case sensitive. They also must have a logon name and Samba password on the Linux.

Example configuration file :

################################################

#maintained by azer, shofy, nanang

[global]

workgroup = WORKGROUP
netbios name = Samba
security = user
encrypt passwords = yes
#blok file dengan ekstensi berikut
veto files = /*.exe/*.bat/

[homes]

read only = no
browseable = no

[freeshare2]

path = /home/azer/freeshare
public = yes
browsable = yes
writable = yes
valid user = azer, umum
write list = azer

################################################


Adding Users and Restarting Samba

# useradd

change samba password to the specified user
# smbpasswd

The last, Restarting Samba
# /etc/init.d/samba restart

============================================

Samba Tutorial (Part II)

============================================

Comments
  1. Acerieawarm says:

    great domain name for blog like this)))
    ————————
    sponsored link: http://xabul.ru/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s