Skip to content

Instantly share code, notes, and snippets.

@VuokkoVuorinnen
Created October 25, 2013 07:49
Show Gist options
  • Save VuokkoVuorinnen/7150931 to your computer and use it in GitHub Desktop.
Save VuokkoVuorinnen/7150931 to your computer and use it in GitHub Desktop.
# http://wiki.centos.org/HowTos/SetUpSamba
# http://micheljansen.org/blog/entry/182
# http://www.centos.org/docs/5/html/5.1/Deployment_Guide/sec-sel-enable-disable-enforcement.html
# installatie & opstarten & starten bij boot
sudo yum install samba
sudo chkconfig smb on
sudo service smb start
# maak directories voor de shares aan
mkdir -p /srv/shares/public
mkdir -p /srv/shares/upload
# iptables configureren, volgende lijnen toevoegen aan /etc/sysconfig/iptables
-A INPUT -s 192.168.56.0/24 -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -s 192.168.56.0/24 -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT
-A INPUT -s 192.168.56.0/24 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -s 192.168.56.0/24 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -s 192.168.56.0/24 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
# iptables herstarten
sudo service iptables restart
# user accounts toevoegen
sudo smbpasswd -an nobody
sudo smbpasswd -a patrick
sudo useradd student
sudo passwd student (letmein)
sudo smbpasswd -a student
# shares configureren, voeg volgende lijnen toe aan /etc/samba/smb.conf
[global]
server string = Samba Server Version %v
guest account = nobody
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
idmap config * : backend = tdb
cups options = raw
[homes]
comment = Home Directories
valid users = %S
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
print ok = Yes
browseable = No
[public]
comment = Public share op /srv/shares/public
path = /srv/shares/public
guest ok = Yes
[upload]
comment = Uploads op /srv/shares/upload
path = /srv/shares/upload
write list = +student
guest ok = Yes
# selinux configuratie
# homedires enablen
setsebool samba_enable_home_dirs 1
# /srv/shares/public & /srv/shares/upload openen
setsebool samba_export_all_rw 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment