how samba works

Upload: santoshpanditpur

Post on 04-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 How Samba Works

    1/4

    # Author: m0ltenfubar 17/2/2002# Legion2000 Security Research 1996 - 2002# Website: www.legion2000.uni.cc# contact: [email protected]############################################

    Samba How-to

    Text info-----------

    everything written with a $ sign at the beginning on its own line needs to betyped into the command line exactly as u see itfor example

    $ cd/etc/

    Background Info----------------

    samba is a file sharing server utility for linux that will work with windoze andlinux computers. It is fairly easy to set up, and veryuseful when u have got it going! :P Samba is much more stable than the windozeequivalent ie it dosnt crash as much! Samba can also be used as a pdc serverfor roaming profiles etc. For all you people that dont know what pdc means it is aPrimary Domain Controller and can offer your network a lot but i'mnot going into that here but i may write a tutorial in the future about it.

    Installing-----------You can get samba from www.samba.org u need to d/l this file unless there is anewer version by then. (samba-2.0.6.tar.gz)

    u need to unpack this file like so

    $ tar -zxvf samba-2.0.6.tar.gz

    If you didnt have any errors this should of unpacked into a dir called samba-2.0.6

    You now ned to make the rpms

    $ cd samba-2.0.6$ su$ chown -R root:root samba-2.0.6$ cd samba-2.0.6/packaging/RedHat$ sh makerpms.sh

    that should then take a little time whilst it builds the rpms. You may need toswap the pacakge dir for wherever u have put urs.When the rpms have built these files will have been made

    /usr/src/redhat/RPMS/i386/samba-2.0.6-i386.rpm/usr/src/redhat/SRPMS/samba-2.0.6-src.rpm

    or something very similiar but you should be able to pin-point it because the namewill have samba in it.

  • 7/31/2019 How Samba Works

    2/4

    now you need to install samba.

    $ # rpm -Uvh /usr/src/redhat/RPMS/i386/samba-2.0.6*.i386.rpm

    yet again this may take a little time you may also need to change the dir wherethe samba files are put.

    New User and Group

    --------------------#

    Samba uses share level security so we need to make a guest account for samba torun on.

    1) make a group called smb

    2)create the user smbuser the home directory should be /home/public

    make sure u disable login on the smbuser account as no-one will be logging in onit.

    Directory Configuration and Making

    ------------------------------------

    You should already have a directory /home/public as you made it when u made thesmbuser a minute ago. This dir will be owned by the group smb and the usersmb. Everyone will need to have read and write access to this dir so we set thepermissions like this.

    $ chown smbuser:smb /home/public$ chmod 2777 /home/public

    now ever file that gets created in /home/public will be owned by smb

    now we need to make a data directory this will only be accesible by the people in

    the smb group.$ mkdir /home/samba$ chown smbuser:smb /home/samba$ chmod 2770 /home/samba

    $ mkdir /home/samba/data$ chown smbuser:smb /home/samba/data$ chmod 2770 /home/samba/data

    if you look at these commands you will see that anything created in the datadirectory will be owned by the group smb.As i want access to the data directory i add myself to the smb group.

    SWAT - web-based admin for samba----------------------------------

    you can d/l swat from http://rpmfind.net just search for swat.Swat lets u access a webpage that runs on port 901 it lets you change all thesettings to do with samba.

    When you have installed the rpm check in your /etc/inetd.conf file for a line thatlooks similiar to this

  • 7/31/2019 How Samba Works

    3/4

    swat stream tcp nowait.400 root /usr/sbin/swat swat

    You can change the line in your inted.conf file so that you can have tcp wrappersprotecting swat, but i havent gone into this detail here.

    Configuring Samba

    ------------------

    Now that you have installed and configured samba and swat you need to edit yoursmb.conf file

    Your smb.conf file maybe in /etc/smb.conf or /etc/samba/smb.conf, you need to openit up in an editor and copy this into it removing all the old data in there.

    # Samba config file created using SWAT# from bart (192.168.0.2)# Date: 1999/01/16 15:57:15

    # Global parameters

    workgroup = SIMPSONSserver string = Samba SMB Servernterfaces = 192.168.0.1/24 127.0.0.1/24bind interfaces only = Nosecurity = SHARElog file = /var/log/samba/log.%mmax log size = 50read bmpx = Notime server = Yessocket options = TCP_NODELAYos level = 65preferred master = Yesdns proxy = No

    wins support = Yesguest account = smbuserhide dot files = No

    [public]comment = Publicpath = /home/publicread only = Nocreate mask = 0664directory mask = 0775guest ok = Yes

    [data]

    comment = Datapath = /home/samba/dataread only = Nocreate mask = 0660directory mask = 0770guest ok = Yes

    you need to make approiate changes in here for your network like changing theserver name and workgroup.

    Starting samba

  • 7/31/2019 How Samba Works

    4/4

    ----------------

    You can either start samba from swat or the command line, if you are going tostart samba from swat you may need to restart samba so it will read younew config file, go to the status page in swat and select the relevant option. Ifyou want to start samba from the command line type this in

    $ /etc/rc.d/init.d/smb stop

    $ /etc/rc.d/init.d/smb start

    If you didnt see any error messages then everything should be running fine.

    Finished---------

    Thank-you for reading this tutorial and i hope you found it useful.