#!/bin/bash echo "=====REMOVING EXISTING URPMI SOURCES========" urpmi.removemedia -a echo "======INSTALLING NEW URPMI SOURCES========" urpmi.addmedia --update plf-free http://ftp.cica.es/mirrors/Linux/plf/mandriva/2008.0/free/release/binary/i586/ with media_info/hdlist.cz urpmi.addmedia --update plf-nonfree ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandriva/2008.0/non-free/release/binary/i586/ with media_info/hdlist.cz urpmi.addmedia main http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/main/release with media_info/hdlist.cz urpmi.addmedia contrib http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/contrib/release with media_info/hdlist.cz urpmi.addmedia --update main_updates http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/main/updates with media_info/hdlist.cz urpmi.addmedia --update contrib_updates ftp://carroll.cac.psu.edu/pub/linux/distributions/mandrivalinux/official/2008.0/i586/media/contrib/updates with media_info/hdlist.cz urpmi.addmedia --update non-free_updates ftp://ftp.cise.ufl.edu/pub/mirrors/mandrake/Mandrakelinux/official/2008.0/i586/media/non-free/updates with media_info/hdlist.cz echo "======ADDING SERVER NAME TO HOSTS FILE========" echo "127.0.0.1 gateway localhost" > /etc/hosts echo "======ADDING SERVER NAME TO NETWORK FILE========" echo NETWORKING=yes > /etc/sysconfig/network echo HOSTNAME=gateway >> /etc/sysconfig/network echo "======ADDING /FILESHARE TO /ETC/FSTAB========" echo "/dev/hda6 /fileshare ext3 defaults 1 2" >> /etc/fstab echo "======MOUNTING /FILESHARE PARTITION========" mount /fileshare echo "======INSTALLING NECESSARY APPLICATIONS========" urpmi --auto samba-server urpmi --auto samba-client urpmi --auto openssh-server urpmi --auto openssh urpmi --auto apache urpmi --auto htop urpmi --auto gcc urpmi --auto make urpmi --auto sudo urpmi --auto mplayer urpmi --auto clamav freshclam echo "======SETTING SECURITY LEVEL 2========" msec 2 echo "======SETTING NUMLOCK TO START WHEN SYSTEM STARTS========" chkconfig numlock on echo "======SETTING SSHD TO START WHEN SYSTEM STARTS========" chkconfig sshd on echo "======MODIFYING SMB.CONF FILE TO REFLECT SHARES========" echo "#############GLOBAL DEFINITIONS#####################################" > /etc/samba/smb.conf echo "#" echo "[global]" >> /etc/samba/smb.conf echo " ; General server settings" >> /etc/samba/smb.conf echo " netbios name = GATEWAY" >> /etc/samba/smb.conf echo " server string =" >> /etc/samba/smb.conf echo " workgroup = HACKERS" >> /etc/samba/smb.conf echo " announce version = 5.0" >> /etc/samba/smb.conf echo " socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE" >> /etc/samba/smb.conf echo " SO_RCVBUF=8192 SO_SNDBUF=8192" >> /etc/samba/smb.conf echo " passdb backend = tdbsam" >> /etc/samba/smb.conf echo " security = user" >> /etc/samba/smb.conf echo " null passwords = true" >> /etc/samba/smb.conf echo " username map = /etc/samba/smbusers" >> /etc/samba/smb.conf echo " name resolve order = hosts wins bcast" >> /etc/samba/smb.conf echo " wins support = yes" >> /etc/samba/smb.conf echo " printing = CUPS" >> /etc/samba/smb.conf echo " printcap name = CUPS" >> /etc/samba/smb.conf echo " syslog = 1" >> /etc/samba/smb.conf echo " syslog only = yes" >> /etc/samba/smb.conf echo "" >> /etc/samba/smb.conf echo "#" echo "#################SHARE DEFINITIONS##################################" >> /etc/samba/smb.conf echo "#" echo "" >> /etc/samba/smb.conf echo "; NOTE: If you need access to the user home directories uncomment the" >> /etc/samba/smb.conf echo "; lines below and adjust the settings to your hearts content." >> /etc/samba/smb.conf echo "" >> /etc/samba/smb.conf echo ";[homes]" >> /etc/samba/smb.conf echo " ;valid users = %S" >> /etc/samba/smb.conf echo " ;create mode = 0600" >> /etc/samba/smb.conf echo " ;directory mode = 0755" >> /etc/samba/smb.conf echo " ;browseable = no" >> /etc/samba/smb.conf echo " ;read only = no" >> /etc/samba/smb.conf echo " ;veto files = /*.{*}/.*/mail/bin/" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "; NOTE: Only needed if you run samba as a primary domain controller." >> /etc/samba/smb.conf echo "; Not needed as this config doesn't cover that matter." >> /etc/samba/smb.conf echo ";[netlogon]" >> /etc/samba/smb.conf echo " ;path = /var/lib/samba/netlogon" >> /etc/samba/smb.conf echo " ;admin users = Administrator" >> /etc/samba/smb.conf echo " ;valid users = %U" >> /etc/samba/smb.conf echo " ;read only = no" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "; NOTE: Again - only needed if you're running a primary domain controller." >> /etc/samba/smb.conf echo ";[Profiles]" >> /etc/samba/smb.conf echo " ;path = /var/lib/samba/profiles" >> /etc/samba/smb.conf echo " ;valid users = %U" >> /etc/samba/smb.conf echo " ;create mode = 0600" >> /etc/samba/smb.conf echo " ;directory mode = 0700" >> /etc/samba/smb.conf echo " ;writeable = yes" >> /etc/samba/smb.conf echo " ;browseable = no" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "; NOTE: Inside this place you may build a printer driver repository for" >> /etc/samba/smb.conf echo "; Windows - I'll cover this topic in another HOWTO." >> /etc/samba/smb.conf echo "[print$]" >> /etc/samba/smb.conf echo " path = /var/lib/samba/printers" >> /etc/samba/smb.conf echo " browseable = yes" >> /etc/samba/smb.conf echo " guest ok = yes" >> /etc/samba/smb.conf echo " read only = yes" >> /etc/samba/smb.conf echo " write list = root" >> /etc/samba/smb.conf echo " create mask = 0664" >> /etc/samba/smb.conf echo " directory mask = 0775" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "[printers]" >> /etc/samba/smb.conf echo " path = /tmp" >> /etc/samba/smb.conf echo " printable = yes" >> /etc/samba/smb.conf echo " guest ok = yes" >> /etc/samba/smb.conf echo " browseable = no" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "; Uncomment if you need to share your CD-/DVD-ROM Drive" >> /etc/samba/smb.conf echo ";[DVD-ROM Drive]" >> /etc/samba/smb.conf echo " ;path = /media/cdrom" >> /etc/samba/smb.conf echo " ;browseable = yes" >> /etc/samba/smb.conf echo " ;read only = yes" >> /etc/samba/smb.conf echo " ;guest ok = yes" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "[MyFiles]" >> /etc/samba/smb.conf echo " path = /fileshare/tux" >> /etc/samba/smb.conf echo " writable = yes" >> /etc/samba/smb.conf echo " comment = tux DIR" >> /etc/samba/smb.conf echo " valid users = tux" >> /etc/samba/smb.conf echo " printable = no" >> /etc/samba/smb.conf echo " public = no" >> /etc/samba/smb.conf echo " write list = tux" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "[AlisiaFiles]" >> /etc/samba/smb.conf echo " path = /fileshare/alisia" >> /etc/samba/smb.conf echo " writable = yes" >> /etc/samba/smb.conf echo " comment = alisia DIR" >> /etc/samba/smb.conf echo " valid users = alisia" >> /etc/samba/smb.conf echo " printable = no" >> /etc/samba/smb.conf echo " public = no" >> /etc/samba/smb.conf echo " write list = alisia" >> /etc/samba/smb.conf echo "#" >> /etc/samba/smb.conf echo "[www.html]" >> /etc/samba/smb.conf echo " path = /var/www/html" >> /etc/samba/smb.conf echo " writable = yes" >> /etc/samba/smb.conf echo " comment = www.html" >> /etc/samba/smb.conf echo " valid users = tux" >> /etc/samba/smb.conf echo " printable = no" >> /etc/samba/smb.conf echo " public = no" >> /etc/samba/smb.conf echo " writelist = tux" >> /etc/samba/smb.conf echo "======ADDING USERS========" adduser tux adduser alisia echo "======ADDING USERS TO SAMBA USERS========" smbpasswd -an tux smbpasswd -an alisia echo "======CHANGING SAMBA SHARE OWNERSHIP========" chown -R tux:tux /fileshare/tux chown -R alisia:alisia /fileshare/alisia echo "======CHANGING HTML DIRECTORY R/W========" chmod -vfR 0777 /var/www/html echo "======ADDING USER TUX TO SUDOERS========" echo "tux ALL=(ALL) SETENV: ALL" >> /etc/sudoers echo "======CHANGING APACHE PORT NUMBER========" sed -i 's|Listen 0.0.0.0:80|Listen 0.0.0.0:7950|' /etc/httpd/conf/httpd.conf echo "======STARTING APACHE WEB SERVER========" service httpd start