INSTALL SAMBA ON CENTOS 7

install samba server

$ sudo yum install samba

set samba password for machine user msen

$ sudo smbpasswd -a msen

New SMB password:
Retype new SMB password:
Added user msen.

Note: Samba passwords are stored in /etc/samba/smbpasswd

create a directory to be shared

$ sudo mkdir /home/msen/moodle
$ sudo chmod -R 777 /home/msen/moodle
$ sudo chown -R nobody:nobody /home/msen/moodle/

and a second directory to be shared as moodledata

$ sudo mkdir /home/msen/moodledata
$ sudo chmod -R 777 /home/msen/moodledata/
$ sudo chown -R nobody:nobody /home/msen/moodledata/

add moodle to samba config

$ sudo vi /etc/samba/smb.conf

disable MYGROUP and add WORKGROUP

# workgroup = MYGROUP
workgroup = WORKGROUP

then add this to the very end of the file

[moodle]
 path = /home/msen/moodle
 available = yes
 valid users = msen
 read only = no
 browseable = yes
 public = yes
 writable = yes
[moodledata]
 path = /home/msen/moodledata
 available = yes
 valid users = msen
 read only = no
 browseable = yes
 public = yes
 writable = yes

 

add samba to iptables rules

$ sudo firewall-cmd –permanent –zone=public –add-service=samba
$ sudo firewall-cmd –permanent –add-port=139/tcp
$ sudo firewall-cmd –permanent –add-port=445/tcp
$ sudo firewall-cmd –reload

make sure selinux is disabled

$ sudo vi /etc/sysconfig/selinux

SELINUX=disabled

make sure your dns on server is correct that matches your correct DATACENTER DNS, let’s assume your server is another datacenter

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eno16780032

DNS1 = 10.10.0.10

enable and restart samba server and nmb server

$ sudo systemctl enable smb
$ sudo systemctl enable nmb
$ sudo systemctl restart smb
$ sudo systemctl restart nmb

once samba has restarted, use this command to check your smb.con for any syntax errors

$ testparm

CONNECT AND TRANSFER FROM CLIENT TO SERVER

let’s list the shared folders of the server from client using server’s ip

$ smbclient -L //40.131.237.85/ -U msen

TRANSFER DATA FROM CLIENT TO SERVER

let’s transfer moodle web files from client to server

$ smbclient //40.131.237.85/moodle -U msen

let’s put data from client o the server, use the same password you created before

Enter msen’s password:
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.3]
smb: \> recurse
smb: \> prompt
smb: \> mput *

INSTALL SAMBA CLIENT ON THE  SERVER

we can install both samba client on the server as well

$ sudo yum install samba-client samba-common

let’s test

$ smbclient -L localhost

Enter msen's password: 
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.3]

Sharename Type Comment
 --------- ---- -------
 moodle Disk 
 moodledata Disk 
 IPC$ IPC IPC Service (Samba Server Version 4.2.3)
 msen Disk Home Directories
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.3]

Server Comment
 --------- -------
 NFS Samba Server Version 4.2.3

Workgroup Master
 --------- -------
 WORKGROUP
Advertisements

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