The Samba service is not installed by default in the Ubuntu server version. 1. the installation of the Samba package uses the source installation, enter the following command in the terminal: # sudoapt-getinstallsamba # the startup, shutdown, and restart of the sudoapt-getinstallsmbclient2.Samba server simply execute the following command: # sudo/etc/init. d/sambastart disable Samba Server Samba service. It is not installed by default in the Ubuntu server version.
1. Installation of Samba Software PackageRun the following command on the terminal to install the SDK from the source:
# Sudo apt-get install samba
# Sudo apt-get install smbclient
2. Start, shut down, and restart the Samba server
To start the Samba server, run the following command:
# Sudo/etc/init. d/samba start
Disable 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 run the ps command to view the process:
# Ps-aux
We can see that the Samba service starts two services at the same time. smbd is mainly used to manage shared directories, and nmbd is mainly used to parse NetBIOS names. In a Windows system, a host can be added to a group, so that each host must have a name, which is used to be marked online, not the host name of the machine, it is called the NetBIOS name. The nmbd process starts as the smbd process starts.
3. Configure the Samba Service
The main configuration file of the Samba server is/etc/samba/smb. conf, and the correspondence between NetBIOS Name and host can be written in the/etc/samba/lmhosts file.
(1) access the Linux shared directory without a password in Windows
Share a directory in Linux and write the setting information of the Created directory to the/etc/smb. conf file. For example, if you want to share the/home/myth/share directory, you need to access the shared directory in Windows. Assume that the IP address of the Windows host is 192.168.0.11 and that of the Linux host is 192.168.10, perform the following operations:
# Mkdir/home/myth/share
Sudo cp/etc/samba/smb. conf/etc/samba/smb. conf. bak // make a backup before modifying the configuration file
# Vim/etc/samba/smb. conf
Or use sudo gedit/etc/samba/smb. conf to open the configuration file.
Modify the content of the file as follows:
# Security = add after user:
Security = share
Add the following lines at the end of the file:
[Share]
Comment = this is Linux share directory
Path =/home/myth/share
Public = yes
Writable = yes
Save and exit. Start the Samba service:
#/Etc/init. d/samba start
The settings are complete!
Access the shared directory in Windows, click Run, and enter
\ 192.168.0.10 \ share
In this way, you can access the shared directory share as an anonymous user.
If you do not have the write permission in Windows:Chmod-R go + rwx share/