How to share files between linux and linux

By December 14, 2016Tutorials

Note: ServerA(Provide shared space): the shared space): This article has a local asterCC server to mount another asterCC server recording folder as an example.

1、Ensure that the samba service is installed on Server A:

yum install samba

Tips:  If you have already installed samba above steps can be skipped.

2、After installation is complete, create a samba user and password on server A:

To create a samba user:
useradd sbu
Set the sbu password and enter 123456 when prompted:
smbpasswd -a sbu

Tips: If you have already set up a samba authentication user name and password, the above steps can be skipped.

3、Modify the samba configuration file /etc/samba/smb.conf on server A, and add the following at the end of the smb.conf file:

[ccmonitor] path = /var/spool/asterisk/monitor
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S
create mask= 777
directory mask = 777
force user = asterisk


4、restart the server A on the samba service:

service smb restart

5、On server B, perform the mount operation:

mount -t cifs -o username=sbu,password=123456 // /var/spool/asterisk/monitor

6、Server B, set the boot automatically mount:

VIM Edit /etc/fstab, add the following file, as follows.

// /var/spool/asterisk/monitor cifs defaults,username=sbu,password=123456 0 0


7、To check if Server B is mounted:

df -hT


8、Unmount on Server B:

umount //

Tips: If the host does not respond when the implementation of the mount, try to add the following iptables strategy.

To increase the inbound rules:
iptables -I INPUT -p tcp -m multiport –dports 139,445 -j ACCEPT
iptables -I INPUT -p udp -m multiport –dports 137,138 -j ACCEPT
To increase the outbound rule:
iptables -I OUTPUT -p tcp -m multiport –sports 139,445 -j ACCEPT
iptables -I OUTPUT -p udp -m multiport –sports 137,138 -j ACCEPT

Leave a Reply