How is Linux interconnected with windows?

Source: Internet
Author: User
Tags windows 5

Just after installing the Linux operating system on a virtual machine, the idea was generated: "How can we interconnect Linux with windows? And how can users easily share data and printer devices with each other ?" Today, we can implement this function through the Samba server. It allows Windows users to access Shared Resources in Linux through familiar methods such as network neighbors, while Linux users access resources in windows through SMB client programs.

Preparations before SAMBA service
To check whether or not the samba service is installed and the version installed by RHEL (which is not installed by default), run the following command:

[Root @ localhost ~] # Rpm-Qa | grep samba
Samba-common-3.0.10-1.4E
Samba-3.0.10-1.4E # Samba Server Components
System-config-samba-1.2.21-1 # Samba graphics Configuration Tool
Samba-client-3.0.10-1.4E # samba client components

If no, take out the RHEL installation disk and find the corresponding component (the above RPM component) for installation.

[Root @ localhost ~] # Rpm-ivh samba service RPM component path

After the installation is complete, the Linux server and the Windows client cannot be normally connected. To enable Samba to provide services normally and securely, you also need to set the/etc/samba/smb. conf configuration file.

Before configuration, You need to enable the corresponding port of the service (NetBIOS, namely, the communication protocol of the Windows Network Neighbor ).

[Root @ localhost ~] # Cat/etc/services | grep Netbios
NetBIOS-NS 137/tcp # NetBIOS Name Service
NetBIOS-NS 137/udp
NetBIOS-DGM 138/tcp # NetBIOS datemediservice
NetBIOS-DGM 138/udp
NetBIOS-SSN 139/tcp # NetBIOS Session Service

SAMBA service files
1) SAMBA service password file (/etc/samba/smb. conf)
After the samba service is installed, this file does not exist by default. We can use smbpasswd to create the corresponding user name and password smbpasswd-a Linux User Name (access permission setting)

PS: The SAMBA service uses different password files from Linux. Therefore, you cannot use an account under the Linux service to log on to the samba service.
Run the following command to view the samba password file:

[Root @ localhost ~] # Cat/etc/samba/smbpasswd
RedHat: 500: 570ce399da1412abaad3b435b51404ee: b9d2d4955b330b
503cc792eb6a55bb1f: [U]: LCT-4911A2AD:
User1: 501: 570ce399da1412abaad3b435b51404ee: b9d2d4955b330b5
03cc792eb6a55bb1f: [U]: LCT-4911B0D4:

2)/etc/samba/smbusers
This file records user ing relationships
3) Samba Service Log File
The log files of the samba service are installed in the/var/log/samba/directory by default. Therefore, you can view the service running status and user access status based on the log file.

Main configurations of the samba Service
Because samba has many configuration options, I have chosen some common configurations to describe them.

[Root @ localhost ~] # Cat/etc/samba/smb. conf

#=== Global settings (global settings) ======
[Global]
Workgroup = mshome # group name: the domain name of the contact group.
Server String = Samba server # Brief description of the samba Service
Hosts allow = 192.168.0. 192.168.2. 127.
# Access permission settings (192.168.0.0/24,192.168 .2.0/24,127.0 .0.0/8 are allowed. Separate them with commas)
Printcap name =/etc/printcap # printer configuration file
Load printers = yes # Whether to load the printer Device

; Guest account = pcguest
# Here you can set the Guest account name, and the Set account name can be found in the/etc/passwd file (create a user name here). If not specified, use "nobody" for processing. Not used by default
Log File =/var/log/samba/% m. log # Log File

Security = user
# There are five security levels. 1) share has the lowest security level and does not require a user name or password to access the samba service. 2) the user (default) needs an account to Verify access to the samba service. 3) server, which also requires an account to log on, but the password is another server. 4) domain 5) ads
; Password Server = <NT-server-Name>

Interfaces = 192.168.0.253 # When multiple NICs exist, you need to set the network adapter for the listener
; Interfaces = eth1 (IP address of the network adapter parameter publisher)

WINS Server
; Wins support = Yes
; WINS Server = W. x. y. Z
; Wins proxy = Yes

#=== Share definitions (shared directory) ======
Idmap uid = 16777216-33554431
Idmap gid = 16777216-33554431
Template shell =/bin/false
Winbind use default domain = No
[Homes] # user's home directory
Comment = home directories # description
Browseable = No # whether to allow browsing others' Home Directories
Writable = yes # Whether to perform write operations
[Share] # test directory
Comment = Samba share
Browseable = Yes
Writable = No
Path =/samba/share # share path

[Printers]
Comment = all printers
Path =/var/spool/samba
Browseable = No
# Set public = yes to allow user 'guest account' to print
Guest OK = No
Writable = No
Printable = Yes

After the configuration is complete, you need to re-enable the samba Service

[Root @ localhost ~] #/Etc/init. d/SMB restart # restart the samba Service
[Root @ localhost ~] # Service SMB start # Start the samba Service
[Root @ localhost ~] #/Etc/init. d/SMB stop # Stop the samba Service

We tested it on Windows client (192.168.0.100. Linux: IP 192.168.0.1

Because the verification function is enabled during configuration.

Haha, you can view Linux shared resources in Windows

If you want to view shared resources under Windows in Linux. First, install the samba-Client client component. Check whether it is installed

[Root @ localhost ~] # Rpm-Q samba-Client
Samba-client-3.0.10-1.4E # client components

View the list of shared resources in Windows (192.168.0.100)

[Root @ localhost ~] # Smbclient-l // 192.168.0.100-u Anonymous
Warning: No network interfaces found
Password:
Domain = [zhouzhiwei] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Sharename type comment
--------------------
Share Disk

Session Request to 192.168.0.100 failed (called name not present)
Session Request to 192 failed (called name not present)
Domain = [zhouzhiwei] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Server comment
----------------

Workgroup master
----------------

Personal problems

 

The graphic desktop, rpm-Qa | grep samba, is selected during system installation.
Samba-winbind-clients-3.5.4-62.fc13.i686
Samba-client-3.5.4-62.fc13.i686
Samba-common-3.5.4-62.fc13.i686
However, input chkconfig -- add SMB to display
An error occurred while reading information in the SMB service: the file or directory does not exist.
There is no/etc/rc. d/init. d/SMB file either. How can this problem be solved?

 

 

 

 

Answer:

 

 

Why didn't you start the service according to Samba!
Samba-3.5.4.x.x.x
Is the server side!
Run the following command to install
Yum-y install samba

 

(Online query)

Then
Chkconfig -- add SMB
Chkconfig SMB on
/Etc/rc. d/init. d/SMB start

 

 

 

 

 

 

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.