Table of contents
0. Preface
samba server installation
Operating system: ubuntu18.04
1. Introduction to samba
Samba is a free and open-source software that enables systems such as UNIX and Linux to share files and printers with Microsoft Windows operating systems through the SMB/CIFS protocol, realizing cross-platform file sharing.
Samba was developed by Andrew Tridgell in 1991. It was originally developed for file sharing between UNIX systems, and later added support for Windows networks. Samba can not only share files and printers with Windows, but also act as the master server of Windows in the Linux system, and provide related services required by Windows, such as login authentication, account management, etc.
Samba supports clients of various operating systems, such as Windows, Linux, UNIX, macOS, etc. It can provide shared files and printer services in the local area network, and can also realize Internet file sharing, and provide a better data transmission method than FTP. In addition, Samba also supports mutual authentication and file transfer between users under the Unix/Linux system, and also supports Windows advanced server functions, including disk quotas, file access control lists, etc.
Samba usually consists of two parts: smbclient and smbd. smbclient is a Samba client tool that can access Windows shared folders and printers on Linux systems. smbd is a Samba file sharing server. When a client requests to access a shared file or printer, smbd will serve as a server.
In short, Samba is a software widely used in cross-platform file sharing, which can help enterprises and individual users to share files and printers between different operating systems, and improve production efficiency and work efficiency.
2. Download package
Update the repository:
sudo apt update
Install samba:
sudo apt install samba
Verify installation:
sudo smbstatus --version
3. Change the configuration file
Backup Samba's original configuration file /etc/samba/smb.conf:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
Change the samba configuration file:
sudo vim /etc/samba/smb.conf
Add shared folder:
[myshare]
comment = My share folder
path = /home/user/myshare
read only = no
browsable = yes
The above configuration creates a readable and writable shared folder myshare under the /home/user/myshare directory.
4. Configure Samba users
Create a new Samba user:
sudo smbpasswd -a username
where username is the name of the Samba user you want to create.
Follow the prompts to set a password.
All created Samba users can be listed with the following command:
sudo pdbedit -L
Restart the Samba service for the configuration changes to take effect:
sudo systemctl restart smbd
Remember to set up a firewall:
over!