Samba entry notes

Source: Internet
Author: User
Samba entry notes-Linux Enterprise Application-Linux server application information. For more information, see below. After learning samba over the past two days, I feel that it is difficult to configure it (no wonder, I am stupid), which is more complicated than vsftpd. After three days of night, I had to go to class during the day. I couldn't understand it. I went to mathematics. What I was even more depressing was my uncle's class. Today, I finally achieved initial results. A record is also a summary.
Samba on my computer is the samba3.0.5 that comes with Hongqi 6. The configuration file is/etc/samba/smb. conf, Which is edited by vi.
Let's talk about it in my configuration file.
The first is the [global] field.
[Global]
Workgroup = workgroup // workgroup is used to specify the NT domain name or group name of your machine on the network.
Server string = Samba Server Version % v // server string is used to set the NT description domain. Use the default value.
Netbios name = smb-server // in addition to the host name, the other thing that can confirm the host still uses the default value
Host allow = 127. 192.168.1. 192.168.2. // The network segment of the host that allows access to this server. It is configured according to the actual situation.
Guest account = wangge // if you want to create a customer account, enter the user name here and add the definition of this account to/etc/passwd, otherwise, the user "nobody" will be used as the customer account.
Log file =/var/log/samba/log. % m // log file in the unit of every Login User
Max log size = 50 // the size of each log file is set to 50 K
Security = user // set the samba server security level here. User Registration is performed by default. Samba has four security levels: one share level and one shared security level. Users can log on to the samba server without account or password.
2. user-level user security: the samba server that provides services checks user accounts and passwords.
3. You can specify another samba server to check the account and password for server-level server security.
4. For domain security, you must specify a Windows NT/2000/XP Server to verify the user password.
Encrypt passwords = yes // Linux is a multi-user operating system. When user-level authentication is adopted, samba uses the linux operating system user and password. If you want to use an encrypted password, this option is required. The specific method is described later.
Smb passwd file =/etc/samba/smbpasswd // location where the encrypted password file is stored
Domain master = no // domain Master defines the Samba server as the main domain browser. This option allows Samba
Network List. If you already have a Windows NT domain controller, do not use this option.
If this option is not used, set no
Domain logons = no // if no option is available, set no
Load printers = no // no printer, no need to configure
Dos charset = CP950 // related to display
Unix charset = BIG5 // same as above

[Myshare] // myshare Field
Comment = wangge // comment this shared to the user wangge
Path =/var/samba // path of the shared directory
Browseable = yes // you can browse this directory
Valid users = wangge // accessible user
Public = no // invisible to anonymous users
Writable = yes // write, upload
Create mask = 0777 // permission

The above is all the valid content of my smb. conf, and some common options are explained below.
Interfaces: select the network interface used by the samba server (if multiple NICs are available, you can configure them as needed). The local machine only has one Nic, so ignore this configuration item.
Password server if the security level is server or domain, use this option to specify the host for password verification
Password level
The preceding two items of username level are used to set the maximum number of uppercase/lowercase letters allowed for user password verification and account verification. The default value is 0.
Max disk size: the maximum disk space that can be shared is measured in MB. The default value is 0, indicating no limit.
Max open file sets the maximum number of files that can be opened on the same client.

Next, set a password for wangge, exit vi, and log on as root.
[Root @ localhost] # cat/etc/passwd | mksmbpasswd. sh>/etc/samba/smbpasswd
[Root @ localhost] # chmod 500/etc/samba
[Root @ localhost] # chmod 600/etc/samba/smbpasswd
Next, set the password.
[Root @ localhost] # smbpasswd wangge
New SMB passwored:
Retype SMB password:
If the system prompts
Password changed for user wangge
Indicates that the password is successfully set.

After saving the preceding configuration, run testparm to check whether there is a syntax error.
[Root @ localhost samba] # testparm
Load smb config files from/etc/samba/smb. conf
Processing section "[myshare]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[Global]
Dos charset = CP950
Unix charset = BIG5
Netbios name = SMB-SERVER
Server string = Samba Server Version % v
Smb passwd file =/etc/samba/smbpasswd
Guest account = wangge
Log file =/var/log/samba/log. % m
Max log size = 50
Load printers = No
Domain master = No
Hosts allow = 127., 192.168.1., 192.168.0., 172.17.

[Myshare]
Comment = wangge
Path =/var/samba
Valid users = wangge
Read only = No
Create mask = 0777
Check passed. Restart the samba service.
[Root @ localhost samba] # service smb restart
Disable the SMB service: [OK]
Start the SMB service: [OK]
First, test on the local machine. The first part is to list the shared directories on the server.
[Root @ localhost samba] # smbclient-L localhost
Password:
Anonymous login successful
Domain = [WORKGROUP] OS = [Unix] Server = [Samba 3.0.25-3]

Sharename Type Comment
--------------------
Myshare Disk wangge
IPC $ IPC Service (Samba Server Version 3.0.25-3)
Anonymous login successful
Domain = [WORKGROUP] OS = [Unix] Server = [Samba 3.0.25-3]

Server Comment
----------------

Workgroup Master
----------------
Use the following command to log on to wangge and enter the password when prompted.
[Root @ localhost samba] # smbclient // 127.0.0.1/myshare-U wangge
Password:
Domain = [SMB-SERVER] OS = [Unix] Server = [Samba 3.0.25-3]
Smb: \>
After successful logon, a prompt is displayed. You can perform this operation. Enter the command ?, You can obtain an internal command set. The use of internal commands is very similar to that of ftp.

Download
Smb: \> get test/root/123
Getting file \ test of size 2 as/root/123 (20000.0 kb/s) (average inf kb/s)
Smb: \>
Try to upload
Smb: \ & gt; put/root/123 1234
NT_STATUS_ACCESS_DENIED opening remote file \ 1234
The system prompts that the access is denied. It can be seen that although we have defined resumable upload in smb. conf, what is the problem? The problem occurs in the relationship between the System user wangge and the shared directory/var/samba. The owner of/var/samba is root, while wangge has only the read permission, therefore, access is denied (similar to the permission issue in vsftpd ). After changing the permission, try to upload again
Smb: \ & gt; put/root/123 123
Putting file/root/123 as \ 123 (20000.0 kb/s) (average inf kb/s)
Smb: \>
Uploaded successfully!

The method for XP to access the samba server is
Choose Start> RUN> \ 192.168.1.3 (enter the Server IP address)> Press enter. In the displayed dialog box, enter the user name and password.

You can also access the shared directory of windows through smbclient,
[Root @ localhost samba] # smbclient-L 192.168.1.4
Password:
Domain = [ACER-74DFA87541] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Sharename Type Comment
--------------------
E $ Disk mo_share
IPC $ IPC _ Cheng IPC
D $ Disk mo_share
F $ Disk mo_share
Music Disk
ADMIN $ Disk _ Process Management
C $ Disk mo_share
Session request to 192.168.1.4 failed (Called name not present)
Session request to 192 failed (Called name not present)
Domain = [ACER-74DFA87541] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Server Comment
----------------

Workgroup Master
----------------
[Root @ localhost samba] # smbclient // 192.168.1.4/music
Password:
Domain = [ACER-74DFA87541] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]
Smb: \>

These are my achievements over the past few days. I have finished reading cainiao-level things. What's wrong with me?

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.