(1). check whether sambarpm-qa | grepsamba is installed. if samba-common... appears ........... Samba (2) has been installed. remove the read-only attribute of the smb. conf file and change it to modifiable. You must first enter the su command with the highest administrator to modify the attributes, then enter the password, and switch to the root user. If it is under the root user,
(1). check whether samba is installed
Rpm-qa | grep samba
If
Samba-common .....
...
...
Samba has been installed.
(2) remove the read-only attribute of the smb. conf file and change it to modifiable. You must first use the highest administrator to modify attributes.
Enter the su command, enter the password, and switch to the root user.
If it is under the root user, (2) (3) the two steps do not need to be done.
(Exit can be used to exit the su account, but do not exit first, followed by su operations)
Chmod 755/etc/samba/smb. conf modify file permissions
(3) open the smb. conf configuration file. you must switch to the highest administrator identity to rewrite the file.
Vi/etc/samba/smb. conf
[Global]
Add a row under workgroup = MYGROUP
Netbios name = SAMBA
The purpose is to allow samba to access
(4) do not modify anything else. move the cursor directly to the end and write the following content in another line.
[Share] this is the shared folder that can be accessed in windows.
Path =/home/samba the entered path must be correct, that is, the folder path you share in LINUX. we recommend that you put it under home, otherwise there may be permission issues
Public = no
Writable = yes
Printable = no
Creak mask = 0765 This is the default permission
(5) save and exit. The basic operation is complete. Restart the Samba service: # service smb restart
Then go to windows and enter \ SAMBA in the running state to access it. (Note that the virtual machine IP address and Windows IP address must be in the same IP address segment. Remember, remember)
Additional: (I) Samba sharing between two users in linux
Note that the valid user = test code should be added in the above (4 ).
(1) create a user and add it as root.
/Usr/sbin/useradd test create a test system user. the user must be consistent with the validuser in the smb. conf file.
(2). map this system user to a samba user
Smbpasswd-a test
(3) enter the password twice. the password is the same as the password twice.
(4) restart the smb service
/Etc/init. d/smb restart
The smb server has been built.
(5). edit firewall rules
Vi/etc/sysconfig/Iptables
Locate-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 25-j ACCEPT
Add the following lines under this line:
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 139-j ACCEPT
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 445-j ACCEPT
-A RH-Firewall-1-INPUT-p udp-m udp -- dport 137-j ACCEPT
-A RH-Firewall-1-INPUT-p udp-m udp -- dport 138-j ACCEPT
Save and exit. restart the firewall.
[Root @ sample ~] #/Etc/init. d/iptables restart
(6) test whether access is allowed in linux
Smbclient-L \ SAMBA-U test
Enter the password. after entering the password, you will see some information, indicating that the service has been successfully set up. you can access it under windows.
(Ii) modify the configuration of the NFS service to share files
1: modify the/etc/exports file and add the following code to the file:
/Home/share 192. 168. *. * (rw)
Save and exit.
/Home/share--> For the shared directory
192. 168. *. * --> is the IP address used to access the host.
Rw --> For permission
2: run the # exportfs-rv command to make the modified exports file take effect.
Start the nfs service:
# Service portmap start
# Service nfs start
3: Test whether nfs is successfully started.
# Mount-t nfs192.168.0.111:/home/share/mnt
# Ls/mnt
If you can see the same files in the/home/share directory under the mnt directory, the startup is successful.