Construction of samba server
root user operation
1. Install samba
ubuntu installation apt-get install samba -y
centos installation yum install samba -y
2. Install smbclient
ubuntu installation apt-get install samba-client
centos installation yum install samba-client
3. Create a shared folder
First create a folder in the linux system that you use to share
For example /opt/shareDoc
cd /opt/
chmod 777 shareDoc
4. Modify configuration file
because /etc/samba/smb.conf
Add to the end of the file
[share]
path = /opt/shareDoc (你的共享目录)
available = yes
browseable = yes
public = yes
writable = yes
Note that alignment is a tab distance
5. Create samba user
touch /etc/samba/smbpasswd
smbpasswd -a xxxx Remember to name it yourself< /span>
Enter your password as prompted
Restart samba server
6. Windows access shared directory
Fill in \\linux ip\share is the same as the share in the configuration file. See 4. Modify the configuration file.
Remember to enter the account password xxxx, see 5. Create a samba user
account ubuntu centos
Turn off the firewall. If you don’t want to turn it off, you need to configure firewall rules.
prompts that the permissions are insufficient: Make suresetlinux
is closed and execute the command setenforce 0
.
Create a file in Windows and see if it is in the shared folder on your Linux.
7. Other linux access files shared by samba
Use the mounting method (this has not been tested)
mount //Shared linuxip/share The path you want to mount -o username="xxxx",password=yourself of