Can shared files be transmitted between different devices? Printers can be used for remote compatibility with windows. Its disadvantage is that it must be in the same network segment.
The configuration requires that the firewall be disabled or configured for windows and linux, and the firewall must be in the same network segment.
Experiment 1 w sharing, Linux as the client (before the test, create a folder share on windows and share it with the read and write permissions)
Install client rpm-qa | grep cifs on Linux
Rpm-qa | grep samb these are installed by default
Connect smbclient-L 192.168.200.w7ip-U administor (depending on the host name of w7)
Mount. cifs 192.168.200.12 (the ip address of the window)/share/mnt-o username = administrator
In this way, the/mnt on Linux is equivalent to the share folder on windows.
View df-h/mnt
Create a file or directory under/mnt, and the other end will have the corresponding file or directory. If not, you can uninstall the file or directory.
Of course, there is another way to upload and download shared files
Smbclient // win7ip/share-U administor
Ls to see the file upload put file name
Download the get file name (the file name must be an absolute path)
Test 2 linux sharing, win as the client
Install samb rpm-qa | gerp samb
Yum install samba *
/Etc/init. d/smb restart
View process number lsof-I 139 445 tcp process number
New user useradd aaa
Set the smb user password smbpasswd-a aaa and enter the password. When the smb user logs on again, the password or "-p password" is required. In this case, the aaa user can share files.
Response settings on win7
In the running process, Type \ 192.168.200.125 (linux ip address). In this case, the aaa user can enter the shared directory but cannot share the file because selinux
Linux end id nobody
Getsebool-a | grep samba: check the boolean value. The home directory is disabled and therefore cannot be accessed.
Setsebool-P samba_enable_home_dirs on can be written as 1-P permanently open
Getsebool-a | grep samba
In this way, aaa can enter the shared directory on win.
Add pdbedit-L to know smb user information.-Lv displays details.
Smbpasswd-x aaa delete user-d disable-e enable
-C "[]"-u aaa paused
-C "[D]"-u aaa recovery
Some operations on windows will be cached, affecting the test results. You can clear the cache on windows. net use */delete
Test 3: Create the shared directory mkdir/smbpublic in linux
Change the shared file owner chown nobody: nobody/smbpublic
Backup to avoid errors cp/etc/smaba/smb. conf/etc/smaba/smb. conf. bak
Modify the main configuration file vim/etc/samba/smb. conf
Change security = share to anonymous share
Remove the following and the following ";"
[Public] to smbpublic
Comment = sampublic fill in according to your own shared directory
Path =/smbpublic the most important line
2 yes, 1 no, remove the last line
Restart the smb service
Check the port number lsof-I: 139
Modify the corresponding context man selinux | grep smaba_selinux
Chcon-t samba_share_t/smbpublic
Ll-Z/smbpublic-d
Clear the cache on w7 and log on to the shared directory.
Test 4: to modify the sharing settings on the server, you must release the permission to use the shared file.
Vim/etc/samba/smb. conf
Secure = user
Restart service smb restart. At this time, aaa users can access/smbpublic using win7, but cannot read or write because they do not have the permission.
Grant permissions to chmod o + w/smbpublic
Enter \ 192.168.200.124 (linux ip) in the w7 migration line and remember to clear the cache.
Test 5: Share directory hiding
Vim/etc/samba/smb. conf
Secure = user
Browseable = no + no = hidden at the end of [smbpublic]
To log on to w7 again, run \ 192.168.200.124 \ smbpubic.
(Do not show hidden files in windows2003. Modify "tools, folder settings, do not show folders ")
Configure the firewall to only allow access to shared files with the ip address of 28
Iptables-I INPUT! -S 192.168.200.28/24-P tcp-m multiport -- dport 139,445-j DROP
This article is from the "Arctic linux" blog, please be sure to keep this source http://941012521.blog.51cto.com/9253690/1574424
Samba configuration