How to share files between Linux and Linux

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.

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

 yum install samba 

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 

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 //192.168.1.81/ccmonitor /var/spool/asterisk/monitor

6、Server B, set the boot automatically mount:

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

 //192.168.1.81/ccmonitor /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 //192.168.1.81/ccmonitor

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

en/how-to/how_to_use_samba_share_files_between_linux_and_linux.txt · Last modified: 2017/12/12 11:05 (external edit)
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki