samba Service (Local)

1. Use the command yum install samba server

yum -y install samba-*

2. Mapping shared directory, set a password

useradd -M xin
smbpasswd -a xin

3. Mapping xin users to share user, then you would add the following to the / etc / samba / smbusers file

echo “xin = share” > /etc/samba/smbusers

4. Add the contents of the global configuration of the mapping to take effect.

username map = /etc/samba/smbusers

5. Create / opt / xin directory

mkdir / opt / XIN
chown -R & lt xin.xin / opt / XIN

6. The shared configuration, vim /etc/samba/smb.conf

[the XIN]
path = / opt / the XIN (to be shared directory)
browseable = yes (visit)
public = yes (to allow anonymous users to access)
the Guest the ok = yes (accessible to everyone)
Writable = yes (shared directory writable)
write list = share (allowed user writable)

7. The server starts smb, turn off the firewall. Setting setenforce 0

Start smb nmb systemctl
systemctl STOP firewalld
setenforce 0 (regardless of whether the configuration file is closed, you must enter this command. Otherwise, the client can not create a file)

8. Client Installation samba-client, turn off the firewall. Setting setenforce 0

yun -y install samba-client
systemctl stop firewalld
setenforce 0

9. View the samba server in a client which shared resources

smbclient -L 192.168.61.131 -U share

10. Mount.

mount -t cifs //192.168.61.131/xin /opt/tao/ -o username=share,password=123
//192.168.61.131/xin /lpl cifs defaults,username=xin,password=123 0 0 (永久挂载)

11. Create a new file into the shared directory on the client to view the service side.

  mkdir  666

Guess you like

Origin blog.51cto.com/14279260/2416839