Article Title: Setting Samba server in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
After samba is used, files can be shared in WINDOWS and Linux LAN,
Linux is like a network PC or a windows pc, just like other WINDOWS computers in the LAN.
. In addition, WINDOWS hard disks can also be accessed from Linux machines. Directly mount WINDOWS
Directory, just like using your own files. It is also very easy to set, of course it may be repeat for new users
Miscellaneous.
Next, we will set up the samba server step by step.
Generally, every Linux release contains samba, but if your version is still 1. x. x, you need to delete it first, then download a new 2.0.x version from samba's hometown: http://de.samba.org. If you have installed version 2.0, you can jump to start setting.
■ Installation:
Decompress the downloaded file to the/tmp directory:
> Tar zxvf samba-xxxxxx.tgz-C/tmp
Then run the setting script in the/tmp/samba-xxx/src directory:
> Cd/tmp/samba-xxxxx/src/
If your kernel version is later than 2.1.70, use:
>./Configure -- enable-smbmount
In other cases, use:
>./Configure
After the script has customized the system, you can start to compile samba:
> Make
During this time, it depends on your machine. If it works normally, you can copy samba to the/usr/local/directory.
Only root has write permission on the/usr/local directory. Available
> Su
Command, and enter the root password. Then copy samba:
> Cp-a/tmp/samba-xxxx/usr/local
Change the directory to this directory and start installing samba:
> Cd/usr/local/samba-xxxx/source
> Make install
Create a directory named/usr/local/samba where binary files, configuration files, and log files are stored.
■ Okay. Now samba is installed. Let's set it.
Create the setting file smb. conf in the/usr/local/samba/lib/directory:
> Touch/usr/local/samba/lib/smb. conf
To facilitate testing, we create a minimal configuration file:
[Global]
Workgroup = workgroup
[All]
Path =/
Read only = yes
;
; Semicolon starts a comment
; End
The name after "workgroup =" must be the same as that in the WINDOWS Network attribute.
After editing the configuration file, start samba:
Log on to the WINDOWS server. Note: The user name in Linux must be used. Double-click the Network icon to view the Linux machine. Open the machine and enter the password. Here, enter your password on the Linux machine.
The actual configuration file allows you to access all files on Linux. Next, we will change the configuration file. The following configuration should work on most systems: We didn't comment on all the settings, you can read the manual on the http://de.samba.org if you want to know more.
[Global]
Workgroup = workgroup
Guest account = nobody
Keep alive = 30
OS level = 2
Security = user
Printing = bsd
Printcap name =/etc/printcap
Load printers = yes
To use Samba as a wins server, change \ 'WINS support \ 'to yes.
Wins support = no
; If Samba needs to use an existing wins server, remove the downstream comments and change
The IP address is your wins server address.
; Wins server = 192.168.1.1
[Local]
Path =/usr/local
Read only = yes
Now you can find any program under/usr/local in WINDOWS.
[Homes]
Comment = HomeDirectory
Browseable = no
Read only = no
Create mode = 0750
The following shares allow users to access the server's CD drive
[Cdrom]
Comment = Linux CD-ROM
; Enter the path of your CD-Rom drive/cdrom or/mnt/cdrom
Path =/cdrom
Read only = yes
Locking = no
[Printers]
Comment = All Printers
Browseable = no
Printable = yes
Public = no
Read only = yes
Create mode = 0700
Directory =/tmp
The printer can also be used in Windows.
Now stop the nmbd and smbd daemon to activate the new configuration. First look for the PID Number:
> Ps x
Output:
[...]
7199? S 0: 00/usr/local/samba/bin/nmbd-D
7201? S 0: 00/usr/local/samba/bin/smbd-D
[...]
Kill the two processes:
> Kill process number
The process number is the number in the first column you see above. After talking about it, restart:
Search for Linux PC in the WINDOWS Network window, and it should be there. If not, check the log file:
/Usr/local/samba/var/log. smb and/usr/local/samba/var/log. nmb.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.