===== How to share files between Linux and Linux ===== <note>ServerA(Provide shared space):192.168.1.81. ServerB(Mount the shared space):192.168.1.82. This article has a local asterCC server to mount another asterCC server recording folder as an example.</note> 1、Ensure that the samba service is installed on Server A: <code> yum install samba </code> <note tip>If you have already installed samba above steps can be skipped.</note> 2、After installation is complete, create a samba user and password on server A: To create a samba user: <code> useradd sbu </code> Set the sbu password and enter 123456 when prompted: <code> smbpasswd -a sbu </code> <note tip>If you have already set up a samba authentication user name and password, the above steps can be skipped.</note> 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: <code> [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</code> {{:undefined:selection_114.png?750|}} 4、restart the server A on the samba service: <code>service smb restart</code> 5、On server B, perform the mount operation: <code> mount -t cifs -o username=sbu,password=123456 //192.168.1.81/ccmonitor /var/spool/asterisk/monitor</code> 6、Server B, set the boot automatically mount: VIM Edit /etc/fstab, add the following file, as follows. <code> //192.168.1.81/ccmonitor /var/spool/asterisk/monitor cifs defaults,username=sbu,password=123456 0 0 </code> {{:zh:常见问题及解答:selection_115.png?750|}} 7、To check if Server B is mounted: <code>df -hT</code> {{:zh:常见问题及解答:selection_113.png?750|}} 8、Unmount on Server B: <code>umount //192.168.1.81/ccmonitor</code> <note tip> If the host does not respond when the implementation of the mount, try to add the following iptables strategy. To increase the inbound rules: <code>iptables -I INPUT -p tcp -m multiport --dports 139,445 -j ACCEPT iptables -I INPUT -p udp -m multiport --dports 137,138 -j ACCEPT</code> To increase the outbound rule: <code>iptables -I OUTPUT -p tcp -m multiport --sports 139,445 -j ACCEPT iptables -I OUTPUT -p udp -m multiport --sports 137,138 -j ACCEPT</code></note>