1. Installation of the Samba software package
Using the source installation, enter the following command in the terminal:
#sudo Apt-get Install Samba
#sudo Apt-get Install Smbclient
2. Startup, shutdown, and restart of the Samba server
To start the Samba server, simply execute the following command:
#sudo/etc/init.d/samba Start
To close the Samba server:
#sudo/etc/init.d/samba Stop
Restart the Samba server:
#sudo/etc/init.d/samba Restart
After starting the Samba server, you can use the PS command to view the process:
#ps-aux
You can see that the Samba service starts two services at the same time, where SMBD is primarily used to manage shared directories, and NMBD is primarily used to resolve NetBIOS names. In Windows systems, hosts can be added to a group so that each host must have a name that is used for the name on the web, not the hostname of the machine, which is called the NetBIOS name. Where the NMBD process starts as the SMBD process starts.
3. Configure Samba Services
The Samba server primary configuration file is/etc/samba/smb.conf, and the NetBIOS name can be written in the/etc/samba/lmhosts file with the host's corresponding relationship.
(1) Access the Linux shared directory without entering a password in the Windows system
Share a directory in Linux and write the setup information of the established directory to the/etc/smb.conf file. For example, if you are sharing the/home/myth/share directory, to access this shared directory in a Windows system, assume that the IP of the Windows host is the IP of the 192.168.0.11,linux host 192.168.10, do the following:
#mkdir/home/myth/share
sudo cp/etc/samba/smb.conf/etc/samba/smb.conf.bak//Better make a backup before modifying the configuration file
#vim/etc/samba/smb.conf
or open the configuration file with sudo gedit/etc/samba/smb.conf
Make the following changes to the contents of the file as follows:
#security =user after adding:
Security=share
Add the following line at the end of the file:
[Share]
Comment=this is Linux share directory
Path=/home/myth/share
Public=yes
Writable=yes
Save exit to start Samba service:
#/etc/init.d/samba start
Setup is complete!
Access the shared directory under Windows, click to run, enter
\\192.168.0.10\share
This allows you to access the shared directory share with anonymous users.
No write permission on Windows:chmod-r go+rwx share/
Samba Server Setup under Ubuntu