5. Services

5.1. Web Server

Check that apache is working and start it if needed:

bash# /sbin/chkconfig --list httpd
bash# /sbin/chkconfig --level 2345 httpd on
bash# /sbin/service httpd status
bash# /sbin/service httpd start

5.2. Samba

Samba is used to share the DocumentRoot of the web server, so that everybody in the local network can update the content of the web pages from their windows machines.

  1. First backup the original samba config file, /etc/samba/smb.conf, because it has some useful comments:

    bash# cd /etc/samba/
    bash# mv smb.conf smb.conf.bak
    

    Then create a new config file, with a content like this:

    bash# vi smb.conf
    
    [global]
       workgroup = ORGNAME
       server string = Web Server
       hosts allow = 10.10.3. 192.168. 127.
       guest account = samba
       log file = /var/log/samba/%m.log
       max log size = 50
       security = share
       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    
    [www]
       path = /var/www/html
       public = yes
       only guest = yes
       writable = yes
       printable = no
    
  2. Create the user samba and set permissions to /var/www/html so that the user samba can read and write it:

    bash# /usr/sbin/useradd samba
    bash# chgrp samba /var/www/html
    bash# chmod 775 /var/www/html
    
  3. Start the samba service:

    bash# /sbin/chkconfig --level 2345 smb on
    bash# /sbin/service smb start
    
  4. Don't forget that the samba ports should be accepted in firewall:

    /sbin/iptables -A INPUT -m udp -p udp --dport 137 -j ACCEPT
    /sbin/iptables -A INPUT -m udp -p udp --dport 138 -j ACCEPT
    /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
    /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
    

    Insert these commands to some configuration scripts, instead of running them manually time after time (our firewall scripts already take care of this).

  5. Check that the samba is working:

    bash$ smbclient --help
    bash$ smbclient -L 10.10.3.100
    bash$ smbclient //10.10.3.100/www
    Password:
    smb: \> ls
    smb: \> help