⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 299-302.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Using Samba</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=15//-->

<!--PAGES=299-302//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="296-299.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch16/303-306.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>The following example shows a sample output from running <TT>testparm</TT>. If the smb.conf file contains any errors, the program will report them along with a specific error message.</P>

<!-- CODE SNIP //-->

<PRE>

# testparm

Load smb config files from /etc/smb.conf

Processing section &#147;[homes]&#148;

Processing section &#147;[printers]&#148;

Loaded services file OK.

Press enter to see a dump of your service definitions

</PRE>

<!-- END CODE SNIP //-->

<P>When you press the &lt;Enter&gt; key, <TT>testparm</TT>  will begin evaluating each section defined in the configuration file.</P>

<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Running the Samba Server</FONT></H3>

<P>The Samba server consists of two daemons, <TT>smbd</TT>  and <TT>nmbd</TT>. The <TT>smbd</TT>  daemon provides the file and print sharing services. The <TT>nmbd</TT>  daemon provides NetBIOS name server support.</P>

<P>You can run the Samba server either from the init scripts as detailed in Chapter 9 or from <TT>inetd</TT>  as a system service.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR>&#149; <B>See</B> &#147;Understanding the Boot Process,&#148; <B>p. 206</B><HR></FONT>

</BLOCKQUOTE>

<P>Because Red Hat and Caldera both start SMB services from the init scripts instead of as a service from <TT>inetd</TT>, you can use the following command to start or stop the SMB server:</P>

<!-- CODE SNIP //-->

<PRE>

/etc/rc.d/init.d/samba start|stop

</PRE>

<!-- END CODE SNIP //-->

<H3><A NAME="Heading10"></A><FONT COLOR="#000077">Using <I>smbclient</I>

</FONT></H3>

<P>The smbclient program allows Linux users to access SMB shares on other, typically Windows, machines. This is because if you want to access files on other Linux boxes, you can use a variety of methods including FTP, NFS, and the <TT>r-</TT>  commands (like <TT>rcp</TT> ).</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR>&#149; <B>See</B> &#147;Using the r- Commands,&#148; <B>p. 589</B><HR></FONT>

</BLOCKQUOTE>

<P><TT>smbclient</TT> provides an FTP-like interface that allows you to transfer files with a network share on another computer running an SMB server. Unfortunately, unlike NFS, <TT>smbclient</TT>  does not allow you to mount another share as a local directory.</P>

<P>smbclient provides command line options to query a server for the shared directories available or to exchange files. For more information on the available command line options, consult the man page for <TT>smbclient</TT>. Use the following command to list all available shares on the machine win.netwharf.com:</P>

<!-- CODE SNIP //-->

<PRE>

smbclient -L -I win.netwharf.com

</PRE>

<!-- END CODE SNIP //-->

<P>The <TT>-L</TT>  parameter requests the list. The <TT>-I</TT>  parameter instructs <TT>smbclient</TT>  to treat the following machine name as a DNS specified entry instead of a NetBIOS entry.</P>

<P>To transfer a file, you must first connect to the Samba server by using the following command:</P>

<!-- CODE SNIP //-->

<PRE>

smbclient &#145;\\WORKGROUP\PUBLIC&#146; -I win.netwharf.com -U tackett

</PRE>

<!-- END CODE SNIP //-->

<P>The parameter &#145;\\WORKGROUP\PUBLIC&#146; specifies the remote service on the other machine. This is typically either a file system directory or a printer. The <TT>-U</TT>  option allows you to specify the username with which you want to connect. Samba will prompt you for a password (if this account requires one) and then place you at this prompt</P>

<!-- CODE SNIP //-->

<PRE>

smb: \

</PRE>

<!-- END CODE SNIP //-->

<P>where \ indicates the current working directory.

</P>

<P>From this command line, you can issue any of the various commands shown in Table 15.1 to transfer and work with files.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 15.1</B> smbclient Commands

<TR>

<TH WIDTH="20%" ALIGN="LEFT">Command

<TD WIDTH="35%" ALIGN="LEFT">Parameters

<TD WIDTH="45%" ALIGN="LEFT">Description

<TR>

<TD COLSPAN="3"><HR>

<TR>

<TD VALIGN="TOP"><TT>?</TT> or <TT>help</TT>

<TD VALIGN="TOP">[<I>command</I>]

<TD>Provides a help message on <I>command</I>, or in general if no command is specified.

<TR>

<TD VALIGN="TOP"><TT>!</TT>

<TD VALIGN="TOP">[<I>shell command</I>]

<TD>Executes the specified shell command or drops the user to a shell prompt.

<TR>

<TD VALIGN="TOP"><TT>cd</TT>

<TD VALIGN="TOP">[<I>directory</I>]

<TD>Changes to the specified directory on the server machine (not the local machine). If no directory is specified, <TT>smbclient</TT>  will report the current working directory.

<TR>

<TD VALIGN="TOP"><TT>lcd</TT>

<TD VALIGN="TOP">[<I>directory</I>]

<TD>Changes to the specified directory on the local machine. If no directory is specified, <TT>smbclient</TT>  will report the current working directory on the local machine.

<TR>

<TD VALIGN="TOP"><TT>Del</TT>

<TD VALIGN="TOP">[<I>files</I>]

<TD>The specified files on the server will be deleted if the user has permission to do so. Files can include wildcard characters.

<TR>

<TD VALIGN="TOP"><TT>dir</TT> or <TT>ls</TT>

<TD VALIGN="TOP">[<I>files</I>]

<TD>Lists the indicated files. You can also use the command <TT>ls</TT> to get a list of files.

<TR>

<TD><TT>exit</TT> or <TT>quit</TT> 

<TD>none

<TD>Exits from the <TT>smbclient</TT>  program.

<TR>

<TD VALIGN="TOP"><TT>get</TT>

<TD VALIGN="TOP">[<I>remote file</I>] [<I>local name</I>]

<TD>Retrieves the specified remote file and saves the file on the local server. If local name is specified, the copied file will be saved with this filename instead of with the filename on the remote server.

<TR>

<TD VALIGN="TOP"><TT>mget</TT>

<TD VALIGN="TOP">[<I>files</I>]

<TD>Copies all the indicated files&#151;including those matching any wildcards&#151;to the local machine.

<TR>

<TD VALIGN="TOP"><TT>md</TT> or <TT>mkdir</TT>

<TD VALIGN="TOP">[<I>directory</I>]

<TD>Creates the specified directory on the remote machine.

<TR>

<TD VALIGN="TOP"><TT>rd</TT> or <TT>rmdir</TT>

<TD VALIGN="TOP">[<I>directory</I>]

<TD>Removes the specified directory from the remote machine.

<TR>

<TD VALIGN="TOP"><TT>put</TT>

<TD VALIGN="TOP">[<I>file</I>]

<TD>Copies the specified file from the local machine to the server.

<TR>

<TD VALIGN="TOP"><TT>mput</TT>

<TD VALIGN="TOP">[<I>files</I>]

<TD>Copies all the specified files from the local machine to the server.

<TR>

<TD VALIGN="TOP"><TT>print</TT>

<TD VALIGN="TOP">[<I>file</I>]

<TD>Prints the specified file on the remote machine.

<TR>

<TD VALIGN="TOP"><TT>queue</TT>

<TD VALIGN="TOP">none

<TD>Displays all the print jobs queued on the remote server.

<TR>

<TD COLSPAN="3"><HR>

</TABLE>

<H3><A NAME="Heading11"></A><FONT COLOR="#000077">From Here&#133;</FONT></H3>

<P>You can read the following chapters for further information about Linux as related to using Samba:

</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;Chapter 9, &#147;Booting and Shutting Down,&#148; covers the process and files used when starting and stopping the various services for Linux.

<DD><B>&#149;</B>&nbsp;&nbsp;Chapter 16, &#147;Understanding the File and Directory System,&#148; discusses the basics of files and directories. You should have a basic understanding of the file system when using <TT>emacs</TT>  or any other editor. Whereas the editor creates and modifies files, it&#146;s up to you to name them and place them in the appropriate directories.

<DD><B>&#149;</B>&nbsp;&nbsp;Chapter 20, &#147;Printing,&#148; provides information on printing your text files under Linux. Printing files under Linux can be tricky; this chapter helps you prepare your system for printing.

<DD><B>&#149;</B>&nbsp;&nbsp;The SMB-HOWTO provides sample configuration files and scripts for printing from Samba. See Appendix A for information on how to access the various HOWTOs.

</DL>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="296-299.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch16/303-306.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -