Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The compilation and installation of Samba Server in Linux and the configuration method of Macro

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the compilation and installation of Samba server in Linux and the configuration method of macros". The explanation in this article is simple and clear, easy to learn and understand. Please follow Xiaobian's train of thought to study and learn "the compilation and installation of Samba server in Linux and the configuration method of macros".

Compilation and installation

Query whether samba is installed on the system

The code is as follows:

# rpm-aq | grep samba

Yast2-samba-client-2.13.36-0.8

Samba-client-3.0.24-2.23

Yast2-samba-server-2.13.22-0.8

Samba-3.0.24-2.23

Uninstall the original samba

The code is as follows:

# rpm-e samba-3.0.24-2.23

Get the samba source code

Http://samba.org/samba/ftp/

Get the samba source package (samba-3.0.24.tar.gz for experiment, path / home/)

Unpack the source package

The code is as follows:

# tar-jxf samba-3.0.24.tar.gz

Compilation and installation

The code is as follows:

# cd / home/samba-3.0.24/source/

There are two new source directories: the source files of samba-3.x in the source3 directory and the source files of samba-4.x in the source4 directory

The code is as follows:

#. / autogen.sh

#. / configure

Samba is installed by default in the / usr/local/samba directory

You can specify the installation directory by specifying prefix=your location:

The code is as follows:

#. / configure-prefix=/install/samba

During that time, configure prompted that the cups header file could not be found, so cups was installed first.

The code is as follows:

# make

# make install

Configure dynamic link library path

The code is as follows:

# vi / etc/ld.so.conf

Join a line

The code is as follows:

/ usr/myname/install/samba/lib

# ldconfig

Execute the ldconfig command to make the configuration effective

To the installation directory

The code is as follows:

# cd / usr/local/samba/

Prepare the configuration file

The code is as follows:

# mkdir-v etc/

# cp-v / home/samba-3.0.24/examples/smb.conf.default. / etc/smb.conf

Modify the configuration file to add a shared test

The code is as follows:

# vi. / etc/smb.conf

Workgroup = MSHOME change to the working group where your linux belongs

Security = share open sharing

Add at the end of smb.conf

The code is as follows:

[test]

Comment = test

Path = / home/

Public = no

Writable = yes

User = kk

Detect Profil

The code is as follows:

# cp-v. / etc/smb.conf. / lib/

#. / bin/testparm

Add account kk

The code is as follows:

#. / bin/smbpasswd-a kk

Enter password

Start samba

The code is as follows:

# / sbin/service network restart

#. / sbin/smbd-D

#. / sbin/nmbd-D

Detect whether or not to start

The code is as follows:

# ps aux | grep smb

# ps aux | grep nmb

The problem of password error in accessing Samba service under win7/win8

In the windows system, click [start]-[run] enter "secpol.msc" to open the management tool, and expand "Local Policy"

Then, click Security options. Double-click "Network Security: LAN Manager Authentication level"

Finally, click on the list: send LM and NTLMv2, and if negotiated, use the NTLMv2 protocol.

Writing basic macros

Samba character processing system

1. Samba uses a multi-byte string-unix string (unix strings)

Unix strings do not have a fixed byte length, but follow these guidelines:

a. Cannot contain NULL unless it is on the terminal

b. A 7-bit C strings is compatible. For constant characters and strings in C, each bit should be exactly the same as the bit in the unix character (string).

c. Case conversion means that the converted characters (strings) cannot occupy more bits.

d. Can accurately receive all the characters passed in by the client.

UTF-8 and most multi-byte Asian languages are well compatible with unix. UCS2 is the exception (including NULL).

Define unix charset in smb.conf.

When sending or receiving data with the client, to be compatible with the client's character encoding, you need to format the data in buffer using functions that begin with pull_ (receive) and push_ (send).

Functions that begin with lp_ return all unix strings.

two。 Related Macro definition (byteorder.h)

CVAL (buf,pos) returns bytes at pos in buf as unsigned characters

PVAL (buf,pos) returns bytes at pos in buf as unsigned integers

SCVAL (buf,pos,val) sets the byte at pos in buf to val

SVAL (buf,pos) returns the byte at pos in buf as an unsigned small-end integer (16bit direction ushort)

IVAL (buf,pos) returns the bytes at pos in buf as unsigned small-end integers (32bit)

SVALS (buf,pos) returns the byte at pos in buf as a signed small-end integer (16bit)

IVALS (buf,pos) returns the byte at pos in buf as a signed small-end integer (32bit)

SSVAL (buf,pos,val) sets the unsigned small end integer (16bit) value at pos in buf to val

SIVAL (buf,pos,val) sets the unsigned small end integer (32bit) value at pos in buf to val

SSVALS (buf,pos,val) sets the signed small end integer (16bit) value at pos in buf to val

SIVALS (buf,pos,val) sets the signed small end integer (32bit) value at pos in buf to val

RSVAL (buf,pos) returns the bytes at pos in buf as unsigned big-end integers (16bit)

RIVAL (buf,pos) returns the bytes at pos in buf as unsigned big-end integers (32bit)

RSSVAL (buf,pos,val) sets the value of the unsigned large end integer (16bitfocus ushort) at pos in buf to val.

RSIVAL (buf,pos,val) sets the unsigned big-end integer (32bit) value at pos in buf to val

Samba DEBUG SYSTEM

DEBUG writing rules

The code is as follows:

> debugfiledebugmsgdebugmsgdebughdrdebugtext

< >

Debughdrdebugtextdebuglinedebugline

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report