FAQs about Samba in Linux

Source: Internet
Author: User
Article title: FAQs about Samba 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.
1. files/directories and printer sharing are provided to windows by Linux.
After Samba runs on a Linux server, Linux is equivalent to a file and print server.
And Linux
Samba customers provide file and print services. The two methods that work in shared mode or user mode are common (Secu
Rity = share
Or Security = user. Environment: Redhat Linux 6.x
  
1. in shared mode, the windows 98 client cannot view the server from the network neighbors
Shared Resources
The password is incorrect.
A. The comment symbol before the line guest account = pcguest is not removed.
B. You have not created a guest account pcguest (# useradd pcguest)
C. windows 98 sends the encrypted password by default, while/etc/smb. conf does not have the enable Samba encrypted password.
Alternatively, you can edit the windows 98 registry to send a text password (not recommended)
  
2. a fully writable shared directory is defined in/etc/smb. conf, but cannot be written in actual operations.
A. Note that the file and directory permissions of LINUX are always higher than those defined by SAMBA.
Resource Directory
It can be written. First, ensure that the directory can be written by the corresponding user in LINUX. this is the premise.
  
3. in shared mode, how does one add a user name and password to a shared directory?
A. Let's take a look at the following shared resource definition example:
Security = SHARE
Username map =/etc/smbusers
Log file =/var/log/samba/log. % m
Max log size = 50
Socket options = TCP_NODELAY
Client code pages = 936
OS level = 40
Local master = yes
Preferred master = yes
Domain master = yes
Guest account = pcguest
Encrypt passwords = yes
Smb passwd file =/etc/smbpasswd
[Sales]
Comment = test folder
Path =/sales/training
Guest OK = no
Writable = yes
Valid users = @ sales
Write list = @ sales
In the preceding example, security = share and samba encrypt password are defined, and the shared directory name is sa.
Les
It is not accessible by guest users. it must be accessible and writable by users in the sales group.
Guarantee
The/sales/training directory can be written by the group sales.
Define your windows logon (not NT Domain login) user name as the user name in the sales group, and then in the network neighbors
Double-click
The password will be prompted during sales. it is the Samba encrypted password you have defined on the samba server. in the above example
Medium
The user name and password pair are stored in the file/etc/smbpasswd. of course, you must have a system user name in/etc/passwd.
.
  
4. windows users often cannot browse Samba server names in their network neighbors.
A. windows's network-based neighbor service is a very unreliable service, and the browsing List it creates is unreliable, due to many factors
Cause.
B. a reliable solution is to directly use 'lookup '-'computer'-enter the samba server's host name for search.
.
Make sure that you did not cancel the logon when windows is started.
C. You can also use the net use command in the DOS window, for example, c: \ net use m: \ sambaservername \ shareresou.
Rcename
  
5. server-side test configuration tool
A. After configuring/etc/smb. conf, run testparm to check whether the corresponding syntax error exists in the configuration file.
B. use smbstatus to report User usage and logon status after Samba is started.
C. after changing the configuration file, run/etc/rc. d/init. d/smb restart to re-read the configuration file.
  
2. use the Linux Samba server on a Linux client
  
1. use Smbclient on Linux client
A. list all available shared resources on the computer 192.168.100.1:
Smbclient-L 192.168.100.1
If you ask for a password, press enter.
You can also use the following name:
Smbclient-L sh3
If you do not know the sh3 IP address, it is also available
Smbclient-L sh3-I 192.168.100.1
B. share resource sales connected to Samba server 192.168.100.1 as a user
Smbclient // 192.168.100.1/sales-U jephe
Enter the password after prompting the password, or separate the password on the command line with "% ".
Smbclient // 192.168.100.1/sales-U jephe % password
The prompt is smb: \, just like FTP
You can also use the following name:
Smbclient // sh3/sales-I 192.168.100.1-U jephe
  
You can also use the '\' symbol. your SHELL may filter out the special symbol \.
# Smbclient \\\\ sh3 \ sales
  
2. search for netbios names by IP address
A. Use it in windows
C: \ nbtstat-A 192.168.100.1
If you know the netbios name, you can use the following command to find out which services are provided for a certain machine.
C: \ nbtstat-a hydra
  
B. use it in Linux
# Nmblookup-A 192.168.100.1
In a CIDR block, use the following command to check which hosts provide the samba sharing service:
# Nmblookup-d 2 '*' or # nmblookup-B 192.168.100.255 '*'
Checks whether a machine in another network segment provides the samba service.
# Nmblookup-A 192.168.15.48
However, # nmblookup-B 192.168.15.255 '*' cannot be used, because generally routers and Linux dual-host hosts do not forward sub-nodes.
Network Direct broadcast.
  
3. netbios over TCP/IP protocol and port number
  
A. There are three netbios services in total.
Netbios-ns 137/udp (majority) and 137/tcp
Netbios-dgm 138/udp (majority) and 138/udp
Netbios-ssn139/tcp
  
B. PC applications on windows machines communicate with each other through the netbios names of different machines.
  
C. each time when a windows machine is started, it sends a 137/udp broadcast to the entire network segment to register
The main browser in the working group registers the netbios name.
  
D. The Browsing list created in the network neighbor is only a list, and it does not matter if it is invisible. you can also use
Computer search, net use command, and so on to communicate with other computers, share files and printers
  
E. It is impossible for a machine that is not in the same network segment or a PPP server that has been dial-up to the LAN to browse the network neighbors.
This is because broadcasts in the subnet are not forwarded by serial lines and routers.
  
F. how can I use the Samba server on the LAN after dialing to the PPP server on the LAN?
<1> Edit c: \ windows \ lmhosts in the windows directory
For example: 192.168.11.3 sh3 # PRE # DOM: sales
Run nbtstat-R to enable it, and you do not need to restart windows.
<2> you must log on to windows. if samba is in user mode, you should select windows NT to log on.
<3> Other settings are the same as those on the LAN.
<4> after dialing to establish a connection, find the 'computer 'function to locate the resource
<5> now you can use directories and printers on the remote server.
  
You can also use the plug-gw proxy tcp/139 port to access
Samba
Server.
  
4. a simple method for using Microsoft FTP server. Ftp.microsoft.com
  
A. add 'ftp 'to the lmhosts file
198.105.232.1 ftp # PRE
Run nbtstat-R
B. net view \ ftp
C. net use g: \ ftp \ data
D. dir g:
  
5. Use of smbmount
A. # smbmount // 192.168.100.1/pub/mnt/sh3-U jephe % password
  
Jephe Wu
  
Related Article

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.