Linux File Sharing
Install the Samba package
Mount/DEC/CDROM/mnt
Rpm-IVH/mnt/packages/samba-3.6.9-151.el6.i686.rpm
Configuration Files
CD/etc/samba
Grep-V "#" smb. conf | grep-V "^ $"> smb. conf. Back removes comments and blank lines
CP smb. conf. Back smb. conf overwrites the original configuration file
(1) Anonymous sharing
VI/etc/samba/smb. conf
Security = Share
Gcall to the end, add
[Share]
Path =/usr/share/DOC store help files in this directory
Public = Yes allow all users to access
Save.
Chmod 777/usr/share/DOC Authorize local directory permissions
Setenforce 0
Service iptables stop disable Firewall
Service SMB start
If yes, It is started successfully. If no, debug the log file to modify the configuration.
You can access it on a real machine. Win + R can enter the Server IP address.
(2) shared authentication required
First, create several shared accounts for access.
Useradd Jack
Pdbedit-a-u Jack
Useradd Tom
Pdbedit-a-u Tom
Then edit the configuration file
VI/etc/samba/smb. conf
Security = user
Gcall to the end, add
[Share]
Path =/usr/share/doc
Public = No
Valid users = Jack, which shared accounts can access Tom?
Write list = which of Jack's shared accounts have write permissions?
Save
Chmod 777/usr/share/doc
Setenforce 0
Service iptables stop disable Firewall
Service SMB restart
Note: directly accessing the Server IP address on a real machine may result in a long delay and cannot be connected. In this case, we recommend that you use the real machine command line and type the following command:
Net use/D * clear Cache
Net use \ 192.168.80.20 \ share "Shared Password"/User: "shared username" to establish a connection with the server
Then, win + R enters the Server IP address for access.
Edit the permission to access the user's upload Directory, which can be implemented through VI/etc/samba/smb. conf.
Add directory mask = 0755 directory permission.
Create mask = 0664 File Permissions
3. Access shared folders in Linux
First, share the file to everyone on the real machine. Disable password sharing and firewall.
Install the CIFS-utils package
Mount/dev/CDROM/mnt
Rpm-IVH/mnt/packages/cifs-utils-4.8.1-18.el6.i686.rpm
Mount Shared Folders
Mount. CIFS // vm ip Address/Shared Folder name/mnt
Then you can view it in/MNT.
Additional:
1. Set User ing (alias logon)
(1) vi/etc/samba/smbusers
Jack = j01 j02 .....
Save
(2) vi/etc/samba/smb. conf
Add one
Username map =/etc/samba/smbusers
Save
You can use j01/j02 to log on to the Jack account.
2. Access address restrictions
VI/etc/samba/smb. conf
Hosts allow = 192.168.4. 173.17. Only access from the CIDR Block 192.168.4.0/24 and 173.17.0.0/16 is allowed.
Save and restart the smb service
This article is from the "ne Road" blog, please be sure to keep this source http://332162926.blog.51cto.com/8831013/1531023