commit ea3ba545fced9fefd20f6ea9894b4e4465187b11 Author: warlock <941510759> Date: Wed Aug 18 18:36:05 2021 +0800 first commit diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..37d4e99 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +stages: + - build + + + +#job-html: +# stage: build +# script: +# - echo $pwd +# - make html +# artifacts: +# expire_in: 7 day +# paths: +# - ./build/html/ + +job-latex: + stage: build + script: + - LANG=zh_CN.utf-8 make latexpdf + - sshpass -p R0ck9 scp -o StrictHostKeyChecking=no ./build/latex/凝思安全操作系统V6.0技术说明书.pdf 20272@172.16.0.249:/home/20272/doc/等保四级申请测试提交的材料 + + artifacts: + expire_in: 7 day + paths: + - ./build/latex/*.pdf + + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c46082e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "restructuredtext.confPath": "${workspaceFolder}/source" +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..65dac05 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + mkdir -vp build/latex + cp source/pic/linx.png build/latex + cp source/pic/logo.png build/latex + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/latex/6.0user.tex b/latex/6.0user.tex new file mode 100755 index 0000000..dd796b4 --- /dev/null +++ b/latex/6.0user.tex @@ -0,0 +1,7528 @@ +\documentclass[a4paper,12pt,twoside,openany]{book} +\usepackage[12pt]{moresize} +\usepackage[T1]{fontenc} +\usepackage{CJKutf8} +\usepackage{fancyhdr} +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{3} +\usepackage{indentfirst} +\usepackage{parskip} +\usepackage{graphicx} +\usepackage{graphics} +\usepackage{amsmath} +\usepackage{layout} +\usepackage{longtable} +% \usepackage[hmargin={2.5cm,1.5cm},vmargin={1.5cm,1.5cm},includeheadfoot]{geometry} +\usepackage[hmargin=2cm,vmargin=1.5cm,includeheadfoot]{geometry} +\usepackage{lineno} +\usepackage{here} +\usepackage{color} +\usepackage{framed} %代码背景色 +\usepackage{verbatim} +\usepackage{textcomp} +\usepackage{fancybox} +\usepackage{amssymb} +\usepackage{array} +\usepackage[unicode,colorlinks=false,pdfborder={0 0 0},bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2]{hyperref} +\usepackage{titlesec,titletoc} +\usepackage{colortbl} +\usepackage{multirow} +\usepackage{subfigure} + +\definecolor{shadecolor}{gray}{0.90} + +\renewcommand{\CJKtolerance}{100000} +\renewcommand{\baselinestretch}{1.2} + +\begin{document} +\begin{CJK*}{UTF8}{fzst} +\CJKcaption{UTF8} + +% \titleformat{\part}[display]{\centering\Huge\bfseries}{\thepart}{1em}{} +\pdfbookmark[-1]{凝思安全操作系统~V6.0~技术说明书}{title} + +\title{ +\begin{minipage}[c]{5cm} +\begin{center} +\includegraphics[scale=0.6]{./pic/linx.png} +\end{center} +\end{minipage} +\hfill +\begin{minipage}[c]{11.7cm} +\bfseries\fontsize{40pt}{\baselineskip}\selectfont 凝思安全操作系统 +\normalsize \\ +\rule[2mm]{11.7cm}{1mm} \\ +\bfseries\fontsize{32pt}{\baselineskip}\selectfont V6.0 \hfill 技术说明书 +\end{minipage} +\hfill +\\ \vspace{12cm} +} + +\author{\bfseries\Large 北京凝思软件股份有限公司} +\date{\bfseries\large 2020.10} +\maketitle +\CJKverbatim + +\thispagestyle{empty} +\setcounter{page}{1} + + + + +\newpage +\setcounter{page}{1} +\frontmatter +\pagestyle{fancy} +\renewcommand{\sectionmark}[1]{\markright{\thesection~~#1}{}} +\renewcommand{\chaptermark}[1]{\markboth{\large第\,{\thechapter}\,章~~#1}{}} + +\fancyfoot{} +\fancyfoot[C]{\includegraphics[scale=0.05]{./pic/linx.png}~\slshape北京凝思软件股份有限公司} +\fancyfoot[LE,RO]{\thepage} + +\fancyhead{} +\fancyhead[LE,RO]{\slshape\large 目\quad录} + +\pdfbookmark[0]{目\quad录}{tableofcontents} + +\renewcommand*{\contentsname}{\centerline{\Huge目\quad录}} % 重设目录字体样式 +% 目录 +\tableofcontents +% 表格 +% \listoftables +% 插图 +\listoffigures +\CJKtilde +\mainmatter +\CJKindent +%正文放在这里 + +\begin{sloppypar} + +% \newcommand{\keyu}[1]{\setlength{\fboxsep}{3pt}\raisebox{0.2ex}[0pt]{\fbox{\rule[-0.15ex]{0cm}{1.7ex}\footnotesize #1}}} +% \newcommand{\keym}[1]{\setlength{\fboxsep}{3pt}\raisebox{0.45ex}[0pt]{\fbox{\footnotesize #1}}} +% \newcommand{\keyd}[1]{\setlength{\fboxsep}{3pt}\raisebox{0.45ex}[0pt]{\fbox{\rule[0ex]{0cm}{1.3ex}\footnotesize #1}}} +\newcommand{\key}[1]{\raisebox{0.4ex}[0pt]{\fbox{\rule[-0.5ex]{0cm}{2ex}\footnotesize #1}}} + +\newcommand{\button}[1]{\setlength{\shadowsize}{1pt}\raisebox{-0.75ex}[0pt]{\setlength{\fboxsep}{0pt}\shadowbox{\setlength{\fboxsep}{3pt}\colorbox[gray]{0.85}{\footnotesize #1}}}} + +\newcommand{\textbutton}[1]{\makebox[2.2cm][c]{\texttt{[\hfill #1\hfill ]}}} + +\newcommand{\setupbutton}[1]{\makebox[1.8cm][c]{\texttt{$<$\hfill #1\hfill $>$}}} + +\newcommand{\notebox}[5]{ +\vspace{1ex} +\begin{center} +\setlength{\fboxsep}{10pt} +\noindent\doublebox{\parbox{#1}{\raisebox{-4pt}[0pt]{\includegraphics[scale=#2]{#3}} \textbf{#4} +\setlength{\fboxsep}{3pt} +\setlength{\parindent}{24pt} + +#5}} +\end{center} +\vspace{1em}} + +\newcommand{\note}[2]{\notebox{#1}{0.15}{./pic/icon/note.png}{注意}{#2}} +\newcommand{\hint}[2]{\notebox{#1}{0.15}{./pic/icon/hint.png}{提示}{#2}} +\newcommand{\important}[2]{\notebox{#1}{0.15}{./pic/icon/star.png}{重要}{#2}} +\newcommand{\caution}[2]{\notebox{#1}{0.15}{./pic/icon/caution.png}{小心}{#2}} +\newcommand{\warning}[2]{\notebox{#1}{0.4}{./pic/icon/warning.png}{警告}{#2}} + +\newenvironment{myitemize}{\begin{itemize}\setlength{\parindent}{24pt}}{\end{itemize}} +\newenvironment{myenumerate}{\begin{enumerate}\setlength{\parindent}{24pt}}{\end{enumerate}} +\renewcommand{\labelenumii}{\arabic{enumii})} + +\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} + +\chapter*{产品概述}\addcontentsline{toc}{chapter}{产品概述} +\fancyhead[LE,RO]{\slshape\large产品概述} + +凝思安全操作系统是北京凝思自主研发、拥有完全自主知识产权、具备等保四级要求、并且达到军~B~级安全级别的操作系统,是国内首家达到安全服务器保护轮廓~EAL3~级别的安全产品。 + +北京凝思经过多年的研究,开发出的凝思安全操作系统具有以下主要特点: + +\begin{myitemize} +\item 高可用性 + +凝思安全操作系统发布前进行了长时间的压力测试,能够保证在高内存和~CPU~负载环境下稳定运行,为各类应用提供稳定的运行平台。 + +为进一步提高操作系统稳定性,凝思安全操作系统还提供多种冗余容错机制,降低部件故障引起的整机失效。这些机制包括: +\begin{myitemize} +\item 磁盘冗余技术 + +提供软~RAID~技术,通过磁盘冗余降低磁盘故障引起的系统风险。支持在线重建,减少系统恢复时间,提高系统稳定性。 +\item 网卡冗余技术 + +提供网卡的负载均衡和冗余备份,当两块网卡自身及其链路正常时,可提供网卡负载均衡功能,提高网络传输效率;当一块网卡或其链路发生故障时,另一网卡仍可继续提供服务,提高网络的整体可靠性。 +\item 磁盘阵列卡冗余技术 + +支持磁盘阵列卡的主备机制,当主卡或其通信链路发生故障时,凝思安全操作系统将自动切换至备份卡进行设备访问,保证磁盘阵列数据的连续性。 +\item 软件固化技术 + +支持关键操作系统数据以只读形式存储于电子盘中,防止恶意或偶然操作破坏系统数据。支持无硬盘工作模式,系统运行在基于电子盘的环境中,进一步提高系统稳定性。 +\item 双机热备和服务热切换机制 + +支持分布式双机数据热备份和服务热切换机制,当主服务器当机时服务将自动漂移至辅服务器,由于数据实现实时同步,在服务器单点故障时,服务仍不会终止,系统的整体稳定性得以充分保障。 +\end{myitemize} +\item 高兼容性 + +凝思安全操作系统适用于从大型计算到桌面办公等各种环境,支持各类通用和专业应用,具有良好的软硬件兼容性。 + +凝思安全操作系统的~API~接口和实用工具完全遵循~POSIX~标准,并支持~LSB~和~FHS~等~Linux~相关标准,能够二进制兼容各类为~Linux~系统开发的应用软件,并可在二进制保持与其它~Linux~发行版的兼容。支持基于~Java~的跨平台软件,可实现基于多款中间件软件的~Web~应用系统。支持~32~位和~64~位应用程序,使用户在~32~位系统上开发的软件可直接运行于~64~系统,缩短用户应用系统的研发周期。 + +凝思安全操作系统提供丰富的驱动程序,支持各类主流磁盘驱动器、网卡驱动器和显示控制器等硬件设备。兼容国内外各大主流厂商的多款服务器和桌面计算机。北京凝思还可协助第三方硬件厂商完成驱动程序的研发和移植,实现加密卡等专用硬件设备支持。 +\item 高效性 + +凝思安全操作系统可针对服务器、工作站、专用设备和桌面环境进行特别优化,获得比通用操作系统更高的运行效率。 + +在特定项目的应用环境中,凝思可以还可针对应用系统的特性对操作系统做进一步的优化,使系统的运行效率最大化。各个操作系统内核组件的定制和优化,可充分发挥硬件平台的性能,对应用程序提供最佳支持,构建稳定、高效的计算环境。定制的内容包括: +\begin{myitemize} +\item 定制和剪裁最小应用软件运行环境,保证系统组件的可控性,提高系统的运行效率和可用性。 +\item 定制进程调度策略,减少调度开销,提高操作系统和应用程序的响应速度和运行效率。 +\item 定制文件系统类型和存储模式,提供可靠和有效的文件系统支持,使应用程序能够快速访问文件数据。 +\item 定制驱动程序,实现用户程序对设备数据的快速访问,降低设备访问的系统资源开销,提高应用系统的数据处理能力。 +\end{myitemize} +\item 易维护性 + +凝思安全操作系统的配置、使用和维护方法与传统~UNIX~和~Linux~保持一致,提供丰富的管理和维护软件,既可通过命令行工具完成系统配置和维护,又可通过图形界面完成相关操作,简化用户操作步骤,减少管理员的维护工作量。支持键盘/显示器、串口和网络等多种接入方式,便于管理员的本地和远程 +管理。基于网络的远程管理支持加密通道的远程登录,可使用命令行方式管理远程系统;同时支持远程图形化管理和远程桌面重定向,为管理员和用户提供图形界面的系统维护和操作。服务自启动功能使系统无须人工干预即可自动进入服务提供状态,减少系统故障恢复时间,提高系统可获得性。丰富的审计日志使管理员能够准确分析并定位各类系统故障,为快速排除问题,恢复系统正常运行提供支持。凝思安全操作系统还提供状态显示、声音报警、邮件和短信通知等多种报警机制,使管理员能够及时掌握系统的运行状态,第一时间获取系统紧急故障和安全性信息。 +\end{myitemize} + +\vspace{1cm} +目前,以凝思安全操作系统为核心的安全服务器系统平台已广泛应用在国家部委、军队系统及电信、电力等行业关键部门,并获得了用户的一致好评。 + +\vspace{1cm} +凝思安全操作系统~V6.0~基于凝思安全操作系统~V4.x,并在以下方面对系统进行了改进和完善: + +\begin{myitemize} + \item 硬件兼容性 + +凝思安全操作系统~V6.0~分为32位和64位,支持~x86\_64、i386、PPC、IA、~MIPS、龙芯、spaic~的~CPU,IDE、RAID、USB~和~SCSI~控制器,HBA~控制器,~nVIDIA、ATI~显卡,能在主流厂商的服务器、PC、公共机及笔记本上正常运行。 + +经测试,凝思安全操作系统~V6.0~能在下列服务器上稳定运行:曙光专用并行机、曙光专用并行机-Z、曙光专用并行机-Y、曙光专用并行机-Z2、曙光专用并行机-H、曙光~A830r-fx、曙光~A620r-F、联想~R525G3~机架服务器、联想~R680G7~机架服务器、联想~E710R~刀片服务器、浪潮~NF5220~机架服务器、浪潮~NF5280M2~机架服务器、华为~E6000~刀片服务器、华为~RH2285V1R1~机架服务器、华为~RH2488~机架服务器。 + \item 软件兼容性 + +凝思安全操作系统~V6.0~上可运行多种应用软件。 + +经测试,达梦数据库~V6.0.60、金仓数据库~V6.1.3、神州通用数据库~V7.0、IBM DB2~数据库~V9.7、Oracle 10g~数据库、Oracle 11g~数据库、中创~Inforsuite~中间件~V8.2.0、~OpenLDAP~V2.4.26、曙光、哈工大、计算所、启明星晨和北航等单位的前端和后端软件都能够在凝思安全操作系统~V6.0~上稳定运行。 + \item 软件包管理机制 + +凝思安全操作系统~V6.0~采用~deb~包管理方式,能够更好地处理软件依赖关系,便于本地管理以及远程升级软件包。 + \item 网络部署 + +网络部署模块采用客户端/服务器的网络模式,利用~DHCP/BOOTP~协议从服务器端获得客户端计算机系统的~IP~地址,然后客户端再利用~TFTP~协议从服务器端下载引导程序。这个引导程序为~Network Bootstrap Program(NBP),引导程序加载凝思安全操作系统~V6.0~的安装程序,执行安装程序。安装程序到已经搭建好的凝思安全操作系统~V6.0~的安装源中取得各个需要的组件,安装到硬盘,实现通过网络进行部署。支持全自动网络安装,提高大规模部署的工作效率,降低安装出错几率。 + \item 能量控制 + +在能量控制研究方面,经过仔细分析计算机中~cpu、硬盘、显卡等硬件的耗电情况,根据实际应用要求,最终确定以控制~cpu~频率、内核节电配置和用内存盘缓存硬盘读写的方案实现能耗的降低。通过方案的实施,达到了相对原有系统能耗降低0.5\%的目标。 + \item 速率优化 + +在速率优化方面,分别针对~AMD~和~Intel~的体系结构进行了研究。主要在内核中针对不同体系结构的选项进行筛选,在编译系统的过程中,为不同的体系结构配置了不同的编译选项。 + \item 凝思安全机制 + +凝思安全操作系统~V6.0~的安全机制继承了原~4.2~系统安全的优点,并不断创新和完善,主要有以下改进: +\begin{myitemize} + \item 强制访问控制(Mandatory Access Control,简称~MAC) + +在~4.2~系统实现的强制访问控制功能中,强制访问控制策略中的规则是固定的,数据流动需同时满足~BLP~策略和~BIBA~策略。规则固定,主体和客体标签的含义也是固定的,分别代表~BLP~级别(category)、BLP~类别(class)以及~BIBA~的完整性级别(integrity)。而~6.0~系统中实现的强制访问控制的规则是可以配置的,标签的含义也是可以配置的,并且可以配置为完全覆盖~4.2~系统的强制访问控制机制。另外,与~4.2~不同的是,6.0~的标签是全系统的,每个主体或客体都带有标签。 + \item 强制行为控制(Mandatory Behavior Control,简称~MBC) + +MBC~是~4.2~系统中~MEC(Mandatory Execution Control,强制运行控制)的增强。MEC~是对进程执行系统调用~execve~进行控制,控制结果为允许或者拒绝。MBC~在~MEC~的基础上将控制的行为从执行扩展到读、写和执行。 + \item 强制能力控制(Mandatory Capability Control,简称~MCC) + +MCC~包括两方面,一个是限制~setuid-root~文件执行时引入的能力,另一个是建立分权管理员机制。这两方面的目的和~4.2~系统的目的是一致的,但是我们采用了完全不一样的实现方式,并且特权管理员由原来固定的4个扩展为可自定义配置。 +\end{myitemize} +\end{myitemize} + + +\chapter*{关于本书}\addcontentsline{toc}{chapter}{关于本书} +\fancyhead[RE,LO]{\slshape\large关于本书} + +\section*{文档约定}\addcontentsline{toc}{section}{文档约定} +\fancyhead[LE,RO]{\slshape 文档约定} + +本手册中会有某些字词使用了不一样的字体、样式,规律如下: +\begin{myitemize} + \item \verb=command= + +命令,表示您可以在命令行中键入单词或短语,然后按~\key{Enter}~键来启用命令。 + +例如:使用~\verb=cat testfile=~命令来查看当前目录中一个叫~\verb=testfile=~的文件。 + \item \verb=file name= + +文件名、目录名、路径,表示系统中存在着一个叫这个名称的文件或目录。 + +例如: +\begin{myitemize} + \item 您的主目录中的\verb=.bashrc=文件包括您自用的~\textbf{bash shell}~定义和别名。 + \item \verb=/etc/fstab=~文件包括关于不用系统设备和文件系统的信息。 +\end{myitemize} + \item \verb=parameter value= + +参数及其设定值。 + +例如: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=ServerType standalone= +\end{shaded} +\end{minipage} + +\verb=ServerType=~定义服务器的启动方式,缺省值为独立方式~\verb=standalone=。 + \item \verb=script= + +脚本。 + +例如: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} + + Options FollowSymLinks + AllowOverride None + + + +\end{verbatim} +\end{shaded} +\end{minipage} +% \item \textbf{application} +% +% 应用程序。 +% +% 例如:使用~\textbf{Mozilla Firefox}~来浏览万维网。 + \item \key{key} + +键盘上的按键。 + +例如:要使用~\key{Tab}~键补全,键入一个字符然后按~\key{Tab}~键,您的终端上就会显示目录中起首为那个字符的文件列表。 +% \item \key{key}~-~\key{combination} +% +% 击键的组合方式。 +% +% 例如:\key{Ctrl}~-~\key{Alt}~-~\key{Backspace}~击键组合会退出您的图形会话,把您返回到图形登录屏幕或控制台。 +% \item [菜单]\textrightarrow[下拉菜单] +% +% 用这种方式表示的词汇表明它位于一个菜单或下拉菜单上。如果您在图形界面屏幕上点击了这个词,应出现菜单的其它部分。例如: +% +% 使用[文件]中的选项,还可以导入、导出日历和将归档存档。 +% +% 如果您需要在菜单上点击一系列命令的话,它们会如下面的例子中所示: +% +% 如果要查找在~KDE~中定义的键盘快捷方式,请从主菜单中选择[个人设置]\textrightarrow[区域和辅助功能]\textrightarrow[键盘快捷方式]。 +% \item \button{按钮} +% +% 这种方式表明它是对话框窗口中可点击的按钮。例如: +% +% 点击~\button{后退}~返回到您刚才查看的网页。 +% \item \textbutton{Button}~或~\setupbutton{Button} +% +% 这种方式表明它是字符界面窗口中可用的按钮。例如: +% +% 移动到~\textbutton{Edit}~上并按~\key{Enter}~键进入编辑状态。 +% +% 移动到~\setupbutton{Yes}~上并按~\key{Enter}~键继续。 +\end{myitemize} + +\vspace{1cm} +除此之外,我们还使用几种不同的方式来强调某些信息。按照信息对您的系统的重要程度,它们被标为注意、提示、重要、小心或警告。例如: + +\note{15cm}{切记,凝思安全操作系统区分大小写。换一句话说,rose~不是~ROSE~或~Rose。} + +\hint{15cm}{目录~\texttt{/usr/share/doc}~包括了关于您的系统上安装的软件包的附加信息。} + +\important{15cm}{如果您修改了~DHCP~配置文件,这些改变在您重启~DHCP~守护进程之后才会生效。} + +\caution{15cm}{管理员帐号是用来执行系统管理任务的,执行日常任务请使用一个常规的用户帐号。} + +\warning{15cm}{删除分区操作没有确认过程,会直接将已有分区删除。如果您想撤销该删除操作,只能不将分区结果写入磁盘而直接退出分区界面,然后再重新进入分区界面,但之前的所有分区操作都将丢失。慎用!} + +\section*{术语简介}\addcontentsline{toc}{section}{术语简介} +\fancyhead[LE,RO]{\slshape 术语简介} + +您会在凝思安全操作系统的文档中经常看到以下这些术语: +\begin{myitemize} +\item shell + +登录~Linux~系统时,系统会为登录用户启动一个程序。通过这个程序,可以和~Linux~进行交互。这个程序就是通常所说的~Linux shell,它的作用就是执行通过键盘输入的命令。 +\item 命令(Command) + +给计算机的命令,多数使用键盘或鼠标输入。 +\item 命令行(Command line) + +在~shell~提示中键入命令的地方。 +\item shell~提示(shell prompt) + +用户和操作系统的命令行界面。shell~解释用户输入的命令,并把它们传递给操作系统。 + +shell~运行的时候会在屏幕上显示一个提示符,这表示它在等待用户的命令。当输入了命令并按下~\key{Enter}~键,shell~就开始解释命令并且执行这个命令。如果输入了一个并不存在的命令,shell~也会提示您,并且重新显示提示符,等待输入下一个命令。 +\item 手册页(Man page)和信息页(Info page) + +手册(Man~是~manual~的简写)页和信息页提供了关于命令或文件的详细信息(手册页比信息页提供的解释要简略)。例如,要阅读~\verb=su=~命令的手册页,在~shell~提示下输入~\verb=man su=(或输入~\verb=info su=~来阅读信息页)。要关闭手册页或信息页,按~\key{q}。 +\item 根(root) + +根是在安装中创建的超级用户账号,除非您设置了强制访问控制,否则它对您的系统有完全的访问权。在一般~UNIX/Linux~系统中,您必须登录为根用户来完成某些系统管理任务,如改变管理口令和运行系统配置工具。用户帐号的创建目的是使您不必使用根帐号来完成普通的用户任务,从而减少永久性损坏您的操作系统安装或应用程序的机会。 + +\item 终端 + +终端是一种字符型设备,它有多种类型,通常使用~tty~来简称各种类型的终端设备。tty~一词源于~Teletypes,或者~teletypewriters,原来指的是电传打字机,是通过串行线用打印机键盘通过阅读和发送信息的东西,后来这东西被键盘与显示器取代,所以现在叫终端比较合适。 +\item 控制台 + +控制台是与操作系统交互的设备,系统将一些信息直接输出到控制台上。 + +在~Linux~系统中,计算机显示器通常被称为控制台终端(Console)。它仿真了类型为~Linux~的一种终端,并且有一些设备特殊文件与之相关联:tty0、tty1、tty2~等。当您在控制台上登录时,使用的是~tty1。使用~\key{Alt}~-~\key{F1}~~~\key{F6}~组合键时,我们就可以切换到~tty2、tty3~等上面去。tty1~~~tty6~等称为虚拟终端,而~tty0~则是当前所使用虚拟终端的一个别名,系统所产生的信息会发送到该终端上(这时也叫控制台终端)。因此不管当前正在使用哪个虚拟终端,系统信息都会发送到控制台终端上。您可以登录到不同的虚拟终端上去,因而可以让系统同时有几个不同的会话存在。 +\item 图形化用户界面(Graphical User Interface,GUI) + +互动窗口、图标、菜单、以及允许用户使用鼠标和键盘来引发启动程序和打开文件等行动的统称。 +\item 图形化桌面(Graphical Desktop) + +GUI~中的最可见部分。桌面是您的“用户主目录”和“从这里开始”启动器图标的位置。您可以给桌面配置特殊的背景、颜色和图片来为它添加一点儿个人色彩。 +\item 图标(Icon) + +代表应用程序、文件夹、快捷方式或系统资源(如软盘驱动器)的小图像。启动器(Launcher)图标通常指启动应用程序的快捷方式。 +\item 面板(Panel) + +桌面工具栏。通常横贯桌面底部。面板上包含“主菜单”按钮和启动常用程序的快捷方式图标。您可以定制面板来满足您的个人需要。 +\item X~或~X~窗口系统(X Window System) + +这两个术语代表图形化用户界面环境。如果您“在~X~内”或“在运行~X~”,这意味着您的工作环境是~GUI~而非控制台。 +\item 互联网 + +互联网(internet,普通名词),泛指网络集合,是由各种不同类型和规模的计算机网络组成的计算机网络。组成互联网的计算机网络,可以是局域网(LAN)、城域网(MAN)或者广域网(WAN)等,其基本组成单元是网络,可以将互联网称为“联接网络的网络”。 +\item 因特网 + +因特网(Internet,专用名词) ,特指由~TCP/IP~协议构建的互联网(internet)。因特网是互联网的一种。 +\item 万维网 + +万维网(World Wide Web,简称“Web”、“WWW”、“W3”)是一个由许多互相链接的超文本文档组成的系统,通过~Internet~访问。在这个系统中,每个有用的事物,称为一样“资源”;并且由一个全域“统一资源标识符”(URI)标识;这些资源通过超文本传输协议(Hypertext Transfer Protocol)传送给使用者,而后者通过点击链接来获得资源。 + +万维网常被当成因特网的同义词,这是一种误解,万维网是靠着因特网运行的一项服务。 +\end{myitemize} + +\section*{如何使用本书}\addcontentsline{toc}{section}{如何使用本书} +\fancyhead[LE,RO]{\slshape 如何使用本书} + +本书旨在指导用户使用凝思安全操作系统~V6.0,系统安装请阅读《凝思安全操作系统~V6.0~安装手册》。 + +\titleformat{\chapter}{\Huge\bfseries}{第\,{\thechapter}\,章}{1em}{} +\titlecontents{chapter}[4em]{}{\renewcommand{\baselinestretch}{2}\bfseries\contentslabel[第\,{\thecontentslabel}\,章]{3.5em}}{}{\titlerule*{}\bfseries\contentspage} +% \titleformat{\chapter}{\Huge\bfseries}{第\,\CJKnumber{\thechapter}\,章}{1em}{} +% \titlecontents{chapter}[4em]{}{\renewcommand{\baselinestretch}{2}\bfseries\contentslabel[第\CJKnumber{\thecontentslabel}章]{3.5em}}{}{\titlerule*{}\bfseries\contentspage} + +\chapter{登录和注销} +\fancyhead[LO,RE]{\slshape \leftmark} +\fancyhead[LE,RO]{\slshape \rightmark} + +\section{登录} +启动计算机后进入~GRUB~界面,如图~\ref{f1}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=0.8]{./pic/grub.png} + \caption{GRUB~界面}\label{f1} +\end{figure} +% \end{center} + +凝思安全操作系统~V6.0~有几种模式选择: +\begin{myitemize} +\item Linx GNU/Linux, with Linux 2.6.32-5-linx-amd64 + +维护模式,启动后任何用户均可登录,主要用来进行系统配置、维护事务。 +\item Linx GNU/Linux, with Linux 2.6.32-5-linx-amd64 (recovery mode) + +恢复模式,提供一个 root shell 和只读的文件系统,用于进行系统恢复。 +\item Linx GNU/Linux, with Linux 2.6.32-5-linx-amd64 (linx no root mode) + +运行模式,启动后无root用户,由管理员用户和普通用户进行日常事务管理和操作。 +\end{myitemize} + +\vspace{1cm} +使用~\key{$\uparrow$}~和~\key{$\downarrow$}~键选择~Linx GNU/Linux, with Linux 2.6.32-5-linx-amd64 (linx no root mode),按~\key{Enter}~键继续。 + +所有用户登录都必须进行鉴定。凝思安全操作系统V6.0采用口令和指纹双因子鉴别方式,当您启动系统后,系统会提示您输入用户名,然后提示输入该用户相应的指纹信息,指纹鉴定成功后再输入口令,才可完成登录。如果用户及其指纹信息尚未创建,请与管理员联系以获取用户名和口令。 + +如果您安装了桌面环境,系统将自动进入桌面登录画面,详见第~\ref{s17}~节。如果没有安装桌面环境,系统将使用控制台的登录方式,详见第~\ref{s18}~节。您也可以切换到其它控制台登录。 + +\subsection{从桌面登录}\label{s17} +登录屏幕中包含用户名输入字段,首先需要输入用户名,如图~\ref{f3}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/login-1.png} + \caption{登录-输入用户名称}\label{f3} +\end{figure} +% \end{center} + +\newpage +由于系统采用口令和指纹双因子鉴别方式,输入用户名敲回车键后,输入该用户的指纹信息,此时需要在指纹仪上按下正确的指纹,如图~\ref{x1}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/fingerprinter.png} + \caption{登录-输入指纹信息}\label{x1} +\end{figure} +% \end{center} + +\newpage +在指纹仪上输入正确的指纹信息后,在登录屏幕界面输入用户口令,若正确输入口令并回车,则可登录到系统中,如图~\ref{x2}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/login-2.png} + \caption{登录-输入用户口令}\label{x2} +\end{figure} +% \end{center} + +\newpage +\hint{15cm}{应保证系统已经安装好指纹仪设备并且完成了指纹仪的登录配置。如果用户口令输入错误,请按ESC键退出,然后重新输入密码。} + +系统默认使用Gnome桌面环境,如图~\ref{f4}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/gnome.png} + \caption{Gnome桌面环境}\label{f4} +\end{figure} +% \end{center} + +\subsubsection{桌面的使用} +Gnome桌面的面板位于屏幕上方,包括应用程序菜单、快速启动栏、任务管理器、系统托盘等。单击“应用程序”,选择要启动的程序即可打开使用,如图~\ref{gnome3}~所示。您还可以直接点击快速启动栏上的程序,以及将应用程序添加到快速启动栏。 + +\newpage +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/gnome3.png} + \caption{开始使用系统}\label{gnome3} +\end{figure} + +桌面切换位于屏幕下方,您可以将不同的会话分别放置在各个桌面上,直接点击屏幕右下角的图标即可进行桌面切换。默认设置为4个桌面,您还可以自己更改数量。 + +\subsubsection{控制会话} +用户名和口令通过登录进程的鉴定后,将启动会话管理器。通过会话管理器,可以保存每个会话的设置。还可以保存最近一次的会话状态,这样,在下次登录时就能返回该状态。 + +会话管理器可以保存并恢复以下设置: +\begin{myitemize} +\item 外观和行为设置,如字体、颜色和鼠标设置 +\item 运行的一些应用程序,如文件管理器 +\end{myitemize} + +\important{15cm}{系统不能保存或恢复会话管理器没有进行管理的应用程序。例如,如果通过终端窗口中的命令行启动~\textbf{vi}~编辑器,则会话管理器不能恢复您的编辑会话。} + +\newpage +\subsubsection{锁定屏幕}\label{s5} +要锁定屏幕,请执行以下一项操作: +\begin{myitemize} +\item 从启动栏中选择“系统”——“锁住屏幕”,如图~\ref{gnome1}~所示。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.7]{./pic/gnome1.png} + \caption{锁定屏幕}\label{gnome1} +\end{figure} + +\item 使用键盘快捷方式。通常为~\key{Ctrl}~-~\key{Alt}~-~\key{L} 。 +\end{myitemize} + +% \hint{15cm}{如果要查找在~KDE~中定义的键盘快捷方式,请从主菜单中选择[个人设置]\textrightarrow[区域和辅助功能]\textrightarrow[键盘快捷方式]。要更改快捷方式,请双击它并输入一个新的快捷方式。详见第~\ref{s3}~节 “区域和辅助功能”。} +% +% 要快速访问,您也可以将锁定和注销图标添加到面板。为此,请右击面板然后单击[添加到面板]\textrightarrow[小程序]\textrightarrow[锁定/注销小程序]。 + +锁定屏幕时会启动屏幕包含程序。要解除屏幕锁定,请移动鼠标以显示锁定的屏幕对话框。输入用户名和口令,然后按~\key{Enter}~键,如图~\ref{gnome2}~所示。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.7]{./pic/gnome2.png} + \caption{解除屏幕锁定}\label{gnome2} +\end{figure} + +% 有关配置屏幕保护程序的信息,详见第~\ref{s4}~节 “外观和主题”。 + +\subsection{从控制台登录}\label{s18} +系统启动后,用户可以得到登录提示: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=localhost login:= +\end{shaded} +\end{minipage} + +输入用户名,按~\key{Enter}~键。由于系统采用口令和指纹双因子鉴别,在控制台登录时,也需要用户在输入用户名后,在指纹仪中按下正确的指纹完成指纹鉴定: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=Place your finger on frt610 in 10 seconds then press [Enter]!= +\end{shaded} +\end{minipage} + +指纹鉴定成功后,按下~\key{Enter}~键,系统提示输入用户口令: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=Password:= +\end{shaded} +\end{minipage} + +输入正确的口令并按~\key{Enter}~键后,该用户将登录到系统,显示如: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=username@localhost:~ >= +\end{shaded} +\end{minipage} + +\note{15cm}{输入密码的过程是不显示的,也就是说您会看到屏幕上一点反应也没有,这也是本系统安全的原因之一,为的是保持用户密码的安全,输入密码后按~\key{Enter}~键即可。} + +\hint{15cm}{根据采用的指纹仪型号的不同,指纹鉴定提示可能会有变化,应以用户实际使用的指纹仪为准! +这里的~\texttt{username}~指您实际登录的用户名,\texttt{localhost}~是您的主机名,在安装时可以设置,默认设置为~\texttt{Rocky}。如,在计算机~linx~上使用~testuser~用户登录,输入正确的密码后,系统将提示“\texttt{testuser@linx:\textasciitilde ~$>$}”。} + +若密码输入错误该用户不存在,系统将提示登录失败,需重新登录: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=Login incorrect= + +\verb=localhost login:= +\end{shaded} +\end{minipage} + +您可以重新尝试登录,但是有次数限制,如果达到预定义次数的非成功尝试,系统将在一段时间间隔后才允许重新登录。预定义次数和时间间隔由授权管理员设置。 + +\vspace{1cm} +用户还可以在其它情况下登录到凝思安全操作系统。 + +\begin{myitemize} +\item 使用~\key{Ctrl}~-~\key{Alt}~-~\key{F1}~~~\key{F6}~切换到不同的控制台,用不同的用户登录。 +\item 使用命令~\verb=su username=~从当前用户切换到用户~username~登录。 + +如:当前用户为~testuser1,输入命令~\verb=su testuser2=~或~\verb=su - testuser2=,输入用户~testuser2~的口令后,从用户~testuser1~切换到用户~testuser2。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +testuser1@localhost:~ >su testuser2 +Passowrd: +testuser2@localhost:/home/testuser1 > +\end{verbatim} +\end{shaded} +\end{minipage} + +\note{14cm}{使用~\texttt{su - username}~切换用户登录后会切换到用户~username~的主目录,而使用~\texttt{su username}~则不会。} +\end{myitemize} + +% \newpage +\section{文档和帮助} +用户使用系统过程中,可以使用~\verb=man=~命令查看各命令的手册页,或使用~\verb=info=~命令查看各信息页。 + +例如,要阅读~\verb=ls=~命令的手册页,在~shell~提示下输入~\verb=man ls=(或输入~\verb=info ls=~来阅读信息页)。要关闭手册页或信息页,按~\key{q}。 + +\newpage +\section{注销} +\subsection{从桌面注销} +在桌面环境下,您不再使用计算机时,您可以注销并让系统保持运行。 + +要注销并保持系统运行,请执行以下操作: +\begin{myitemize} +\item 单击面板上的“系统”,从菜单中选择[注销],如图~\ref{gnome4}~所示。 + + +\begin{figure}[H] + \centering + \includegraphics[scale=0.7]{./pic/gnome4.png} + \caption{从桌面注销}\label{gnome4} +\end{figure} + +\item 点击“注销”,如图~\ref{gnome5}~所示。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.7]{./pic/gnome5.png} + \caption{注销}\label{gnome5} +\end{figure} + +% \item 使用键盘快捷方式。通常为~\key{Ctrl}~-\key{Alt}~-~\key{Del} ,然后单击~\button{注销}。 +\end{myitemize} + +\subsection{从控制台注销} +在控制台中,输入~\verb=logout=,该用户将注销登录,系统返回登录提示: + +\verb=login:= + +用户需重新登录才能使用系统。 + +\newpage +\section{远程登录} +凝思安全操作系统支持远程桌面,以下是一个简单的使用实例。 + +有两台安装了凝思安全操作系统的机器,假设为machine-1和machine-2,IP分别为172.16.0.245和172.16.0.235。现在想要从machine-2远程登录到machine-1的桌面,可以通过以下步骤实现: +首先在machine-1上开启“允许其他人查看您的桌面”。依次点击桌面左上角“系统——首选项——远程桌面”,在打开的“远程桌面首选项”窗口,选中“允许其他人查看您的桌面”复选项,点击“关闭”。 + +\begin{figure}[H] +\begin{minipage}[c]{8cm} +\centering + \includegraphics[scale=0.5]{./pic/remote01.png} +\end{minipage} +\hfill +\begin{minipage}[c]{8cm} +\centering + \includegraphics[scale=0.5]{./pic/remote02.png} +\end{minipage} + \caption{允许其他人查看您的桌面}\label{remote01} +\end{figure} + +\newpage +然后在machine-2上远程登录到test1。在machine-2的console窗口,执行vncviewer,在弹出交互界面的server:后输入172.16.0.245(machine-1的IP地址),按“enter”键,然后等待machine-1允许授权。 + +\begin{figure}[H] +\centering +\begin{minipage}[c]{15cm} +\centering +\includegraphics[scale=0.5]{./pic/remote03.png} + +\vspace{.5cm} +\includegraphics[scale=0.5]{./pic/remote04.png} +\end{minipage} + \caption{远程登录}\label{remote03} +\end{figure} + +\newpage +切换到machine-1机器允许machine-2远程登录到自己桌面,如图~\ref{remote05}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/remote05.png} + \caption{允许远程登录}\label{remote05} +\end{figure} + +切换到machine-2机器,发现已经远程登录到了machine-1的桌面,如图~\ref{remote06}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/remote06.png} + \caption{登录到远程桌面}\label{remote06} +\end{figure} + + +\chapter{系统基本使用} +尽管图形用户界面对~Linux~已经越来越重要,但是使用鼠标并不总是处理日常工作的最佳方式。命令行不仅高度灵活而且效率较高。本章主要是对~Bash shell~基本使用的简要介绍,解释~Linux~中的用户权限概念,并提供较重要的命令列表。 + +要控制文本模式下的计算机,基于文本的应用程序尤为重要。这种情况下需要使用虚拟控制台。有六个控制台可以在文本模式下使用。对应的组合键分别为~\key{Alt}~-~\key{F1}~~~\key{F6}。第七个控制台是为~X~窗口系统保留的。 + +\section{Bash~简介}\label{s12} +用户登录后进入控制台,该控制台通常运行~Bash(Bourne again shell,该程序是~GNU~项目中的一部分)。运行该~shell~后,请查看第一行的提示,通常由用户名、主机名和当前路径组成。但可对其进行自定义。当光标移到该提示后面时,您可以直接向所在计算机系统发送命令。 + +\subsection{命令} +一条命令包含若干元素。第一个元素总是真正的命令,随后是参数或选项。按~\key{Enter}~键即可执行命令。在此之前,您可以很容易地编辑命令行、添加选项或更正输入错误。\verb=ls=~是一个最常用的命令,该命令可以使用参数,也可以不使用。在控制台中只输入~\verb=ls=~命令将显示当前目录的内容。 + +选项以连字符为前缀。例如,命令~\verb=ls -l=~将显示同一目录中内容的详细信息。在每个文件名后,都可以看到文件的创建日期、以字节表示的文件大小和下文要涉及的其它详细信息。\verb=--help=~是许多命令都有的非常重要的选项。输入~\verb=ls --help=~可以显示~\verb=ls=~命令的所有选项。 + +也可以使用~\verb=ls=~命令查看其它目录下的内容。为此,必须将该目录指定为参数。例如,要查看~\verb=/home=~下的内容,应输入~\verb=ls -l /home=。 + +\subsection{文件和目录}\label{s8} +要高效使用~shell,掌握一些关于~Linux~系统的文件和目录结构的知识将有很大帮助。您可以将目录视为存储文件、程序和子目录的电子文件夹。层次中的顶级目录是根目录,用~\verb=/=~表示。从此目录可以访问其它所有目录。\verb=/home=~目录包含用于存储个人用户私人文件的目录。目录树如图~\ref{f17}~所示。 + +% \begin{center} +\begin{figure}[H] + \centering + \includegraphics[scale=.7]{./pic/tree.png} + \caption{目录树}\label{f17} +\end{figure} +% \end{center} + + +以下简要说明了~Linux~中的标准目录。 + +\begin{myitemize} +\item \verb=/ =\quad 根目录,目录树的起点 +\item \verb=/bin =\quad 在引导过程初期需要的程序 +\item \verb=/dev =\quad 代表硬件组件的设备文件 +\item \verb=/etc =\quad 重要的系统配置文件 +\item \verb=/etc/init.d =\quad 引导脚本 +\item \verb=/home =\quad 用户目录 +\item \verb=/lib =\quad 共享库(供动态链接程序使用) +\item \verb=/opt =\quad 选件,大型装载程序包(如~KDE、GNOME、Netscape) +\item \verb=/proc =\quad 进程文件系统 +\item \verb=/sbin =\quad 为系统管理员保留的用于引导的程序 +\item \verb=/sys =\quad “system”文件系统,在其中收集内核的所有设备信息 +\item \verb=/tmp =\quad 临时文件 +\item \verb=/usr =\quad 所有应用程序 +\item \verb=/usr/bin =\quad 通常可访问的程序 +\item \verb=/usr/include =\quad C~编译器的头文件 +\item \verb=/usr/include/c++=\quad C++~编译器的头文件 +\item \verb=/usr/local = \quad 本地的、与发布版无关的扩展 +\item \verb=/usr/sbin =\quad 为系统管理员保留的程序 +\item \verb=/usr/share/doc =\quad 各种文档文件 +\item \verb=/usr/share/man =\quad 系统手册页 +\item \verb=/usr/src =\quad 系统软件的源代码 +\item \verb=/usr/src/linux =\quad 内核源代码 +\item \verb=/var =\quad 系统正常运行时所改动的数据 +\item \verb=/var/log =\quad 系统日志文件 +\item \verb=/var/tmp =\quad 临时文件 +\end{myitemize} + +\subsection{Bash~功能} +Bash shell~提供的两种重要功能可以让您的工作变得很简单: +\begin{myitemize} + \item 历史记录 + +要重复以前输入的命令,请按~\key{$\uparrow$}~键,直到先前命令在提示符处出现。按~\key{$\downarrow$}~键可以在先前输入的命令列表中前移。要编命令行,只需使用箭头键将光标移至所需位置并开始键入。使用~\key{Ctrl}~-~\key{R}~可在历史记录中搜索。 +\item 展开 + +在键入文件名的第几个字母后,展开完整的文件名,直至它可以被唯一标识。只需在键入前几个字母后按~\key{Tab}~键即可实现此功能。如果有多个文件名的前几个字母都相同,则按两次~\key{Tab}~键可获取这些文件的列表。 +\end{myitemize} + +\subsection{指定路径} +处理文件或目录时,指定正确的路径十分重要。不过,您不必输入从主目录到各个文件的完整(绝对)路径。您可以从当前目录开始指定。直接用~\textasciitilde ~来表示主目录。例如主目录下有个~\verb=test=~目录,那么有两种方法可以列出~\verb=test=~目录中的文件:用~\verb=ls text=~输入相对路径或用~\verb=ls ~/test=~指定绝对路径。 + +要列出其他用户主目录的内容,请输入~\verb=ls ~username=。例如某个用户是testuser,这样,使用~\verb=ls ~testuser=~就会列出~\verb=testuser=~主目录的内容。 + +用一个圆点来表示当前目录。当前目录的上一级目录用两个点来表示。输入~\verb=ls ..=~可以查看当前目录的父目录的内容。命令~\verb=ls ../..=~可用于比当前目录高两个级别的目录的内容。 + +\subsection{通配符}\label{s20} +shell~的便捷之处还体现在通配符上。Bash~提供四种不同的通配符: +\begin{myitemize} +\item \verb=?= \quad 完全匹配任一字符。 +\item \verb=*= \quad 匹配任意数目的字符。 +\item \verb=[set]= \quad 匹配在方括号中指定的字符组中的任一字符,这里用字符串~set~表示字符组。 +\item \verb=[!set]= \quad 匹配~set~标识字符之外的任一字符。 +\end{myitemize} + +假定~\verb=test=~目录包含文件~\verb=testfile=、\verb=testfile1=、\verb=testfile2=~和~\verb=datafile=,使用命令~\verb=ls testfile?=~则可以列出文件~\verb=testfile1=~和~~\verb=testfile2=。使用~\verb=ls testfile*=,列表还将包括~\verb=testfile=。\verb=ls *file*=~会显示所有示例文件。最后,您可以使用~\verb=set=~通配符表示所有末尾字符为数字的示例文件:~\verb=ls testfile[1-9]=。 + +四个通配符中匹配范围最广的是星号。使用它可以将某个目录内的所有文件复制到另一个目录,或通过一个命令删除所有文件。例如,使用命令~\verb=rm *file*=~可以删除当前目录中文件名包含字符串~\verb=file=~的所有文件。 + +\subsection{less~和~more} +Linux~包含两个直接在~shell~中查看文本文件的小程序。不必启动编辑器来阅读~\verb=Readme.txt=~之类的文件,只需输入~\verb=less Readme.txt=~即可在控制台窗口中显示其中的文本。使用~\key{Enter}~键可以向下滚动一行,使用~\key{Space}~键可以向下滚动一页,使用~\key{$\uparrow$}~和~\key{$\downarrow$}~键可以使文本按行上下滚动,使用~\key{Page Up}~和~\key{Page Down}~键可以使文本按页上下滚动,要退出~\textbf{less},请按~\key{Q}。 + +除了使用~\textbf{less}~之外,您还可以使用~\textbf{more}~这种较早的程序。不过,该程序使用起来不太方便,因为它不允许向上滚动文本,只能使用~\key{Enter}~或~\key{Space}~键向下滚动一行或一页。 + +\textbf{less}~程序得名于~less is more(少即是多)原则,并且还可用来方便查看命令输出。要了解该程序的这种功能,详见下一节“管道”。 + +\subsection{管道} +通常,shell~的标准输出界面是您的屏幕或控制台窗口,而标准输入设备是键盘。要将命令的输出转发到像~\textbf{less}~这样的应用程序,就需要使用管道。 + +要查看~\verb=text=~目录下的文件,请输入命令~\verb=ls test | less=。\verb=test=~目录的内容将使用~\textbf{less}~来显示。这只是在~\verb=ls=~命令正常输出过长时才有意义。例如,当您使用~\verb=ls /dev=~命令查看~\verb=dev=~目录的内容时,您只能在窗口中看到一小部分。而使用~\verb=ls /dev | less=~命令则能够查看整个列表。 + +也可以将命令的输出保存到文件中。例如,\verb=ls test > content=~会生成一个名为~\verb=content=~的新文件,其中包含~\verb=test=~中的文件和目录的列表。用~\verb=less content=~命令可以查看该文件。 + +您也可以将文件作为命令的输入。例如,用~\verb=sort < testfile=~命令对~\verb=testfile=~中的文本行进行排序。\verb=sort=~命令的输出被发送到屏幕。文本按各行的首字符进行排序,如果两行的首字符相同,该命令将继续比较这两行的下一字符,如果还相同,将继续进行比较。 + +如果需要用一个新文件来包含排序列表,则需要将~\verb=sort=~命令的输出用管道输出至一个文件。要测试该命令,在编辑器中创建一个未排序的名称列表,并在命名为~\verb=list=~后保存到~\verb=test=~目录中。然后转至~\verb=test=~目录并输入命令~\verb=sort < unsortedlist > sortedlist=。最后,使用~\textbf{less}~查看经过排序的列表。 + +标准错误输出和标准输出一样,都发送至控制台。不过,要将标准错误输出重定向到名为~\verb=errors=~的文件,则需要在相应命令中追加~\verb=2> errors=。如果追加的是~\verb=>& alloutput=,标准输出和标准错误都将保存到名为~\verb=alloutput=~的文件中。最后,要将命令输出结果追加到现有文件,该命令后面必须跟有~\verb=>>=~而不是单个~\verb=>=。 + +\hint{15cm}{在~Linux~中,内核为每个命令自动打开3个文件,分别是命令的输入、输出和错误信息文件。每个打开的文件都有一个小的整数与之对应,称为文件描述符。标准输入、标准输出、标准出错的文件描述符分别是0、1、2。} + +\subsection{存档和数据压缩} +您已经创建了一些文件和目录,现在该考虑一下存档和数据压缩的问题了。假定您想将整个~\verb=test=~目录打包在一个文件中,以便备份到软盘或通过电子邮件发送。要执行该操作,请使用命令~\verb=tar=(代表~tape archiver,即磁带存档程序)。使用~\verb=tar --help=~可查看~\verb=tar=~命令的所有选项。下面对最重要的一些选项进行了说明: +\begin{myitemize} + \item \verb=-c= \quad (代表~create)创建新档案。 + \item \verb=-t= \quad (代表~table)显示档案中的内容。 + \item \verb=-x= \quad (代表~extract)对档案解包。 + \item \verb=-v= \quad (代表~verbose)创建档案时在屏幕上显示所有文件。 + \item \verb=-f= \quad (代表~file)为档案文件选择一个文件名。创建档案时,此选项总应放在最后。 +\end{myitemize} + +要将~\verb=test=~目录下的所有文件和子目录打包到名为~\verb=testarchive.tar=~的档案中,请使用选项~\verb=-c=~和~\verb=-f=。尽管不是必需的,但出于测试的目的,请同时添加~\verb=-v=~选项,以便跟踪存档过程。在使用~\verb=cd=~命令转至~\verb=test=~目录所在的主目录后,输入~\verb=tar -cvf testarchive.tar test=。之后,可使用~\verb=tar -tf testarchive.tar=~查看档案文件的内容。\verb=test=~目录及其所有文件和目录都在您的硬盘上保持不变。要对档案解包,请输入~\verb=tar -xvf testarchive.tar=。 + +对于文件压缩,常用的~\textbf{gzip}~程序当然是~Linux~系统的首选。只需输入~\verb=gzip testarchive.tar=~即可。通过~\verb=ls=,您可以看到文件~\verb=testarchive.tar=~已不复存在,取而代之的是文件~\verb=testarchive.tar.gz=。这个文件要小得多,因此也更适于通过电子邮件传送或存储到软盘上。 + +现在,将该文件解包到先前创建的~\verb=test2=~目录中。这需要输入~\verb=cp testarchive.tar.gz test2=~将文件复制到该目录中。使用~\verb=cd test2=~转至该目录。扩展名为~\verb=.tar.gz=~的压缩档案可用~\verb=gunzip=~命令解压缩。输入~\verb=gunzip testarchive.tar.gz=~将生成文件~\verb=testarchive.tar=,然后还需使用~\verb=tar -xvf testarchive.tar=~命令抽取或执行~untar~操作。您也可以通过添加~\verb=-z=~选项一步完成解压和抽取压缩档案。完整的命令为~\verb=tar -xzvf testarchive.tar.gz=。通过~\verb=ls=,您会看到新建的~\verb=test=~目录,其内容与主目录中的~\verb=test=~目录的内容完全相同。 + +\section{用户和访问控制}\label{s9} +访问控制是网络安全防范和保护的主要核心策略,它的主要任务是保证网络资源不被非法使用和访问。访问控制规定了主体对客体访问的限制,并在身份识别的基础上,根据身份对提出资源访问的请求加以控制。它是对信息系统资源进行保护的重要措施,也是计算机系统最重要和最基础的安全机制。 + +访问控制的基本概念有: +\begin{myitemize} +\item 主体(Subject) + +主体是指主动的实体,是访问的发起者,它造成了信息的流动和系统状态的改变,主体通常是进程。 +\item 客体(Object) + +客体是指包含或接受信息的被动实体,客体在信息流动中的地位是被动的,是处于主体的作用之下,对客体的访问意味着对其中所包含信息的访问。客体通常是用于信息共享、存储和通讯的系统资源(如文件、目录、套接字、共享内存等)。 +\item 访问(Access) + +访问(Access)是使信息在主体(Subject)和客体(Object)之间流动的一种交互方式。 +\item 访问权限(Access Permissions) + +访问权限决定了谁能够访问系统,能访问系统的何种资源以及如何使用这些资源。适当的访问权限能够阻止未经允许的用户有意或无意地获取数据。访问权限的手段包括用户识别代码、口令、登录控制、资源授权(例如用户配置文件、资源配置文件和控制列表)、授权核查、日志和审计等等。 +\end{myitemize} + +凝思安全操作系统是一种多用户系统,它支持任意数目的用户同时操作。用户在自己的工作站上启动会话之前必须先登录到系统中。每个用户都有一个用户名及对应的口令。设置用户名和口令可以确保未经授权的用户无法查看他们无权查看的文件。进行这种限制后,普通用户不可能对系统进行改动(如安装新程序),只有被授权的用户(如管理员)才能对系统进行更改或访问文件,而设置了强制访问控制后,即使是管理员也不可能访问所有的文件。下面章节只描述一般情况(未设置强制访问控制),关于凝思安全操作系统的强制访问控制等安全策略,详见~\ref{s3}。 + +\subsection{文件系统权限} +一般而言,Linux~文件系统中的每个文件都属于某个用户和某个组。可以为这些专有组和其它所有组授予读、写或执行这些文件的权限。 + +在这种情况下,可以将组定义为具有特定集合权限的一组相互连接的用户。例如,可以将共同处理某个项目的组称为~\verb=project1=。Linux~系统中的每个用户都是至少一个专有组(通常是~\verb=users=)的成员。可以根据需要设置系统中组的数目,但只有管理员才能添加组。每个用户都可以使用~\verb=groups=~命令查出自己所属的组。 + +\begin{myitemize} +\item 文件访问 + +文件系统中的权限组织结构不同于文件和目录的组织结构。使用~\verb=ls -l=~命令可以显示文件权限信息。命令输出可能如下所示: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=-rw-r----- 1 testuser1 project1 14197 Jun 21 15:03 testfile= +\end{shaded} +\end{minipage} + +如第三列中所示,此文件属于用户~\verb=testuser1=。该文件被指派给组~\verb=project1=。要确定~\verb=testfile=~文件的用户权限,必须仔细检查第一列。 + +\renewcommand{\arraystretch}{1.5} +\begin{center} +\begin{tabular}{llll} + \hline +\verb=-= & \verb=rw-= & \verb=r--= & \verb=---= \\ +类型 & 用户权限 & 组权限 & 其他用户的权限 \\ \hline +\end{tabular} +\end{center} +\renewcommand{\arraystretch}{1} + +此列含有一个前置字符,后接九个字符,每三个字符为一组。这十个字符中的第一个字符代表文件系统组件的类型。连字符(\verb=-=)表示这是一个文件,\verb=d=~表示目录、~\verb=l=~表示链接、~\verb=b=~表示块设备,~\verb=c=~表示字符设备。 + +后面的三组字符遵循标准模式。第一个字符表示该文件可读(\verb=r=)还是不可读(\verb=-=),第二个字符表示该文件可写(\verb=w=)还是不可写(\verb=-=),第三个字符表示该文件可执行(\verb=x=)还是不可执行(\verb=-=)。 + +在本例中,作为文件~\verb=testfile=~的拥有者,\verb=testuser1=~有权读(\verb=r=)写(\verb=w=)该文件,但无法执行它(\verb=x=)。\verb=project1=~组中的成员可以读取该文件,但不能修改或执行它。其他用户无权访问此文件。通过~ACL(Access Control List,访问控制列表)可以指派其它权限。 +\item 目录权限 + +目录的访问权限类型用~\verb=d=~来表示。对目录而言,各种权限的含义稍有不同。 + +\begin{minipage}{14cm} +\begin{shaded} +\verb=drwxrwxr-x 1 testuser1 project1 35 Jun 21 15:15 ProjectData= +\end{shaded} +\end{minipage} + +在上例“显示目录权限的示例输出”中,很容易识别出目录~\verb=ProjectData=~的拥有者(\verb=testuser1=)和所属组(\verb=project1=)。与之前的文件访问权限相比,设置读权限(\verb=r=)表示可以显示该目录的内容。写权限(\verb=w=)表示可以在该目录下创建新文件或删除文件。执行权限(\verb=x=)表示用户可以进入该目录。上例中的输出表示用户~\verb=testuser1=~及组~\verb=project1=~中的成员可以转到~\verb=ProjectData=~目录(\verb=x=)、查看其中的内容(\verb=r=)并添加或删除文件(\verb=w=)。其他用户的权限则受到限制。他们可以进入目录(\verb=x=)并浏览其中的内容(\verb=r=),但不能创建或删除任何文件(\verb=w=)。 +\end{myitemize} + +\subsection{修改文件权限} +\begin{myitemize} +\item 更改访问权限 + +文件或目录的访问权限可以由拥有者更改,当然也可以由管理员更改;更改时要使用命令~\verb=chmod=,后接更改权限的参数及一个或多个文件名。参数可归为四类: +\begin{myenumerate} +\item 用户相关参数 +\begin{myitemize} +\item \verb=u=(user):文件的拥有者。 +\item \verb=g=(group):与文件属主有相同组~ID~的所有用户。 +\item \verb=o=(others):其他用户。 +\end{myitemize} + +\note{14cm}{如果未指定用户参数,访问权限的更改将应用到所有用户。} +\item 用于增加(\verb=+=)、删除(\verb=-=)或设置(\verb+=+)的字符。 +\item 缩写 +\begin{myitemize} +\item \verb=r=:读 +\item \verb=w=:写 +\item \verb=x=:执行 +\end{myitemize} +\item 一个文件名或由空格分隔的多个文件名 + +例如,在“显示目录权限的示例输出”中,如果用户~\verb=testuser1=~还想授予其他用户写入(\verb=w=)目录~\verb=ProjectData=~的权限,则可以使用命令~\verb=chmod o+w ProjectData=~执行该操作。 + +不过,如果该用户不希望任何用户具有写权限(其本人除外),则可以输入命令~\verb=chmod go-w ProjectData=~执行该操作。要防止所有用户向~\verb=ProjectData=~添加新文件,请输入~\verb=chmod -w ProjectData=。此时,如果不重新设置写权限,即使是拥有者也无法再写入该文件。 +\end{myenumerate} +\item 更改所有权 + +另有一些重要的命令可用来控制文件系统组件的所有权和权限,这些命令包括~\verb=chown=(更改拥有者)和~\verb=chgrp=(更改组)。使用命令~\verb=chown=~可将文件所有权转让给另一用户。不过,只有~root~才有权执行该操作。 + +假定“显示目录权限的示例输出”中的文件~\verb=testfile=~不应再属于~\verb=testuser1=,而应属于用户~\verb=testuser2=,则~root~应该输入~\verb=chown testuser2 testfile=。 + +\verb=chgrp=~用于更改文件的组所有权。不过,文件的拥有者必须是新组的成员。这样,使用命令~\verb=chgrp project2 ProjectData=,“显示文件权限的示例输出”中的用户~\verb=testuser1=~即可将文件~\verb=ProjectData=~所属的组改换为~\verb=project2=,只要该用户是这个新组的成员。 +\end{myitemize} + +\subsection{setuid~位} +在某些情况下,访问权限可能过于严格。因此,Linux~另有一些设置,允许为执行特定操作临时更改当前用户和组标识。例如,\verb=passwd=~程序通常要求拥有根权限才能访问~\verb=/etc/passwd=。此文件包含一些重要信息,如用户主目录及用户和组~ID。因此,普通用户将无法更改~\verb=passwd=,因此授予所有用户直接访问此文件的权限太过危险。解决该问题的一种可行方案就是~setuid~机制。setuid(设置用户~ID~)是一个特殊的文件特性,当一个程序被设置了该标记以后,运行该程序的进程将拥有该程序所有者同样的权限。以~\verb=passwd=~命令为例: + +\verb=-rwsr-xr-x 1 root shadow 80036 2004-10-02 11:08 /usr/bin/passwd= + +您可以看到为用户权限设置了~\verb=s=~位。通过设置~setuid~位,启动~\verb=passwd=~命令的所有用户都以~root~身份执行该命令。 + +\subsection{setgid~位} +setuid~特性适用于用户,setgid~特性则适用于组。进程在执行设置了~setgid~位的文件时,将拥有其文件所有组同样的权限。例如: + +\verb=drwxrws--- 2 testuser1 archive 48 Nov 19 17:12 backup= + +您可以看到为组权限设置了~\verb=s=~位。目录的拥有者和组~\verb=archive=~的成员可以访问此目录。不是该组成员的用户将被“映射到”相应的组;所有写入文件的有效组~ID~将为~\verb=archive=。例如,以组~ID \verb=archive=~运行的备份程序即便没有根权限也能访问此目录。 + +\subsection{粘滞位} +另外还可以设置粘滞位。 +% 属于可执行程序的粘滞位和属于目录的粘滞位在作用上有所不同。如果属于某个程序,以这种方式标记的文件将被装入~RAM~,而不必在每次使用时从硬盘读取。由于目前硬盘的速度已经足够快,此特性已经很少使用。 + +粘滞位最初的目的是“在~swap~中保存文本”,即以这种方式标记的文件将被装入~RAM~,而不必在每次使用时从硬盘读取,从而提高命令处理的性能。现在~UNIX~系统已经不再使用这个功能,但“粘滞位”这个名称被保留。 +% In the case of files, the sticky-bit may be used by the system to indicate the style of file locking to be performed.如果为文件设置了粘滞位,可以用来表示系统将对此文件执行的锁定方式。 + +如果为目录设置了粘滞位,则该目录下的文件只能由~root、该目录的所有者或该文件的所有者删除。典型示例如~\verb=/tmp=~目录: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=drwxrwxrwt 2 sys sys 4096 Oct 21 17:15 tmp= +\end{shaded} +\end{minipage} + +\subsection{自主访问控制} +访问控制涉及的领域很广,方法也很多,通常访问控制策略可以划分为自主访问控制和强制访问控制。 + +\begin{myitemize} +\item 自主访问控制(Discretionary Access Control) +\item 强制访问控制(Mandatory Access Control)(详见~\ref{s3}) +\end{myitemize} + +自主访问控制(DAC)是在确认主体身份及所属组的基础上,根据访问者的身份和授权来决定访问模式,对访问进行限定的一种控制策略。所谓自主,是指具有被授予某种访问权力的用户能够自己决定是否将访问控制权限的一部分授予其他用户或从其他用户那里收回他所授予的访问权限。使用这种控制方法,用户或应用可任意在系统中规定谁可以访问它们的资源,这样,用户或用户进程就可有选择地与其他用户共享资源。它是一种对单独用户执行访问控制的过程和措施。 + +Linux~系统文件对象(如文件或目录)的传统权限概念通过~ACL(访问控制列表)得到了进一步扩展。通过访问控制列表可以将权限指派给文件系统对象的各个用户或组,而不再局限于最初的拥有者或所属组。 + +在凝思安全操作系统~V6.0~中,任何用户都可以使用自主访问控制。 + +% \subsubsection{普通用户} +\begin{myitemize} + \item 文件创建时具有缺省自主访问控制属性 + +创建客体时,新建客体的文件所有关系应为创建者,且文件访问权限为默认方式。 + +在新建文件的时候,通常使用666作为默认许可位;在新建程序的时候,通常使用777作为默认许可位。实际的文件访问权限由~umask~按位取反再和默认许可按位取与而得到。例如,默认许可位666,umask 077,则实际的文件访问权限应该是600,即文件所有者有读写权限,其他无权限。用户可以执行~umask~命令查看和更改当前的~uamsk,~\verb=/etc/login.defs=~里的~umask~定义了一个系统范围内的默认设置。 + +如:以~testuser1~用户身份登录,umask~为022,运行~\verb=touch test.txt=~新建文件~\verb=test.txt=。用~\verb=ls –l test.txt=~查看~\verb=test.txt=~文件的属性,\verb=test.txt=~的所有关系应为:\verb=testuser1.users=,文件属性应为: +\verb=rw-r—r--= +\item 自主访问控制的访问权限设定 + +用户能根据属主/属组/其他关系设置客体的读/写/执行权限。 + +属主(user):文件拥有者。 + +属组(group):文件拥有者的用户组。 + +其他(other):除了属主及其同组成员的其他用户。 + +如:以~\verb=testuser1=~用户身份登录,创建文件~\verb=test.tmp=,将文件的属性设置为~600。用户~\verb=testuser1=~能够读写但不能执行文件~\verb=test.tmp=,其它用户不能访问该文件。 +\item 属主可访问其拥有的客体 + +用户能够访问属于自己的文件。 + +如:以~testuser1~用户身份登录,创建文件~\verb=test.txt=,用户~testuser1~将能够读写~\verb=test.txt=文件。 +\item 属主可更改其拥有的客体的组所有权 + +普通用户不能将其拥有的客体所有权转让给其他用户,但可以将其组所有权转让给具有指定组名的组。命令使用如下: + +\verb=chgrp [option(s)] groupname file(s)= + +\verb=-R= \quad 更改所有子目录中的文件和目录。 +% \item 客体受到自主访问控制保护 +% +% 其他用户不能访问未授权的客体。 +% +% 如:\verb=test.txt=~文件属于用户~testuser1,文件属性为~600(除属主外的其它用户不能访问),则用户~testuser2~将不能阅读和修改~\verb=test.txt=~文件。 +% +% 用户能够访问授权的客体。 +% +% 如:\verb=test.txt=~文件属于用户~testuser1,文件属性为~660(同组用户可读写,其它用户不能访问),将用户~testuser2~加入~testuser1~用户所在的组,则用户~testuser2~将能够阅读和修改~\verb=test.txt=~文件。 + \item 属主可改变客体的访问权限 + +客体属主可以使用~\verb=chmod=~命令改变客体的访问权限。 + +如:以~testuser1~用户身份登录,建立文件~\verb=test.txt=~并将其属性改为~660(同组用户可读写,其它用户不能访问)。用~\verb=ls=~查看~\verb=test.txt=~的属性,应为~660,以~testuser1~不同组的用户身份~testuser2~登录,将不能访问~\verb=test.txt=~文件。 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +$ touch test.txt +$ ls -l test.txt +-rw-r--r-- 1 testuser1 users 0 Sep 4 06:27 test.txt + +$ chmod 660 test.txt +$ ls -l test.txt +-rw-rw---- 1 testuser1 users 0 Sep 4 06:27 test.txt + +login: testuser2 +passwd: + +$ cat test.txt +cat: test.txt: Permission denied +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +% \subsubsection{特权用户} +% 具有特定权能的用户能够超越~DAC~限制。关于特权,详见~\ref{s4}。 +% +% \begin{myitemize} +% \item 改变客体访问权限 +% +% 普通用户被赋予~\verb=FOWNER=~能力之后,即为特权用户,将能够改变任何客体的访问权限。 +% +% 如:赋予~testuser2~用户~\verb=FOWNER=~能力,以~testuser2~用户身份登录,可以将属主为~testuser1~的文件~\verb=test.txt=~的属性改为~666。用~\verb=ls -l=~查看~\verb=test.txt=~的属性,应为~666,任何用户都可以读写该文件。 +% \item 改变客体属主 +% +% 普通用户被赋予~\verb=CHOWN=~和~\verb=FOWNER=~能力之后,将能够改变客体的属主。 +% +% 如:赋予~testuser2~用户~\verb=CHOWN=~和~\verb=FOWNER=~能力,以~testuser2~用户身份登录,可以将属主为~testuser1~的文件~\verb=test.txt=~的属主改为~\verb=testuser2.users=。用~\verb=ls -l=~查看~\verb=test.txt=~的属性,文件所有关系应变为~\verb=testuser2.users=。 +% \item 读写其没有访问权限的文件 +% +% 有~DAC~超越能力的用户能够读写其没有访问权限的文件。 +% +% 如:将~\verb=DAC_OVERRIDE=~和~\verb=DAC_READ_SEARCH=~权能赋予用户~testuser1,以~testuser1~身份登录,将能够读写~testuser1没有访问权限的文件~\verb=/tmp/testfile_by_sysamdin=。 +% \end{myitemize} + +\subsubsection{访问控制列表} +传统类~UNIX~系统以文件属主、组和其它方式设置读、写和执行权限,这会造成文件访问权限的不必要扩散。例如,如果想让某个非同组的用户能够访问一个文件,就只能让所有人都能访问这个文件,这是非常不安全的,也是非常不必要的。 + +访问控制列表(Access Control List, ACL)提供细粒度的访问控制,能够以特定用户或特定组为单位的访问权限分配,从而防止文件访问权限的不必要扩散。利用访问控制列表机制,我们只要把文件共享给特定用户就可以了,而无须让所有人都能够访问该文件。 + +使用一个简单的~\verb=ls -l=~命令即可检测到拥有扩展访问权限的文件或目录: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=-rw-r--r--+ 1 testuser1 project1 14197 Oct 21 15:03 testfile= +\end{shaded} +\end{minipage} + +与不带~ACL~的文件的~\verb=ls=~输出相比,上述~\verb=ls=~的输出并没有显著的不同。\verb=testfile=~由属于组~\verb=project1=~的~\verb=testuser1=~拥有。\verb=testuser1=~对此文件具有读写权限,而其所属的组及其他所有用户均具有读权限。带~ACL~和不带~ACL~的文件之间唯一显示的区别即在于:前者的第一列内多了一个用来包含权限位的~\verb=+=。 + +使用命令~\verb=getfacl=~可以显示文件名、属主、所属组和访问控制列表(ACL),如果一个目录拥有默认的~ACL,\verb=getfacl=~也将显示默认的~ACL,非目录文件不能拥有默认的~ACL。 + +通过执行~\verb=getfacl testfile=~来获取~ACL~的详细信息: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +1 # file: testfile +2 # owner: testuser1 +3 # group: project1 +4 user::rw- +5 user:testuser2:rw- effective: r-- +6 group::r-- +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +7 group:project2:rw- effective: r-- +8 mask::r-- +9 other::--- +\end{verbatim} +\end{shaded} +\end{minipage} + +输出中的前三行不包含~\verb=ls -l=~中没有的信息。这些行只用来表明文件名、拥有者和所属组。第4到9行包含~ACL~条目。传统访问权限只是使用~ACL~可以授予的权限的一部分。本例中的~ACL~为该文件的拥有者以及用户~\verb=testuser2=~授予了读写权限(第4到5行)。通过为其他用户授权,传统概念得到了扩展。这种权限的扩展也同样适用于组权限的处理。所属组拥有读权限(第6行),且~\verb=project2=~组拥有读写权限。第8行中的~\verb=mask=~条目将用户~\verb=testuser2=~和组~\verb=project2=~的有效权限限制为只能读取。其他用户和组对该文件不具备任何类型的权限(第9行)。 + +使用命令~\verb=setfacl=~可以设置文件的访问控制列表。如: + +\begin{myitemize} + \item 以普通用户~testuser~身份登录系统,在~\verb=/tmp=~目录下创建文件~\verb=aaa=,并将其~DAC~属性设置为600,即除自己以外不允许任何用户进行读写: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +$ touch /tmp/aaa +$ chmod 600 /tmp/aaa +\end{verbatim} +\end{shaded} +\end{minipage} +\begin{myitemize} + \item 以普通用户~testuser1~身份登录系统,对~\verb=/tmp/aaa=~文件无法进行读或写操作。 + \item 以普通用户~testuser2~身份登录系统,对~\verb=/tmp/aaa=~文件无法进行读或写操作。 +\end{myitemize} + \item 以普通用户~testuser~身份将~\verb=/tmp/aaa=~文件的~ACL~属性设置为~testuser1~用户可以进行读写: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ setfacl -m u:testuser1:rw /tmp/aaa= +\end{shaded} +\end{minipage} +\begin{myitemize} + \item 以普通用户~testuser1~身份可以对~\verb=/tmp/aaa=~文件进行读或写操作。 + \item 以普通用户~testuser2~身份对~\verb=/tmp/aaa=~文件仍然无法进行读或写操作。 +\end{myitemize} +\end{myitemize} + +\important{15cm}{只有文件的属主和拥有~\texttt{CAP\_FOWNER}~能力的进程拥有修改文件~ACL~设置的权力,只有能够读取访问文件的进程才能读取文件的~ACL~设置,类似于传统~UNIX~文件访问权限的要求。\texttt{CAP\_FOWNER}~能力由管理员设置。} + +\section{重要的~Linux~命令} +本节深入探讨~Linux~系统中较为重要的命令,伴随各个命令列出了参数,并且适当的时候还给出了典型的示例应用程序。有关各个命令的详细信息,请使用~\verb=man=,并在后面键入命令名称来查看其手册页,例如~\verb=man ls=。 + +在参考手册页中,用~\key{Page Up}~和~\key{Page Down}~可以上下移动,用~\key{Home}~和~\key{End}~可以切换显示文档的开头和结尾。按~\key{Q}~可以结束这种查看模式。使用~\verb=man man=~可以了解有关~\verb=man=~命令本身的更多信息。 + +本节所列命令只是众多命令中的一小部分。有关其它命令的信息或更详细的信息,建议您参考~O'Reilly~出版的《Linux in a Nutshell》。下面的概述中使用不同的字体来表示各个命令元素。 + +命令及其必需选项始终显示为命令选项,需要指定的内容或非必需参数均放在[方括号]中。 + +% 按需调整设置。\verb=ls file(s)=~命令毫无意义(如果根本不存在名为~\verb=file(s)=~的文件)。 +实际使用时通常可以将几个参数组合起来,例如用~\verb=ls -la=~来代替~\verb=ls -l -a=。 + +\subsection{文件命令} +本小节将列出较重要的文件管理命令。它包括从总体文件管理到文件系统~ACL~操纵的所有文件管理命令。 + +\begin{myenumerate} +\item 文件管理 +\begin{myitemize} +\item \verb=ls [option(s)] [file(s)]= + +如果运行~\verb=ls=~时未附加任何参数,程序将以缩写格式列出当前目录中的内容。 + +\verb=-l= \quad 详细列表。 + +\verb=-a= \quad 显示隐藏文件。 +\item \verb=cp [option(s)] source target= + +将~\verb=source=~复制到~\verb=target=。 + +\verb=-i= \quad 在覆盖现有~\verb=target=~之前等待确认(如果需要)。 + +\verb=-r= \quad 递归复制(包含子目录)。 +\item \verb=mv [option(s)] source target= + +将~\verb=source=~复制到~\verb=target=,然后删除原始~\verb=source=。 + +\verb=-b= \quad 在移动~\verb=source=~之前创建该文件的备份副本。 + +\verb=-i= \quad 在覆盖现有~\verb=targetfile=~之前等待确认(如果需要)。 +\item \verb=rm [option(s)] file(s)= + +从文件系统中删除指定文件。除非使用选项~\verb=-r=~,否则不能使用~\verb=rm=~删除目录。 + +\verb=-r= \quad 删除所有现有子目录。 + +\verb=-i= \quad 在删除各个文件之前等待确认。 +\item \verb=ln [option(s)] source target= + +创建从~\verb=source=~到~\verb=target=~的内部链接。通常这种链接直接指向同一文件系统上的~\verb=source=。但是,如果执行带~\verb=-s=~选项的~\verb=ln=~命令,则可以创建一个符号链接,仅指向~\verb=source=~所在的目录,支持跨文件系统的链接。 + +\verb=-s= \quad 创建符号链接。 +\item \verb=cd [option(s)] [directory]= + +更改当前目录。执行不带任何参数的~\verb=cd=~命令将转到用户主目录。 +\item \verb=mkdir [option(s)] directoryname= + +创建新目录。 +\item \verb=rmdir [option(s)] directoryname= + +删除指定的目录(如果该目录已清空)。 +% \item \verb=chown [option(s)] username[:[group]] file(s)= +% +% 将文件所有权转让给具有指定用户名的用户。 +% +% \verb=-R= \quad 更改所有子目录中的文件和目录。 +% \item \verb=chgrp [option(s)] groupname file(s)= +% +% 将特定~\verb=file=~的组所有权转让给具有指定组名的组。如果文件拥有者即是当前组也是新组的成员,该拥有者只能转让组所有权。 +\item \verb=chmod [option(s)] mode file(s)= + +更改访问权限。 + +\verb=mode=~参数由三个部分构成:\verb=group=、\verb=access=~和~\verb=access type=。\verb=group=~接受以下字符: + +\verb=u= \quad 用户 + +\verb=g= \quad 组 + +\verb=o= \quad 其它 + +对于~\verb=access=,用~\verb=+=~可以授予权限,用~\verb=-=~可以拒绝授予权限。 + +\verb=access type=~受以下选项控制: + +\verb=r= \quad 读 + +\verb=w= \quad 写 + +\verb=x= \quad 执行文件或访问目录。 + +\verb=s= \quad 设置~uid~位——当一个程序被设置了该标记以后,运行该程序的进程将拥有该程序所有者同样的权限。 + +您也可以使用数字模式来设置访问权限。数字模式是1到4个八进制数,每个数由位权为4、2、1的3位叠加而来。省略的数字缺省设置为0。第一位用来设置~suid(4)、sgid(2)、粘滞位(1);第二位设置文件所有者的权限:可读(4)、可写(2)、可执行(1);第三位设置文件所有者所在组其他用户的权限,设置同第二位;第四位设置其他组的用户的权限,设置同第二位。 + +% 此代码的四位数字由值4、2和1之和组成——即二进制掩码的十进制结果。第一位设置“设置用户~ID(SUID)(4)”标志、“设置组~ID(2)”和粘滞(1)标志。第二位定义文件拥有者的权限。第三位定义组成员的权限,最后一位设置其他所有用户的权限。用4设置读权限,2设置写权限,1设置执行文件的权限。文件的拥有者通常都会收到6或7,表示可执行文件。 +\item \verb=gzip [parameter(s)] file(s)= + +此程序使用复杂的数学算法压缩文件内容。以这种方式压缩的文件的扩展名为~\verb=.gz=,而且使用前需解压缩。要压缩若干文件甚至是整个目录,请使用~\verb=tar=~命令。 + +\verb=-d= \quad 将打包的~\textbf{gzip}~文件解压缩,使其恢复原始大小,并且能够正常处理(类似命令~\verb=gunzip=)。 +\item \verb=tar option(s) archive file(s)= + +\verb=tar=~将一个或多个文件放入档案。压缩是可选操作。\verb=tar=~是相当复杂的命令,可以附带若干选项,最常用的选项如下: + +\verb=-f= \quad 将输出结果写入文件,而不是显示在屏幕上。 + +\verb=-c= \quad 创建新的~tar~档案。 + +\verb=-r= \quad 将文件添加到现有档案中。 + +\verb=-t= \quad 输出档案内容。 + +\verb=-u= \quad 添加文件,但仅适用于文件比档案中已有的文件更新的情况。 + +\verb=-x= \quad 将档案中的文件解包(抽取)。 + +\verb=-z= \quad 用~\verb=gzip=~将生成的档案打包。 + +\verb=-j= \quad 用~\verb=bzip2=~压缩生成的档案。 + +\verb=-v= \quad 列出已处理的文件。 + +由~\verb=tar=~创建的档案文件以~\verb=.tar=~结尾。如果这个~tar~档案还使用~\verb=gzip=~进行了压缩,则以~\verb=.tgz=~或~\verb=.tar.gz=~结尾。如果是使用~\verb=bzip2=~压缩的,则以~\verb=.tar.bz2=~结尾。 +\item \verb=locate pattern(s)= + +使用~\verb=locate=~命令可以查找指定文件所处的目录。如果需要,可使用通配符来指定文件名。该程序的速度非常快,因为它使用专为此目的创建的数据库(而不是搜索整个文件系统)。但恰恰是这一点也带来了一个重大缺陷:无法找到在最后更新文件数据库后创建的任何文件。以管理员身份使用~\verb=updatedb=~可以生成该数据库。 +\item \verb=updatedb [option(s)]= + +此命令可以对~\verb=locate=~使用的数据库进行更新。要包含所有现有目录中的文件,请以管理员身份运行程序。最好通过追加与号(\verb=&=)。此命令通常作为~daily cron~作业运行。 +\item \verb=find [option(s)]= + +使用~\verb=find=~可以在指定目录中搜索文件。第一个参数指定搜索的起始目录。选项~\verb=-name=~后面必须紧跟搜索字符串,字符串中也可以包含通配符。与使用数据库的~\verb=locate=~不同,\verb=find=~扫描的是实际目录。 +\end{myitemize} +\item 用于访问文件内容的命令 +\begin{myitemize} +\item \verb=cat [option(s)] file(s)= + +\verb=cat=~命令用于显示文件的内容,使用它可以将所有内容连续打印输出到屏幕上。 + +\verb=-n= \quad 在左侧输出编号。 +\item \verb=less [option(s)] file(s)= + +此命令可用于浏览指定文件的内容。使用~\key{Page Up}~和~\key{Page Down}~可以向上或向下滚动半屏,使用~\key{Space}~可以向下滚动一整屏。使用~\key{Home}~和~\key{End}~可以跳转至文件的开头和结尾。按~\key{Q}~可以退出程序。 +\item \verb=grep [option(s)] searchstring filenames= + +\verb=grep=~命令用于在指定~\verb=file(s)=~中查找特定的搜索字符串。如果找到搜索字符串,该命令将显示找到的~\verb=searchstring=~所在的行及文件名。 + +\verb=-i= \quad 忽略大小写。 + +\verb=-H= \quad 为每个匹配打印文件名。 + +\verb=-n= \quad 另外显示含有匹配项的行的编号。 + +\verb=-l= \quad 只列出其中不含~\verb=searchstring=~的文件。 +\item \verb=diff [option(s)] file1 file2= + +\verb=diff=~命令用于比较两个文件的内容。该程序生成的输出将列出所有不匹配的行。这是只需发送程序变更而不是全部源代码的编程人员经常使用的命令。 + +\verb=-q= \quad 只报告两个文件是否不同。 + +\verb=-u= \quad 生成一个“统一”的~diff,从而增加输出的可读性。 +\end{myitemize} +% \item 文件系统 +% \begin{myitemize} +% \item \verb=mount [option(s)] [device] mountpoint= +% +% 使用此命令可以将任意数据介质(如硬盘、CD-ROM~驱动器和其它设备)装入~Linux~文件系统的某个目录。 +% +% \verb=-r= \quad 只读装入。 +% +% \verb=-t filesystem= \quad 指定文件系统,通常包括:\verb=ext2=(表示~Linux~硬盘)、\verb=msdos=(表示~MS-DOS~介质)、\verb=vfat=(表示~Windows~文件系统)、\verb=iso9660=(表示~CD)。 +% +% 对于没有在~\verb=/etc/fstab=~中定义的硬盘,还须同时指定设备类型。在这种情况下只能由系统管理员装入。如果其他用户也应该能够装入文件系统,则应在~\verb=/etc/fstab=~文件的对应行中输入选项~\verb=user=(用逗号分隔多个用户),并保存所做更改。 +% \item \verb=umount [option(s)] mountpoint= +% +% 此命令可用于从文件系统中卸载装入的驱动器。为防止数据丢失,请在将可移除的数据介质从其所在驱动器中移除之前运行此命令。通常只有系统管理员才能运行~\verb=mount=~和~\verb=umount=~命令。要使其他用户也能运行这些命令,需编辑~\verb=/etc/fstab=~文件,以便为相应的驱动器指定选项~\verb=user=。 +% \end{myitemize} +\end{myenumerate} + +\subsection{系统命令} +本节列出了用于检索系统信息以及进程和网络控制的几个较重要的命令。 +\begin{myenumerate} +\item 系统信息 +\begin{myitemize} +\item \verb=df [option(s)] [directory]= + +\verb=df=(可用磁盘)命令如不与任何选项一同使用,则可以显示磁盘空间容量、当前占用磁盘空间以及所有已装入驱动器上的可用空间等相关信息。如果指定了目录,则只显示有关该目录所在的驱动器的信息。 + +\verb=-h= \quad 以用户可读的格式显示占用的块数(以~GB、~MB~或~KB~为单位)。 + +\verb=-T= \quad 文件系统的类型(ext2、nfs,等等)。 +\item \verb=du [option(s)] [path]= + +执行此命令时若不带任何参数,则可以显示当前目录中的文件和子目录所占用的磁盘空间总量。 + +\verb=-a= \quad 显示各个文件的大小。 + +\verb=-h= \quad 以用户可读的格式输出。 + +\verb=-s= \quad 仅显示计算的总大小。 +\item \verb=free [option(s)]= + +\verb=free=~命令用于显示有关占用~RAM~和交换空间的信息,可指明这两个类别中的空间总量和占用量。 + +\verb=-b= \quad 以字节为单位输出。 + +\verb=-k= \quad 以~KB~为单位输出。 + +\verb=-m= \quad 以~MB~为单位输出。 +\item \verb=date [option(s)]= + +这个简单程序可以显示当前系统时间。如果以管理员身份运行,该程序也可用于更改系统时间。 +\end{myitemize} +\item 进程 +\begin{myitemize} +\item \verb=top [option(s)]= + +\verb=top=~提供有关当前运行的进程的快速概览。按~\key{H}~可以进入一个页面,其中简要说明了用于定义该程序的主要选项。 +\item \verb=ps [option(s)] [process ID]= + +如果运行时未指定任何选项,此命令将显示一个表,其中包含您已经启动的所有程序或进程。 + +\verb=aux= \quad 显示所有进程的详细列表,不区分拥有者。 +\item \verb=kill [option(s)] process ID= + +有时程序并不能正常终止。多数情况下,通过在执行~\verb=kill=~命令时指定相应的进程~ID~就应能够停止此类异常程序。\verb=kill=~将发送~TERM~信号,指示程序自行关闭。如果仍无效,可使用以下参数: + +\verb=-9= \quad 发送一个~KILL~信号而不是~TERM~信号,这将在几乎所有情况下终止指定的进程。 +\item \verb=killall [option(s)] processname= + +此命令类似~\verb=kill=,但它使用进程名(而不是进程~ID)作为参数,可以取消具有该名称的所有进程。 +\end{myitemize} +\item 网络 +\begin{myitemize} +\item \verb=ping [option(s)] hostname|IP address= + +\verb=ping=~命令是用于测试~TCP/IP~网络基本功能的标准工具。它可以向目标主机发送一个小的数据包,请求立即回复。如果发送有效,\verb=ping=~将据此显示一条消息,指明网络链接基本有效。 + +\verb=-c= \quad \verb=number=~确定要发送的数据包总数,并且在发送数据包后终止(默认情况下未设置任何限制)。 + +\verb=-f= \quad 溢流~ping:发送尽可能多的数据包;这是为管理员保留的用于测试网络的常用方法。 + +\verb=-i= \quad \verb=value=~指定发送两个数据包之间的时间间隔(默认值:1秒)。 +\item \verb=nslookup= + +域名系统将域名解析为~IP~地址。使用此工具可以将查询发送到信息服务器(DNS~服务器)。 +\item \verb=telnet [option(s)] hostname or IP address [Port]= + +Telnet~实际上是一种~Internet~协议,能支持您跨网络在远程主机上操作。\textbf{Telnet}~同时也是一个~Linux~程序的名称,该程序基于~telnet~协议允许用户登录到远程计算机并进行操作。 + +\warning{14cm}{切勿在第三方可能窃听的网络上使用~\textbf{Telnet}。特别是在因特网上,请使用~\texttt{ssh}~之类的加密传送方法,避免口令被盗用。} +\end{myitemize} +\item 其它 +\begin{myitemize} +\item \verb=passwd [option(s)] [username]= + +用户可以使用此命令随时更改自己的口令。管理员可以使用该命令更改系统中任意用户的口令。 +\item \verb=su [option(s)] [username]= + +使用~\verb=su=~命令可在当前正在运行的会话中以其它用户名登录。指定用户名及相应口令,以便使用该用户的环境。root~用户执行~\verb=su=~命令时无需提供口令,因为~root~用户有权切换到任意用户。在未指定用户名的情况下使用该命令时,系统将提示您输入~root~用户口令并切换到~root~用户。 +% \item \verb=halt [option(s)]= +% +% 为避免丢失数据,您应该始终使用此程序关闭系统。 +% \item \verb=reboot [option(s)]= +% +% 与~\verb=halt=~的操作相同,只不过系统会立即重引导。 +\item \verb=clear= + +此命令用于清空控制台中的可见区域。该命令不带选项。 +\end{myitemize} +\end{myenumerate} + +\chapter{分区与文件系统} +\section{磁盘分区} +凝思安全操作系统同时支持命令行和图形界面的磁盘分区方式。 + +\subsection{命令行分区工具——parted} +parted是一个用于对磁盘分区及其文件系统进行建立、修改、调整、检查、复制等操作的工具,同时支持交互模式和非交互模式。与fdisk比较,它支持给容量大于2TB的磁盘进行分区,功能更加丰富。 + +本节主要介绍分区表的建立,分区的查看、添加、删除等常见操作,将以非交互式命令模式举例说明。更多详细功能和用法请参考parted相关资料。 + +\subsubsection{parted基本用法} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted [options] [device [command [options...]...]] +parted [选项]... [设备 [命令 [参数]...]...] +\end{verbatim} +\end{shaded} +\end{minipage} + +将带有“参数”的命令应用于“设备”。如果没有给出“命令”,则以交互模式运行。 + +\subsubsection{创建分区表} +磁盘分区前,需要在磁盘上建立分区表,如果磁盘上已经创建好了分区表并且不需要改变分区表类型可以跳过该步骤。 + +parted支持的分区表类型有:bsd、dvh、gpt、loop、mac、msdos、pc98、sun。 + +\warning{15cm}{建立分区表,磁盘上原来的数据将被清空,磁盘上有正在使用的分区时将不能进行该操作,如已挂载分区、已激活的交换空间。} + +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted [device] mklabel [label-type] +\end{verbatim} +\end{shaded} +\end{minipage} + +示例:给一块磁盘sda创建一个gpt分区表,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted /dev/sda mklabel gpt +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsubsection{查看磁盘分区情况} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted [device] print free +\end{verbatim} +\end{shaded} +\end{minipage} + +示例:查看磁盘sda分区情况,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted /dev/sda print free +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsubsection{添加分区} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted [device] mkpart [part-type] [start] [end] +\end{verbatim} +\end{shaded} +\end{minipage} + +\hint{15cm}{start、end既可以是容量也可以是百分比。} + +示例:在一块容量为20GB刚建立msdos分区表的磁盘sda上建立一个10GB的主分区,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted /dev/sda mkpart primary 0% 10GB +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted /dev/sda mkpart primary 0% 50% +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsubsection{删除分区} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted [device] rm [partition-number] +\end{verbatim} +\end{shaded} +\end{minipage} + +示例:删除磁盘sda的第一个分区sda1,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +parted /dev/sda rm 1 +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsection{图形分区工具——gparted} +gparted是磁盘分区软件parted的GTK+图形界面前端。本节主要介绍gparted的基本使用。 + +\subsubsection{启动gparted程序} +\begin{myitemize} +\item 方法一:命令行启动gparted + +在桌面上打开一个终端,su到root用户(如果使用root登录的桌面就不需要该操作),执行gparted命令即可启动程序。 + +\item 方法二:从桌面菜单启动gparted + +依次点击桌面上端的“系统-系统管理-GParted”,如图~\ref{gparted01}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted01.png} + \caption{启动GParted}\label{gparted01} +\end{figure} + +然后会看到一个提示输入管理员口令的对话框(如果是root登录桌面不会有该对话框),需要输入正确的管理员口令确定授权后才能真正开启gparted程序。如图~\ref{gparted02}~所示。 + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted02.png} + \caption{输入管理员口令}\label{gparted02} +\end{figure} +\end{myitemize} + +\subsubsection{gparted程序首界面} +gparted程序首界面如图~\ref{gparted03}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted03.png} + \caption{gparted程序首界面}\label{gparted03} +\end{figure} + +\newpage +\subsubsection{创建分区表} +在磁盘sda上新建msdos分区表,如图~\ref{gparted04}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted04.png} + \caption{创建分区表}\label{gparted04} +\end{figure} + +磁盘sda上有活动分区时将不能在上新建分区表,如图~\ref{gparted05}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted05.png} + \caption{有活动分区时无法新建分区表}\label{gparted05} +\end{figure} + +\newpage +切换到空闲磁盘sdb并在上面新建分区表,如图~\ref{gparted06}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted06.png} + \caption{在空闲磁盘上新建分区表}\label{gparted06} +\end{figure} + +默认新建msdos分区表,如果需要建立其他类型分区表可以在高级选项里配置,如图~\ref{gparted07}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted07.png} + \caption{选择分区表类型}\label{gparted07} +\end{figure} + +\newpage +\subsubsection{添加分区} +在刚创建完msdos分区表的磁盘sdb上添加一个2000MB的主分区并格式化为ext3文件系统,然后应用全部操作使其生效,如图~\ref{gparted08}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted08.png} + \caption{新建分区}\label{gparted08} +\end{figure} + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted09.png} + \caption{设置分区参数}\label{gparted09} +\end{figure} + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted10.png} + \caption{应用全部操作}\label{gparted10} +\end{figure} + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted11.png} + \caption{确认应用执行操作}\label{gparted11} +\end{figure} + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted12.png} + \caption{成功完成所有操作}\label{gparted12} +\end{figure} + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted13.png} + \caption{添加分区成功}\label{gparted13} +\end{figure} + +\subsubsection{删除分区} +删除sdb2分区,如图~\ref{gparted14}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted14.png} + \caption{删除分区}\label{gparted14} +\end{figure} + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted15.png} + \caption{确认执行操作}\label{gparted15} +\end{figure} + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted16.png} + \caption{成功完成所有操作}\label{gparted16} +\end{figure} + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/gparted17.png} + \caption{删除分区成功}\label{gparted17} +\end{figure} + +\section{文件系统} +文件系统是操作系统用于明确磁盘或分区上的文件的方法和数据结构,即在磁盘上组织文件的方法。人们熟知,磁盘分区在存储数据之前需要对其进行格式化,其实这就是文件系统建立的过程。 + +凝思安全操作系统支持常见的文件系统,如ext系列、vfat、bfs、xfs等,支持常见文件系统的命令行操作。 + +本节主要介绍如何在分区上创建文件系统和修复文件系统,更多详细的文件系统相关操作,请参考文件系统相关资料。 + +\subsection{创建文件系统} +\warning{15cm}{在磁盘分区上建立文件系统,磁盘分区上原来的数据将被清空,该操作需要在分区未挂载的情况下才能进行。} + +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mkfs.[fs-type] [partition] +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mkfs -t [fs-type] [partition] +\end{verbatim} +\end{shaded} +\end{minipage} + +示例:在磁盘分区sda1上建立ext3文件系统,可以执行以下命令 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mkfs.ext3 /dev/sda1 +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mkfs -t ext3 /dev/sda1 +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsection{修复文件系统} +文件系统损坏时可以用命令fsck进行修复。 + +\warning{15cm}{文件系统修复操作需要在分区未挂载的情况下进行,否则容易出现不可预料的情况。} + +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +fsck.[fs-type] [partition] +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +fsck -t [fs-type] [partition] +\end{verbatim} +\end{shaded} +\end{minipage} + +示例:修复磁盘分区sda1上的ext3文件系统,可以执行以下命令 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +fsck.ext3 /dev/sda1 +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +fsck -t ext3 /dev/sda1 +\end{verbatim} +\end{shaded} +\end{minipage} + +\section{磁盘阵列RAID} +独立磁盘冗余阵列(Redundant Arrays of Inexpensive Disks, RAID),旧称廉价磁盘冗余阵列,简称硬盘阵列。其基本思想就是把多个相对便宜的硬盘组合起来,成为一个硬盘阵列组,使性能达到甚至超过一个价格昂贵、容量巨大的硬盘。根据选择的版本不同,RAID比单颗硬盘有以下一个或多个方面的好处:增强数据集成度,增强容错功能,增加处理量或容量。另外,磁盘阵列对于计算机来说,看起来就像一个单独的硬盘或逻辑存储单元。分为RAID-0,RAID-1,RAID-1E,RAID-5,RAID-6,RAID-7,RAID-10,RAID-50,RAID-60。 + +简单来说,RAID把多个硬盘组合成为一个逻辑扇区,因此,操作系统只会把它当作一个硬盘。RAID常被用在服务器计算机上,并且常使用完全相同的硬盘作为组合。 + +RAID可分为硬RAID和软RAID。硬RAID需要依赖特定硬件实现,如磁盘阵列柜、磁盘阵列卡。软RAID是通过仿真软件来实现的,如mdadm。 + +本节主要简单介绍在凝思安全操作系统上如何利用mdadm命令来创建和关闭RAID。 + +\subsection{创建RAID} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mdadm –detail /dev/mdX +mdadm --create --auto=yes /dev/md[0-9] --raid-devices=N \ +--level=[RAID-LEVEL] --spare-devices=N /dev/sdx /dev/hdx... +\end{verbatim} +\end{shaded} +\end{minipage} + +选项与参数: +\begin{myitemize} + \item --create:创建RAID的选项 + \item --auto=yes:决定创建后面接的软件磁盘阵列装置,即/dev/md0、/dev/md1... + \item --raid-devices=N:使用几个磁盘(或分区)作为磁盘阵列的装置 + \item --spare-devices=N:使用几个磁盘(或分区)作为备用(spare)装置 + \item --level=[RAID-LEVEL]:配置这组磁盘阵列的等级,常用的有0、1、5等 + \item --detail:查看磁盘阵列装置的详细情况 +\end{myitemize} + +示例:利用sdb\{1,2,3,4,5\}五个分区来做RAID5(实际做RAID时建议使用整个磁盘而不是分区),可以执行以下命令 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mdadm --create --auto=yes /dev/md0 --level=5 \ +--raid-devices=4 --spare-devices=1 /dev/sdb{1,2,3,4,5} +\end{verbatim} +\end{shaded} +\end{minipage} + +创建成功查看详细情况,可以使用命令 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mdadm --detail /dev/md0 +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +cat /proc/mdstat +\end{verbatim} +\end{shaded} +\end{minipage} + +然后就可以把~\verb=/dev/md0=~当作普通的磁盘来使用了。 + +\subsection{关闭RAID} +命令格式: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mdadm --stop /dev/mdX +\end{verbatim} +\end{shaded} +\end{minipage} + +\hint{15cm}{如果RAID已经格式化并挂载使用,需要先将其卸载。} + +示例:关闭上面创建的/dev/md0,可以执行以下命令 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +mdadm --stop /dev/md0 +\end{verbatim} +\end{shaded} +\end{minipage} + +\section{逻辑卷管理LVM} +LVM全名Logical Volume Manager,翻译作逻辑卷轴管理员,利用Linux内核的device-mapper来实现存储系统的虚拟化(系统分区独立于底层硬件)。 通过LVM,可以实现存储空间的抽象化并在上面建立虚拟分区(virtual partitions),可以更简便地扩大和缩小分区,可以增删分区时无需担心某个硬盘上没有足够的连续空间。 + +LVM基本组成如下: + +\begin{myitemize} + \item 物理卷Physical volume (PV):可以在上面建立卷组的媒介,可以是硬盘分区,也可以是硬盘本身或者回环文件(loopback file)。物理卷包括一个特殊的header,其余部分被切割为一块块物理区域(physical extents)。 + \item 卷组Volume group (VG):将一组物理卷收集为一个管理单元。 + \item 逻辑卷Logical volume (LV):虚拟分区,由物理区域(physical extents)组成。 + \item 物理区域Physical extent (PE):硬盘可供指派给逻辑卷的最小单位(通常为4MB)。 +\end{myitemize} + +本节主要简单介绍在凝思安全操作系统上如何进行逻辑卷的创建、扩容和删除操作。 + +\subsection{基本命令介绍} +PV相关: +\begin{myitemize} + \item pvcreate :将实体partition 创建成为PV ; + \item pvscan:搜寻目前系统里面任何具有PV的磁盘; + \item pvdisplay:显示出目前系统上面的PV状态; + \item pvremove:将PV属性移除,让该partition不具有PV属性; +\end{myitemize} + +\vspace{.5cm} +VG相关: +\begin{myitemize} + \item vgcreate :创建VG; + \item vgscan :搜寻系统上面是否有VG存在。 + \item vgdisplay :显示目前系统上面的VG状态; + \item vgextend :在VG内添加额外的PV; + \item vgreduce :在VG内移除PV; + \item vgchange :配置VG是否启动(active); + \item vgremove :删除一个VG; +\end{myitemize} + +\vspace{.5cm} +LV相关: +\begin{myitemize} + \item lvcreate:创建LV; + \item lvscan :查询系统上面的LV; + \item lvdisplay :显示系统上面的LV状态; + \item lvextend :在LV里面添加容量; + \item lvreduce :在LV里面减少容量; + \item lvremove :删除一个 LV; + \item lvresize :对LV进行容量大小的调整; +\end{myitemize} + +\subsection{逻辑卷创建} +基本步骤: +\begin{myenumerate} + \item 创建物理卷(PV) + \item 创建卷组(VG) + \item 创建逻辑卷(LV) +\end{myenumerate} + +\hint{15cm}{卷组(VG)必须在至少一个物理卷(PV)上创建。} + +示例:假设创建一个名为vg00包含/dev/sdb{1,2,3,4}的PE为4M的VG并在上面建立一个2G的逻辑卷LV,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +pvcreate /dev/sdb{1,2,3,4} +vgcreate -s 4M vg00 /dev/sdb{1,2,3,4} +lvcreate -L 2G vg00 -n lv00 +\end{verbatim} +\end{shaded} +\end{minipage} + +逻辑卷创建完后便可以格式化挂载使用了。 + +\subsection{逻辑卷扩容} +示例:假设要给上面已经创建并正挂载使用的逻辑卷lv00扩容1G使其容量变为3G,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +lvresize -L +1G /dev/vg00/lv00 +\end{verbatim} +\end{shaded} +\end{minipage} + +如果vg00(VG)空闲空间不够了,得先扩充vg00,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +pvcreate /dev/sdb5 +vgextended vg00 /dev/sdb5 +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsection{删除逻辑卷} +示例:假设要删除上面建立的逻辑卷lv00,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +lvremove /dev/vg00/lv00 +\end{verbatim} +\end{shaded} +\end{minipage} + +如果正在使用需要先卸载,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +umount /dev/vg00/lv00 +\end{verbatim} +\end{shaded} +\end{minipage} + +如果彻底清除上面逻辑卷相关,可以执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +vgremove vg00 +pvremove sdb{1,2,3,4,5} +\end{verbatim} +\end{shaded} +\end{minipage} + +\chapter{中文支持} +\section{多语言环境支持} +凝思安全操作系统~V6.0~支持良好的多语言环境,程序运行时可以方便的无缝切换其输出的语言,以方便不同情况的需要。系统默认支持中文、英文两种语言环境,他们的切换可以通过环境变量LANG来指定。 + +示例:默认条件下系统的命令以中文方式返回响应结果: + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/echo1.png} + \caption{中文响应信息}\label{echo1} +\end{figure} + +如果需要查看英文的提示信息可以使用如下命令: + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/echo2.png} + \caption{英文响应信息}\label{echo2} +\end{figure} + +\section{字符编码与中文字体} +凝思安全操作系统~V6.0~提供国标2级字库及通用的中文字体,提供对简体中文的显示、输入和打印。 + +凝思安全操作系统支持的字符编码有: + +\begin{myitemize} + \item C + \item POSIX + \item zh\_CN + \item zh\_CN.gb18030 + \item zh\_CN.gb2312 + \item zh\_CN.gbk + \item zh\_CN.utf8 +\end{myitemize} + +可以通过使用命令~\verb=locale -a /usr/share/i18n/SUPPORTED=~查看。 + +凝思安全操作系统支持的中文字体有: +\begin{myitemize} + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-c-0-gb18030.2000-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-c-0-gb2312.1980-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-c-0-gbk-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-m-0-gb18030.2000-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-m-0-gb2312.1980-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-m-0-gbk-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-p-0-gb18030.2000-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-p-0-gb2312.1980-0 + \item -arphic-ar pl ukai cn-book-r-normal--0-0-0-0-p-0-gbk-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-c-0-gb18030.2000-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-c-0-gb2312.1980-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-c-0-gbk-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-m-0-gb18030.2000-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-m-0-gb2312.1980-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-m-0-gbk-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-p-0-gb18030.2000-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-p-0-gb2312.1980-0 + \item -arphic-ar pl uming cn-light-r-normal--0-0-0-0-p-0-gbk-0 + \item -cc-song-medium-r-normal-jiantizi-0-0-75-75-c-0-gb2312.1980-0 + \item -cc-song-medium-r-normal-jiantizi-40-400-75-75-c-400-gb2312.1980-0 + \item -cc-song-medium-r-normal-jiantizi-48-480-75-75-c-480-gb2312.1980-0 + \item -guobiao-song-medium-r-normal--0-0-72-72-c-0-gb2312.80\&gb8565.88-0 + \item -guobiao-song-medium-r-normal--16-160-72-72-c-160-gb2312.80\&gb8565.88-0 + \item -guobiao-song-medium-r-normal--16-160-72-72-c-160-gb2312.80-0 + \item -guobiao-song-medium-r-normal--16-160-72-72-c-160-gb8565.88-0 + \item -isas-fangsong ti-medium-r-normal--0-0-72-72-c-0-gb2312.1980-0 + \item -isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0 + \item -isas-song ti-medium-r-normal--0-0-72-72-c-0-gb2312.1980-0 + \item -isas-song ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0 + \item -isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-100-100-p-0-gb18030.2000-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-100-100-p-0-gb2312.1980-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-100-100-p-0-gbk-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-75-75-p-0-gb18030.2000-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-75-75-p-0-gb2312.1980-0 + \item -wenquanyi-wenquanyi bitmap song-bold-r-normal--0-0-75-75-p-0-gbk-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-100-100-p-0-gb18030.2000-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-100-100-p-0-gb2312.1980-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-100-100-p-0-gbk-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-75-75-p-0-gb18030.2000-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-75-75-p-0-gb2312.1980-0 + \item -wenquanyi-wenquanyi bitmap song-medium-r-normal--0-0-75-75-p-0-gbk-0 + \item hanzigb16fs + \item hanzigb16st + \item hanzigb24st +\end{myitemize} + +可以通过使用命令~\verb=xlsfonts |grep gb=查看。 + +\newpage +\section{输入法} +凝思安全操作系统提供用户体验良好的通用输入法平台SCIM,同时支持智能拼音中文输入法和五笔输入法。 + +默认情况下英文输入,如果需要输入中文可以按组合键Ctrl+Space切换到中文输入。 + +默认情况下中文输入使用的是智能拼音输入方法,如果需要切换到五笔输入法,可以点击输入法平台上的“智能拼音”,查看并选择五笔输入法。如图~\ref{scim}~所示。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/scim.png} + \caption{输入法}\label{scim} +\end{figure} + +\chapter{系统管理} +\section{关闭或重新启动系统} +\subsection{关闭系统} +您可以在桌面环境下从主菜单中选择[关机],或者在终端中使用下列命令关闭凝思安全操作系统: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +$ shutdown -h now +\end{verbatim} +\end{shaded} +\end{minipage} + +在系统使用过程中非正常关闭凝思安全操作系统可能造成系统损坏或数据丢失,因此,应该尽量避免这种情况的发生。 + +\subsection{重启系统} +您可以在桌面环境下从主菜单中选择[重启],或者在终端中使用下列命令重新启动凝思安全操作系统: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +$ shutdown -r now +\end{verbatim} +\end{shaded} +\end{minipage} + +\section{初始化设置} +\subsection{设备驱动模块配置} +\begin{myitemize} +\item 路径 + +\verb=/etc/modules= +\item 作用 + +设置系统启动时的加载设备模块 +\item 参数设置 + +\verb=alias 设备号 模块= +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +alias eth0 e100 +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{profile~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/profile=(对系统所有用户登录有效) + +\verb=~/.profile=(对相应用户登录有效) +\item 作用 + +设置系统所有用户或者单用户登录时运行的环境变量 +\item 例样 + +\noindent\begin{minipage}{15.2cm} +\begin{shaded} +\begin{verbatim} +if [ "`id -u`" -eq 0 ]; then + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +else + PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" +fi +export PATH + +if [ "$PS1" ]; then + if [ "$BASH" ]; then + # The file bash.bashrc already sets the default PS1. + # PS1='\h:\w\$ ' + if [ -f /etc/bash.bashrc ]; then + . /etc/bash.bashrc + fi + else + if [ "`id -u`" -eq 0 ]; then + PS1='# ' + else + PS1='$ ' + fi + fi +fi +\end{verbatim} +\end{shaded} +\end{minipage} + +\noindent\begin{minipage}{15.2cm} +\begin{shaded} +\begin{verbatim} +if [ -d /etc/profile.d ]; then + for i in /etc/profile.d/*.sh; do + if [ -r $i ]; then + . $i + fi + done + unset i +fi +\end{verbatim} +\end{shaded} +\end{minipage} + + +% \verb+if [ "+\textasciigrave\verb+id -u+\textasciigrave\verb+" = "0" ]; then+ +% +% \verb+ export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin"+ +% +% \verb+elif [ "+\textasciigrave\verb+id -un+\textasciigrave\verb+" = "sysadmin" ]; then+ +% +% \verb+ export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin"+ +% +% \verb+elif [ "+\textasciigrave\verb+id -un+\textasciigrave\verb+" = "netadmin" ]; then+ +% +% \verb+ export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin"+ +% +% \verb+elif [ "+\textasciigrave\verb+id -un+\textasciigrave\verb+" = "secadmin" ]; then+ +% +% \begin{verbatim} +% export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin" +% else +% export PATH="/bin:/usr/bin:/usr/X11R6/bin:/opt/bin" +% fi +% if [ ! -f ~/.inputrc ]; then +% export INPUTRC="/etc/inputrc" +% fi +% export MANPATH="/usr/man:/usr/share/man:/usr/X11R6/man" +% export LESSCHARSET="latin1" +% if test "$UID" = 0; then +% PS1="\h:\w # " +% else +% PS1="\u@\h:\w > " +% fi +% export PS1 +% \end{verbatim} +% \end{shaded} +% \end{minipage} + +\noindent\begin{minipage}{15.2cm} +\begin{shaded} +\verb+alias ls=+\textquotesingle\verb+ls --color=auto+\textquotesingle + +\verb+alias l=+\textquotesingle\verb+ls -l+\textquotesingle + +\verb+alias la=+\textquotesingle\verb+ls -a+\textquotesingle + +\verb+umask 022+ +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{issue~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/issue= +\item 作用 + +系统登录时的欢迎界面 +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\verb=Linx Rocky 6.0 \n \l= +\end{shaded} +\end{minipage} +\end{myitemize} + +\section{系统配置} +\subsection{fstab~文件}\label{s2} +\begin{myitemize} +\item 路径 + +\verb=/etc/fstab= +\item 作用 + +静态文件系统信息,包含系统磁盘分区以及存储设备如何挂载,以及挂载点等信息 +\item 参数设置 + +\verb= = +\begin{myitemize} +\item \verb== + +要挂载的设备文件,包含设备文件所在路径及全名。 +\item \verb== + +设备的挂载点,包含挂载点的路径。 +\item \verb== + +设备的分区格式,如~\verb=ext2=、\verb=ext3=、\verb=xfs=、\verb=jfs=、\verb=iso9660=、\verb=fat=、\verb=swap=~等。 +\item \verb== + +挂载设备时所要设定的状态,如~\verb=ro=(只读)、\verb=defaults=(包括了其它参数如~\verb=rw、suid、exec、auto、nouser、async=)等,默认为~\verb=defaults=。 +\item \verb== + +在系统~DUMP~时是否需要~BACKUP~的标志位,默认值是~0。 +\item \verb== + +设定此~\verb==~是否要在开机时做~check~的动作,除了~\verb=/=~的~\verb==~其必要的~check~为~1~之外,其它皆可视需要设定,默认值是~0。 +\end{myitemize} +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +# +proc /proc proc defaults 0 0 +sysfs /sys sysfs defaults 0 0 +devpts /dev/pts devpts defaults 0 0 +tmpfs /dev/shm tmpfs defaults 0 0 +/dev/sda1 swap swap defaults 0 0 +/dev/sda2 / ext3 defaults 1 1 +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{inittab~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/inittab= +\item 作用 + +设置系统的启动参数 +\item 参数设置 + +\verb=id: runlevels: action: process= + +\begin{myitemize} +\item \verb=id= + +\verb=inittab=~文件中条目的唯一标识,限于~1-4~个字符。对于~\verb=getty=~或其它的注册进程。id~必须是响应的终端线路的~tty~后缀,如~1~响应~tty1。 +\item \verb=runlevels= + +列出发生指定动作的运行级。 + +\verb=runlevels=~域包含表示不同运行级的多个字符。例如~123~表示本进程在运行级为~1、2~和~3~时都要启动。用于~\verb=ondemand=~条目的~\verb=runlevels=~域可以包含~A、B~或~C。用于~\verb=sysinit=、\verb=boot=~和~\verb=bootwait=~条目的~\verb=runlevels=~域被忽略。 +\item \verb=action= + +描述要发生的动作。 + +\verb=action=~域可以使用的动作有: +\begin{myitemize} +\item \verb=respawn= + +该进程只要终止就立即重新启动(如~\verb=getty=)。 +\item \verb=wait= + +只要进入指定的运行级就启动本进程,并且~\verb=init=~等待该进程的结束 +\item \verb=once= + +只要进入指定的运行级就启动一次本进程。 +\item \verb=boot= + +在系统引导期间执行本进程,此条目的~\verb=runlevels=~域被忽略。 +\item \verb=bootwait= + +在系统引导期间执行本进程。并且~\verb=init=~等待该进程的结束(如~\verb=/etc/rc=)。此条目的~\verb=runlevels=~域被忽略。 +\item \verb=off= + +什么也不做。 +\item \verb=ondemand= + +在进入~\verb=ondemand=~运行级时才会执行标记为~\verb=ondemand=~的那些进程。无论怎样,实际上没有改变运行级(\verb=ondemand=运行级就是‘a’、‘b’、和‘c’)。 +\item \verb=initdefault= + +\verb=initdefault=~条目给出系统引导完成后进入的运行级,如果不存在这样的条目,\verb=init=~就会在控制台询问要进入的运行级。此条目的~\verb=process=域被忽略。 +\item \verb=sysinit= + +系统引导期间执行此进程,本进程会在~\verb=boot=~或~\verb=bootwait=~条目之前得到执行,此条目的~\verb=runlevels=~域被忽略。 +\item \verb=powerwait= + +本进程在电源不足时执行,通常在有进程把~UPS~和计算机相连时通知~\verb=init=~进程,~\verb=init=~在继续其它工作之前要等待此进程结束。 +\item \verb=powerfail= + +类似~\verb=powerwai=t,但是~\verb=init=不等待此进程完成。 +\item \verb=powerokwait= + +在~\verb=init=~收到电源已经恢复的通知后立即执行此进程。 +\item \verb=powerfailnow= + +本进程在~\verb=init=~被告知~UPS~电源快耗尽同时外部电源失败(无效)时被执行。(假设~UPS~和监视进程能够发现这样的情况) +\item \verb=ctrlaltdel= + +在~\verb=init=~收到~SIGINT~信号时执行此进程,这意味着有人在控制台按下了~\key{Ctrl}~-~\key{Alt}~-~\key{Del}~组合键,典型地,可能是想执行类似~\verb=shutdown=~然后进入单用户模式或重新引导机器。 +\item \verb=kbrequest= + +本进程在~\verb=init=~收到一个从控制台键盘产生的特殊组合按键信号时执行。 +\end{myitemize} +\item \verb=process= + +要执行的进程。 +\end{myitemize} +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +id:5:initdefault: + +si::sysinit:/etc/rc.d/rc sysinit + +l0:0:wait:/etc/rc.d/rc 0 +l1:S1:wait:/etc/rc.d/rc 1 +l2:2:wait:/etc/rc.d/rc 2 +l3:3:wait:/etc/rc.d/rc 3 +l4:4:wait:/etc/rc.d/rc 4 +l5:5:wait:/etc/rc.d/rc 5 +l6:6:wait:/etc/rc.d/rc 6 + +ft:06:respawn:/sbin/sulogin +su:S1:respawn:/sbin/sulogin + +x:5:respawn:/usr/bin/kdm --nodaemon + +1:2345:respawn:/sbin/agetty 38400 tty1 +2:2345:respawn:/sbin/agetty 38400 tty2 +3:2345:respawn:/sbin/agetty 38400 tty3 +4:2345:respawn:/sbin/agetty 38400 tty4 +5:2345:respawn:/sbin/agetty 38400 tty5 +6:2345:respawn:/sbin/agetty 38400 tty6 +~~:S:wait:/sbin/sulogin +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\section{挂载和卸载} +只有~root~或授权管理员才能运行~\verb=mount=~和~\verb=umount=~命令来挂载和卸载。要使其他用户也能运行这些命令,需编辑~\verb=/etc/fstab=~文件,为相应的设备指定选项~\verb=user=,即允许一般用户挂载该设备。 + +\subsection{挂载} +\verb=mount [option(s)] [device] mountpoint= + +使用此命令可以将任意数据介质(如硬盘、CD-ROM~驱动器和其它设备)装入~Linux~文件系统的某个目录。 + +\verb=-r= \quad 只读装入。 + +\verb=-t filesystem= \quad 指定文件系统,通常包括:\verb=ext2=(表示~Linux~硬盘)、\verb=msdos=(表示~MS-DOS~介质)、\verb=vfat=(表示~Windows~文件系统)、\verb=iso9660=(表示~CD)。 + +对于没有在~\verb=/etc/fstab=~中定义的硬盘,还须同时指定设备类型。在这种情况下只能由系统管理员装入。如果其他用户也应该能够装入文件系统,则应在~\verb=/etc/fstab=~文件的对应行中输入选项~\verb=user=(用逗号分隔多个用户),并保存所做更改。 + +\subsection{卸载} +\verb=umount [option(s)] mountpoint= + +此命令可用于从文件系统中卸载装入的驱动器。为防止数据丢失,请在将可移除的数据介质从其所在驱动器中移除之前运行此命令。 + +% \newpage +% \section{软件包管理} +% \subsection{软件包管理工具} +% \subsubsection{APT} +% 您可以使用~APT(the Advanced Packaging Tool)来管理软件包,由一些名字以“\verb=apt-=”开始的命令组成。 +% +% 常用的~APT~命令参数如下: +% +% \begin{itemize} +% \item \verb=apt-cache search =\qquad 搜索软件包 +% \item \verb=apt-cache show =\qquad 获取软件包的相关信息 +% \item \verb=apt-cache depends =\qquad 了解该软件包的依赖 +% \item \verb=apt-cache rdepends =\qquad 查看该软件包被哪些软件包依赖 +% \item \verb=apt-get install =\qquad 安装软件包 +% \item \verb=apt-get install --reinstall=\qquad 重新安装包 +% \item \verb=apt-get -f install =\qquad 修复安装,“\verb+-f = -fix-missing+” +% \item \verb=apt-get remove package =\qquad 删除软件包 +% \item \verb=apt-get remove --purge =\qquad 删除软件包,包括删除配置文件等 +% \item \verb=apt-get update =\qquad 更新源 +% \item \verb=apt-get upgrade =\qquad 更新已安装的所有软件包 +% \item \verb=apt-get dist-upgrade =\qquad 升级系统版本 +% \item \verb=apt-get dselect-upgrade =\qquad 使用~dselect~升级 +% \item \verb=apt-get build-dep =\qquad 安装相关的编译环境 +% \item \verb=apt-get source =\qquad 下载该软件包的源代码 +% \item \verb=apt-get clean= +% +% \verb=apt-get autoclean =\qquad 清理无用的软件包 +% \item \verb=apt-get check =\qquad 检查是否有损坏的依赖 +% \end{itemize} +% +% \subsubsection{aptitude} +% aptitude~与~apt-get~一样,是功能强大的包管理工具。与~apt-get~不同的是,aptitude~在处理依赖问题上更佳一些。举例来说,aptitude~在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。 +% +% 常用~aptitude~命令如下: +% +% \begin{myitemize} +% \item \verb=aptitude update =\qquad 更新可用的软件包列表 +% \item \verb=aptitude upgrade =\qquad 升级可用的软件包 +% \item \verb=aptitude dist-upgrade =\qquad 将系统升级到新的发行版 +% \item \verb=aptitude install =\qquad 安装软件包 +% \item \verb=aptitude remove =\qquad 删除软件包 +% \item \verb=aptitude purge =\qquad 删除软件包及其配置文件 +% \item \verb=aptitude search =\qquad 搜索名称中包含该字符串的软件包 +% \item \verb=aptitude show =\qquad 显示软件包的详细信息 +% \item \verb=aptitude clean =\qquad 删除下载的软件包文件 +% \item \verb=aptitude autoclean =\qquad 仅删除过期的软件包文件 +% \end{myitemize} +% +% 除此之外,您还可以执行命令~\verb=aptitude=~在文本界面模式中使用~aptitude,如图~\ref{f1}~所示。 +% +% % \begin{center} +% \newpage +% \begin{figure}[H] +% \centering +% \includegraphics[scale=0.5]{./pic/aptitude.png} +% \caption{aptitude~文本界面模式}\label{f1} +% \end{figure} +% +% +% \subsection{设置软件源} +% 您可以修改软件源配置文件~\verb=/etc/apt/sources.list=~来设置软件源,例如: +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% deb cdrom:[Rocky GNU/Linux 6.0.2_Squeeze_-Official amd64 DVD Bianry-1 +% 20120112-13:00]/ squeeze main +% deb http://rd-server/debian-mirror squeeze main contrib non-free +% deb http://ftp.debian.org/debian/ squeeze main contrib non-free +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% \subsection{安装软件包} +% 请先确认系统中有~dpkg、apt、aptitude~等包管理工具,并且已将软件源写入到~\verb=/etc/apt/sources.list=~文件中。 +% +% 然后执行以下命令: +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% apt-get update +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% 或 +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% aptitude update +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% 更新源信息将写到~\verb=/var/lib/apt/lists/=~目录下。至少包括以~\verb=Packages=、~\verb=Release=、~\verb=Release.gpg=~为结尾的三个文件。 +% +% 再执行以下命令: +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% apt-get install 或 aptitude install +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% 安装或更新指定软件包。 +% +% 或者 +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% apt-get upgrade 或 aptitude upgrade +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% 更新所有已安装的软件包。 +% +% 更新软件包将被下载到~\verb=/var/cache/apt/archives/=~中暂存,然后再进行安装。 +% +% 升级的记录会写在日志文件~\verb=/var/log/dpkg.log=、~\verb=/var/log/apt/term.log=~中。 + +\section{系统监控} +凝思安全操作系统默认自带系统监控工具gnome-system-monitor和xosview。 + +gnome-system-monitor和xosview分别可以从“应用程序——系统工具——系统监视器”和“应用程序——系统工具——Xosview”启动。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/monitor.png} + \caption{系统监控工具}\label{monitor} +\end{figure} + +gnome-system-monitor界面,如图~\ref{gnome-system-monitor}~所示。 + +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/gnome-system-monitor.png} + \caption{gnome-system-monitor}\label{gnome-system-monitor} +\end{figure} + +xosview界面,如图~\ref{xosview}~所示。 + +\begin{figure}[H] + \centering + \includegraphics{./pic/xosview.png} + \caption{xosview}\label{xosview} +\end{figure} + +\section{数据备份与恢复} +\subsection{数据备份的重要性} +凝思安全操作系统是稳定而健壮的。但是任何操作系统都有可能遭遇到一些无法考虑到的特殊情况,比如认为误操作,电气故障,以及自然界不可抗等因素,最终导致系统中最珍贵的数据丢失。所以数据备份和恢复就显得非常重要。 + +\subsection{工具名称} +凝思安全操作系统上的备份恢复工具可使用dump和restore。 + +\subsection{工具安装} +光驱中插入凝思安全操作系统安装光盘,执行如下命令进行工具的安装: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +apt-get install dump +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsection{备份与恢复策略} +\subsubsection{完全备份} +完全备份是完整地备份数据。 + +完全备份的优点是当数据发生丢失时,可以恢复所有丢失的数据;缺点是重复地进行数据完整备份会占用大量的空间,而且备份时间也会较长。 + +完全备份的示意图如~\ref{backup1}所示。 + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.7]{./pic/backup1.png} + \caption{完全备份示意图}\label{backup1} +\end{figure} + +\subsubsection{增量备份} +增量备份只能用于挂载了分区的目录。 + +增量备份是在依次完全备份或上一次增量备份后,以后每次的备份只需备份与前一次相比增加或者被修改的文件。这意味着,第一次增量备份的对象是进行完全备份后产生的增加和修改的文件,后续的增量备份则是对前一次增量备份所产生的增加和修改的文件,增量备份级别为1-9。 + +增量备份的优点是没有重复的备份数据,因此备份的数据量不大,备份所需的时间很短;缺点是增量备份的数据恢复比较麻烦,必须具有需要恢复的增量备份前面依赖的完全备份和增量备份(一旦丢失或者损坏其中任何一份,就会造成恢复失败),并且恢复是沿着完全备份到依次产生的增量备份按时间顺序进行恢复的,极大地延长了恢复时间。 + + +增量备份的示意图如~\ref{backup2}所示。 + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.7]{./pic/backup2.png} + \caption{增量备份示意图}\label{backup2} +\end{figure} + +\subsubsection{差异备份} +差异备份只能用于挂载了分区的目录。 + +差异备份是以完全备份为基准的一种备份方式。例如,第一次对原数据进行完全备份,第二次的备份为原数据从第一次完全备份到第二次备份间的差异,原数据从第三次备份为第一次完全备份到第三次备份间的差异,依次类推。 + +差异备份的优点是避免了以上两种备份策略的缺陷,同时由具备有两者的优点,无需每次都对系统做完全备份,因此备份数据量小,备份时间短,其次在恢复数据时也很方面,只需要两个备份,即第一次的完全备份和数据发生灾难前一次的差异备份即可。 + +差异备份的示意图如~\ref{backup3}所示。 + +\newpage +\begin{figure}[H] +\centering + \includegraphics[scale=0.7]{./pic/backup3.png} + \caption{差异备份示意图}\label{backup3} +\end{figure} + +\subsection{工具参数} +\renewcommand{\arraystretch}{1.2} +\begin{center} +\begin{longtable}{|p{2.5cm}|p{12.5cm}|} +\caption{dump} \\ +\hline +\centering\bfseries 命令格式 & dump [-选项中的备份级别][-选项][-f备份文件] 要备份的数据 \tabularnewline \hline +\centering\bfseries 命令选项 & \centering\bfseries 选项解析 \tabularnewline \hline +-[0-9] & 备份级别,普通备份使用0,分区备份中使用不同的数字进行增量或差异备份。 \tabularnewline \hline +-S & 后跟需要备份的文件,可以计算出备份需要的空间。 \tabularnewline \hline +-u & 将本次备份时间记入档案,本选项不支持非分区挂载点。 \tabularnewline \hline +-v & 显示详细执行信息。 \tabularnewline \hline +-j & 加入bzip2支持,将内容进行压缩。 \tabularnewline \hline +-f & 指定备份文件,也可以接设备文件如~\verb=/dev/st0=~等。 \tabularnewline \hline +-W & 列出在~\verb=/etc/fstab=~里具有dump设定的分区是否有进行过备份。 \tabularnewline \hline +\end{longtable} +\end{center} + +\newpage +\begin{center} +\begin{longtable}{|p{7cm}|p{8cm}|} +\caption{restore} \\ +\hline +\centering\bfseries 命令格式 & \centering\bfseries 命令解析 \tabularnewline \hline +restore -t [-f备份文件] & 查看备份文件信息 \tabularnewline \hline +restore -C [-f备份文件] [-D 挂载点] & 比较备份数据和挂载点数据的差别 \tabularnewline \hline +restore -i [-f备份文件] & 进入互动模式 \tabularnewline \hline +restore -r [-f备份文件] & 还原系统分区 \tabularnewline \hline +\end{longtable} +\end{center} +\renewcommand{\arraystretch}{1} + +\subsection{功能演示} +\begin{myenumerate} + \item 以不同策略对分区进行备份 + +\verb=/dev/sda6=~的挂载目录为~\verb=/tmp/mountpoint=,要对该分区备份3次。 +\begin{myenumerate} + \item 采取完全备份 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lv00.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +第一次完全备份,备份文件为~\verb=/tmp/lv00.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lv02.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +第二次完全备份,备份文件为~\verb=/tmp/lv02.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lv03.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +第三次完全备份,备份文件为~\verb=/tmp/lv03.dmp=。 +\item 采取增量备份 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lva0.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +第一次为完全备份,备份文件为~\verb=/tmp/lva0.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lva1.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +基于第一次备份的增量备份,备份文件为~\verb=/tmp/lva1.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lva2.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +基于前两次备份的增量备份,备份文件为~\verb=/tmp/lva2.dmp=。 +\item 采取差异备份 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lvd00.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +第一次为完全备份,备份文件为~\verb=/tmp/lvd00.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lvd01.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +基于第一次备份的差异备份,备份文件为~\verb=/tmp/lvd01.dmp=。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +dump -0u -f /tmp/lvd02.dmp /tmp/mountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +基于第二次备份的差异备份,备份文件为~\verb=/tmp/lvd02.dmp=。 +\end{myenumerate} +\item 普通文件备份 + +\begin{minipage}{14.2cm} +\begin{shaded} +\begin{verbatim} +dump -0 -f /tmp/bakfile /tmp/nmountpoint +\end{verbatim} +\end{shaded} +\end{minipage} + +把~\verb=/tmp/nmountpoint=完全备份到~\verb=/tmp/bakfile=。 +\item 数据恢复 + +查看备份内容: + +\begin{minipage}{14.2cm} +\begin{shaded} +\begin{verbatim} +restore -tf /tmp/bakfile #查看备份文件bakfile中备份的文件 +\end{verbatim} +\end{shaded} +\end{minipage} + +通过备份文件交互式地完成数据恢复: + +\begin{minipage}{14.2cm} +\begin{shaded} +\begin{verbatim} +restore -if /tmp/bakfile #进入交互模式,开始恢复bakfile备份的内容 +restore > help #在交互式命令行中输入help,查看恢复命令 +restore > cd /tmp #切换目录 +restore > add /nmountpoint #添加nmountpoint到恢复队列 +restore > extract #开始恢复 +restore > quit #退出交互 +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myenumerate} + +\chapter{软件包管理} +\section{软件包管理机制} +\subsection{软件包概述} +软件包通常包含了实现一系列相关命令或特性所必须的所有的文件。有两种类型的~Deb~软件包: +\begin{myitemize} + \item Binary packages(二进制软件包),包含可执行文件、配置文件、man/info~页面、版权声明和其它文档。它们通常使用~.deb~的扩展名以示区别。这种二进制软件包可使用工具~dpkg~解包。 + \item Source packages(源码包),包含一个~.dsc~文件它用于描述源码包(包括下列文件的名称),一个~.orig.tar.gz~文件它是未经修改的原始源代码压缩文件,以及一个~.diff.gz~件它包含了该软件包~Debian~化时所做的修改。 +\end{myitemize} + +\subsection{软件包命名约定} +软件包命名遵循下列约定: + +\begin{minipage}{14.2cm} +\begin{shaded} +\begin{verbatim} +foo_ver-rev_arch.deb +\end{verbatim} +\end{shaded} +\end{minipage} + +一般这里的~foo~是软件包的名称,ver~是软件本身的版本号,rev~是修订版本号,arch~是目标架构名称。修订版本号由开发者或创建这个软件包的人指定。通常,包被修改过之后,会把修改版本号加一。 + +\subsection{维护脚本} +维护脚本是一种可执行脚本,它在软件包安装之前或之后自动运行。它和一个名叫~control~的文件一起组成~Deb~包文件的“管理”部分。这些文件包括: +\begin{myitemize} + \item preinst + + 在软件包(.deb)文件解包之前,运行这个脚本。许多“preinst”脚本的任务是停止作用于待升级软件包的服务,直到软件包安装或升级完成。 + \item postinst + + 该脚本的任务是完成软件包(.deb)文件解包文件的配置工作。通常,“postinst”脚本等待用户输入,或提醒用户,如果他接受当前默认值,要记得软件包安装完后返回重新配置。许多“postinst”脚本负责执行有关命令为新安装或升级的软件重启服务。 + \item prerm + + 该脚本负责停止与软件包关联的~daemon~服务。它在删除软件包关联文件之前执行。 + \item postrm + + 该脚本负责修改软件包链接或文件关联,或删除由它创建的文件。 +\end{myitemize} + +\subsection{软件包优先级} +每个软件包均被发布者指定了一个优先级,作为软件包管理系统的一个辅助参数,优先级的值有: +\begin{myitemize} + \item Required(必须) + + 该级别软件包是保证系统正常运行必须的。 + \item Important(重要) + + 在任何类 Unix 系统上均安装有该级别软件包。 + \item Standard(基本) + + 该级别软件包是任何~Linux~系统的标准件,它们组成一个小而精的字符模式的系统。 + \item Optional(推荐) + + 该级别软件包包括那些你可能想安装的软件,即使对它们并不熟悉,但对它们没有特殊的要求。 + \item Extra(额外) + + 该级别软件包可能与其它高级别软件包冲突,仅当你知道其用途时才会使用它们,或者有运行它们有专门要求。 +\end{myitemize} + +\subsection{软件包依赖关系} +软件包管理系统依赖声明,它描述了这一事实:一些软件包需要其它软件包被安装才能正常运行或运行得更好。 +\begin{myitemize} + \item 软件包~A~依赖(depends)软件包~B:要运行~A~必须安装~B。在有些情况下,A~不仅依赖~B,还要求~B~的特定版本。版本依赖通常有最低版本限制,A~更依赖于~B~的最新版本而非某个特定版本。 + \item 软件包~A~推荐(recommends)软件包~B:软件包维护者认为所有用户都不会喜欢缺少某些功能的~A,而这些功能需要~B~来提供。 + \item 软件包~A~建议(suggests)软件包~B:B~中某些文件与~A~的功能相关,并能够增强~A~的功能。这种关系通过声明软件包~B~增强软件包~A~来表示。 + \item 软件包~A~与软件包~B~冲突(conflicts):如果系统中安装了~B~那么~A~无法运行。“conflicts”常和“replaces”同时出现。 + \item 软件包~A~替换(replaces)软件包~B:B~安装的文件被~A~中的文件移除和覆盖了。 + \item 软件包~A~提供(provides)软件包~B:A~包含了~B~中的所有文件和功能。 +\end{myitemize} + +\section{软件包管理工具} +\subsection{常用的包管理工具} +\begin{myitemize} + \item \verb=dpkg =底层软件包管理工具 + \item \verb=apt =高级软件包管理工具集 + \item \verb=aptitude =apt~命令行前端 +\end{myitemize} + +\subsection{dpkg} +dpkg~是软件包管理器的基础,被用于安装、卸载和查看~.deb~软件包相关的信息。 + +常用的dpkg命令参数如下: +\begin{myitemize} + \item \verb=dpkg -i =\qquad 安装软件包 + \item \verb=dpkg -r [--purge] =\qquad 卸载软件包 + \item \verb=dpkg -l =\qquad 列出软件包名称和安装状态 + \item \verb=dpkg -s =\qquad 查看软件包详细状态 + \item \verb=dpkg -L =\qquad 软件包安装文件列表 + \item \verb=dpkg -c =\qquad 列出软件包文件~.deb~内容 + \item \verb=dpkg -x =\qquad 解压软件包文件到目录 +\end{myitemize} + +\subsection{apt} +apt~是一个软件包管理工具集合,是~dpkg~的高级前端,可以解决软件包依赖问题。apt~工具集使用时通常需要通过网络访问软件源,最常用的工具包括~apt-get~和~apt-cache。 + +\subsubsection{设置软件源} +软件源指的是提供各种软件包下载的服务器。apt~从指定的软件源获取软件包列表(\verb=/var/lib/apt/lists/*=),在需要时下载安装。 + +您可以修改~\verb=/etc/apt/sources.list=~来设置软件源,例如: + +\begin{minipage}{14.2cm} +\begin{shaded} +\begin{verbatim} +deb http://ftp.debian.org/debian/squeeze main non-free contrib +\end{verbatim} +\end{shaded} +\end{minipage} + +\subsubsection{apt-get} +apt-get~是一个命令行方式的软件包处理工具,常用的命令参数如下: +\begin{myitemize} +\item \verb=apt-get update =\qquad 更新软件包列表 +\item \verb=apt-get install =\qquad 安装软件包 +\item \verb=apt-get install --reinstall=\qquad 重新安装软件包 +\item \verb=apt-get remove =\qquad 卸载软件包 +\item \verb=apt-get remove --purge =\qquad 卸载软件包(删除配置文件) +\item \verb=apt-get upgrade =\qquad 升级所有软件包 +\item \verb=apt-get build-dep =\qquad 安装软件包编译环境 +\item \verb=apt-get source =\qquad 下载源码包 +\item \verb=apt-get clean =\qquad 清理软件包缓存 +\item \verb=apt-get check =\qquad 检查是否有损坏的依赖 +\end{myitemize} + +\subsubsection{apt-cache} +apt-cache~用于查询软件包的相关信息,常用的命令参数如下: +\begin{myitemize} +\item \verb=apt-cache search =\qquad 搜索软件包 +\item \verb=apt-cache show =\qquad 显示软件包相关信息 +\item \verb=apt-cache showsrc =\qquad 显示源码包相关信息 +\item \verb=apt-cache depends =\qquad 显示软件包的依赖信息 +\item \verb=apt-cache rdepends =\qquad 显示依赖~~的软件包的信息 +\end{myitemize} + +\subsection{aptitude} +aptitude~与~apt-get~一样,是功能强大的包管理工具。与~apt-get~不同的是,aptitude~在处理依赖问题上更佳一些。举例来说,aptitude~在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。 + +常用~aptitude~命令如下: + +\begin{myitemize} + \item \verb=aptitude update =\qquad 更新可用的软件包列表 + \item \verb=aptitude upgrade =\qquad 升级可用的软件包 + \item \verb=aptitude dist-upgrade =\qquad 将系统升级到新的发行版 + \item \verb=aptitude install =\qquad 安装软件包 + \item \verb=aptitude remove =\qquad 删除软件包 + \item \verb=aptitude purge =\qquad 删除软件包及其配置文件 + \item \verb=aptitude search =\qquad 搜索名称中包含该字符串的软件包 + \item \verb=aptitude show =\qquad 显示软件包的详细信息 + \item \verb=aptitude clean =\qquad 删除下载的软件包文件 + \item \verb=aptitude autoclean =\qquad 仅删除过期的软件包文件 +\end{myitemize} + +除此之外,您还可以执行命令~\verb=aptitude=~在文本界面模式中使用~aptitude,如图~\ref{f1}~所示。 + +% \begin{center} +\newpage +\begin{figure}[H] + \centering + \includegraphics[scale=0.5]{./pic/aptitude.png} + \caption{aptitude~文本界面模式}\label{f1} +\end{figure} + +\subsection{安装软件包} +请先确认系统中有~dpkg、apt、aptitude~等包管理工具,并且已将软件源写入到~\verb=/etc/apt/sources.list=~文件中。 + +然后执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +apt-get update +\end{verbatim} +\end{shaded} +\end{minipage} + +或 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +aptitude update +\end{verbatim} +\end{shaded} +\end{minipage} + +更新源信息将写到~\verb=/var/lib/apt/lists/=~目录下。至少包括以~\verb=Packages=、~\verb=Release=、~\verb=Release.gpg=~为结尾的三个文件。 + +再执行以下命令: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +apt-get install 或 aptitude install +\end{verbatim} +\end{shaded} +\end{minipage} + +安装或更新指定软件包。 + +或者 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +apt-get upgrade 或 aptitude upgrade +\end{verbatim} +\end{shaded} +\end{minipage} + +更新所有已安装的软件包。 + +更新软件包将被下载到~\verb=/var/cache/apt/archives/=~中暂存,然后再进行安装。 + +升级的记录会写在日志文件~\verb=/var/log/dpkg.log=、~\verb=/var/log/apt/term.log=~中。 + + + + + +\chapter{用户管理} +\section{添加用户} +以~root~或授权管理员登录,执行~\verb=useradd testuser1=,将添加用户~testuser1,如果需要同时建立用户目录,则执行~\verb=useradd -m testuser1=。 + +\important{15cm}{添加用户时会随机生成用户口令,请记录该口令或修改口令。} + +\hint{15cm}{执行~\texttt{less /etc/passwd}~可以看到新增加用户~testuser1~的信息。} + +\section{删除用户} +以~root~或授权管理员登录,执行~\verb=rmuser testuser1=,testuser1~的用户信息将会被从各个相关的用户数据文件(如~\verb=/etc/passwd、/etc/group、/etc/shadow=~等)中删除,如果需要删除用户目录及其它相关文件,则执行~\verb=rmuser -r testuser1=。 + +\section{添加用户组} +以~root~或授权管理员登录,执行~\verb=groupadd test=,将添加用户组~test。 + +\hint{15cm}{执行~\texttt{useradd -g test testuser1}~可创建用户~testuser1~并添加到~test~用户组,但~test~组必须已存在。 } + +\section{删除用户组} +以~root~或授权管理员登录,执行~\verb=groupdel test=,将删除用户组~test。 + +\warning{15cm}{只有某用户组是空组(没有用户属于该组),或该用户组不是任何用户的~primary group~的情况下,才可以删除该用户组,其它情况下均不能删除该用户组。} + +\section{将用户添加到用户组} +以~root~或授权管理员登录,执行~\verb=gpasswd -a testuser1 test=,将用户~testuser1~添加到用户组~test。 + +\section{将用户从用户组中删除} +以~root~或授权管理员登录,执行~\verb=gpasswd -d testuser1 test=,将用户~testuser1~从用户组~test~中删除。 + +\note{14cm}{用户必须属于至少一个用户组,因此,当用户只属于一个用户组时,将不能使用上述命令将用户从该用户组中删除。} + +\section{改变用户当前所在组} +如果用户同时属于几个用户组,可使用~\verb=newgrp=~命令来改变当前所在组,之后将使用新的组~ID~来进行文件存取权限的管理。 + +如:用户~testuser~同时属于~users~和~test~用户组,当前组别为~users,执行~\verb=touch test1.txt=~新建文件~\verb=test1.txt=,再执行~\verb=newgrp test=~改变登录的用户组到~test,执行~\verb=touch test2.txt=~新建文件~\verb=test2.txt=。查看文件~\verb=test1.txt=~和~\verb=test2.txt=~的信息,属主都是~testuser~,但分别属于~users~和~test~用户组。 + +\section{修改用户口令} +使用~\verb=passwd=~命令可修改当前用户自己的口令。 + +如:用户~testuser1~使用~\verb=passwd=~命令,若旧口令输入错误,则不能修改口令。按要求输入正确的旧口令后,输入新口令并再次确认,口令修改成功。 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +$ passwd +为 testuser1 更改 STRESS 密码 +(当前)UNIX 密码: # 输入错误的旧口令 +passwd: 鉴定令牌操作错误 +passwd: password unchanged + +$ passwd +为 testuser1 更改 STRESS 密码 +(当前)UNIX 密码: # 输入正确的旧口令 +输入新的 UNIX 密码: +重新输入新的 UNIX 密码 +passwd: 已成功更新密码 +\end{verbatim} +\end{shaded} +\end{minipage} + +\vspace{1cm} +若输入的新口令不符合要求(如,与旧口令相同),则会要求重新输入新口令。 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +密码未更改 +输入新的 UNIX 密码: +\end{verbatim} +\end{shaded} +\end{minipage} + +\vspace{1cm} +重新输入的次数有限制(由授权管理员设置),当尝试次数达到限制次数后,系统返回提示并退出口令修改: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +passwd: 鉴定令牌操作错误 +passwd: password unchanged +\end{verbatim} +\end{shaded} +\end{minipage} +% \verb=passwd: Authentication token manipulation error= + +\vspace{1cm} +输入新口令需要注意以下几点: +\begin{myitemize} +\item 口令必须为~6~127~位的英文、数字和特殊字符的组合,若输入的新口令不足5位,系统将提示要求重新输入: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +输入新的 UNIX 密码: # 输入不足5位的口令 +必须选择更长的密码 +输入新的 UNIX 密码: +\end{verbatim} +\end{shaded} +\end{minipage} +\item 输入新口令时,若输入的口令保密性不好,比如与之前的口令相似、是某个英文单词或过于简单,系统也会提示,并要求重新输入: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +输入新的 UNIX 密码: # 输入与之前的口令相似,如,原口令为 + # 12345678,输入新口令为 1234567 +Bad: new and old password are too similar +输入新的 UNIX 密码: # 输入某个英文单词或过于简单 + # 如:rocky1 +Bad: new password is too simple +输入新的 UNIX 密码: +\end{verbatim} +\end{shaded} +\end{minipage} + +\important{14cm}{口令位数越少时,就要求越复杂的字符组合。} +\item 若确认新口令(即第二次输入新口令)时错误,系统将提示,并要求重新输入新口令: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +Sorry, passwords do not match +passwd: 无法恢复鉴定信息 +passwd: password unchanged +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\important{15cm}{用户口令的修改也可能被限制。授权管理员可以设定两次修改用户口令之间间隔的最长和最短时间、口令作废的日期、在用户口令作废前多少天警告用户、在账号自动锁定之前容许用户多少天不活动等等。} + +以~root~或授权管理员登录,执行~\verb=passwd=~命令,可修改任意用户的口令。 + +\caution{15cm}{以~root~的身份修改用户口令为强制性修改,不需要验证旧口令,请谨慎使用。} + +\section{修改用户口令时限} +以~root~或授权管理员登录,使用~\verb=passwd=~或~\verb=chage=~命令可以设定两次修改口令之间间隔的最长和最短时间,口令作废的日期,在用户口令作废前多少天警告用户,在账户自动锁定之前容许用户多少天不活动等。 + +\verb=passwd [Options] username= + +\noindent Options: +\begin{myitemize} +\item \verb=-a, --all= + +显示所有帐户的信息。仅能与“\verb=-S=”选项一起使用。 +\item \verb=-d, --delete= + +删除用户帐户的口令。 +\item \verb=-e, --expire= + +用户帐号到期的日期。过了这天,此用户帐号将不可用。 +\item \verb=-k, --keep-tokens= + +只更改到期的口令。 +\item \verb=-i, --inactive INACTIVE= + +停滞时期。如果一个口令已过期这些天,那么此用户帐号将不可用。 +\item \verb=-l, --lock= + +锁定指定的帐号。锁定后,此用户帐号将不可用。 +\item \verb=-n, --mindays MIN_DAYS= + +可更改口令的最小天数,为~0~时代表任何时候都可以更改口令。 +\item \verb=-S, --status= + +显示用户帐号的口令状态信息。 +\item \verb=-u, --unlock= + +为指定的帐号解锁。解锁后,此用户帐号将变为可用。 +\item \verb=-w, --warndays WARN_DAYS= + +用户口令到期前,提前收到警告信息的天数。 +\item \verb=-x, --maxdays MAX_DAYS= + +口令保持有效的最大天数。 +\end{myitemize} + +\vspace{1cm} +\verb=chage [Options] username= + +\noindent Options: +\begin{myitemize} +\item \verb=-d, --lastday LAST_DAY= + +设置上一次更改口令的日期。 +\item \verb=-E, --expiredate EXPIRE_DATE= + +用户帐号到期的日期。过了这天,此用户帐号将不可用。 +\item \verb=-I, --inactive INACTIVE= + +停滞时期。如果一个口令已过期这些天,那么此用户帐号将不可用。 +\item \verb=-l, --list= + +列出当前的设置。由非特权用户来确定他们的密码或用户帐号何时过期。 +\item \verb=-m, --mindays MIN_DAYS= + +可更改口令的最小天数,为~0~时代表任何时候都可以更改口令。 +\item \verb=-M, --maxdays MAX_DAYS= + +口令保持有效的最大天数。 +\item \verb=-W, --warndays WARN_DAYS= + +用户口令到期前,提前收到警告信息的天数。 +\end{myitemize} + + +例如,将用户~testuser1~两次修改口令之间的最小天数设为~2、最大天数设为~90、作废日期为~2009~年~1~月~1~日,并且在接近作废日期的~14~天里警告用户: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=$ chage -m 2 -M 90 -E 2009-01-01 -W 14 testuser1= +\end{shaded} +\end{minipage} + +\section{修改用户信息} +以~root~或授权管理员登录,使用~\verb=usermod=~命令可修改用户信息。 + +\begin{verbatim} + usermod [-c comment] [-d home_dir [-m]] + [-e expire_date] [-f inactive_days] [-g initial_group] + [-G groups ...] [-l name] [-s shell] [-u uid [-o]] name +\end{verbatim} + +在命令行中使用一个~\verb=name=~参数指定要改变信息的用户(指定的用户必须存在,且不能是当前在线的用户),并且利用它所提供的各个选项来指定改变字段以及值。 + +\begin{myitemize} +\item \verb=-c comment= + +更改用户的注释。 +\item \verb=-d home_dir= + +更改用户主目录名称。 +\item \verb=-e expire_date= + +更改用户的到期日,到期日使用~\verb=mm/dd/yy=~格式来设定。 +\item \verb=-f inactive_days= + +更改用户到期几天后停止使用该用户,设定为0表示到期后立即停用,预设为-1表示要关闭这个功能。 +\item \verb=-g initial_group= + +更改用户的所属组,\verb=initial_group=~参数可以使用组的名称或编号来指定组,不过指定的组必须是已存在的。 +\item \verb=-G group,[...]= + +更改该用户属于哪些组的成员,可以指定多个组,组间以逗号分隔。可以使用组的名称或编号来指定组,不过指定的组必须是已存在的。 +\item \verb=-l name= + +更改用户的名称,该用户的主目录名称需要手动修改。 +\item \verb=-s shell= + +更改用户登录系统后执行的~shell,如果指定空白,将会执行系统预设的~shell。 +\item \verb=-u uid= + +更改用户的~UID。指定的~UID~不能与其它用户的~UID~重复,如果~UID~不唯一,则必须加上~\verb=-o=~选项。UID~不可为负值。 +\end{myitemize} + +\section{修改口令文件} +为了保证系统的安全性,系统通常对用户的口令进行~shadow~处理,并把用户口令保存到只有~root~可读的~\verb=/etc/shadow=~文件中。该文件包含了系统中所有用户和用户口令等相关信息。每个用户在该文件中对应一行,并且用冒号分成九个域,每一个域包括以下内容: +\begin{myenumerate} +\item 用户登录名 +\item 用户加密后的口令(若为空,表示该用户不需口令即可登录,若为*号,表示该帐号被禁止) +\item 从1970年1月1日至口令最近一次被修改的天数 +\item 口令在多少天内不能被用户修改 +\item 口令在多少天后必须被修改 +\item 口令过期多少天后用户帐号被禁止 +\item 口令在到期多少天内给用户发出警告 +\item 口令自1970年1月1日被禁止的天数 +\item 保留域 +\end{myenumerate} + +以~root~登录,可对口令文件~\verb=/etc/shadow=~进行修改。 + +% \section{更改文件所有权} +% 管理员可以使用~\verb=chown=~命令将文件所有权转让给具有指定用户名的用户。命令使用如下: +% +% \verb=chown [option(s)] username[:[group]] file(s)= +% +% \verb=-R= \quad 更改所有子目录中的文件和目录。 +% +% \section{更改文件的组所有权} +% 管理员可以将特定~\verb=file=~的组所有权转让给具有指定组名的组。如果文件拥有者即是当前组也是新组的成员,该拥有者只能转让组所有权。命令使用如下: +% +% \verb=chgrp [option(s)] groupname file(s)= + +\section{定义鉴别阈值} +用户登录系统时,若输入的新口令不符合要求,则会被要求重新输入新口令。重新输入的次数也有限制,当尝试次数达到限制次数后,系统返回提示并退出口令修改,并在一定的时间内不能再次尝试登录系统。 +% 管理员可以修改~\verb=/etc/pam.d/passwd=~文件来自定义这些阈值。 + +管理员可以修改~\verb=/etc/login.defs=~文件来自定义这些阈值。 + +如: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} + LOGIN_RETRIES 3 # 输入口令的尝试次数限制为3次 + LOGIN_TIMEOUT 60 # 登录超时限制为60秒 + PASS_MIN_LEN 5 # 口令必须为5位以上 +\end{verbatim} +\end{shaded} +\end{minipage} + + +% 如: +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \verb+password required /lib64/security/pam_cracklib.so retry=3 minlen=5+ +% \end{shaded} +% \end{minipage} + +% \verb+retry=3+~表示尝试次数为3;\verb+minlen=5+~表示口令必须为5位以上。 + + +% \section{自定义特权用户} +% 我们还可以根据需要自行定义系统中的特权用户,特权用户的配置文件是:\verb=/etc/security/user_cap.conf=。 +% +% 特权用户配置文件的格式是: +% \begin{verbatim} +% # 注释 +% 用户名称 +% { +% 用户特权 +% } +% \end{verbatim} +% +% 其中,“用户名称”是系统中某个特定的合法用户,“用户特权”是指该用户具备的特权。 +% +% 用户特权的定义方式符合~POSIX.1E~标准,具体格式参见~POSIX.1E/D17~中25.3的说明。 +% +% \noindent 例样: +% +% \begin{minipage}{15cm} +% \begin{shaded} +% \begin{verbatim} +% # Privilege of user sysadmin +% sysadmin +% { +% cap_sys_admin, cap_sys_boot+eip +% } +% +% # Privilege of user netadmin +% netadmin +% { +% cap_net_admin, cap_sys_module+eip +% } +% +% # Privilege of user secadmin +% secadmin +% { +% cap_sec_admin+eip +% } +% +% # Sample of defined privileged user +% { +% cap_setgid, cap_fowner, cap_dac_override+eip +% cap_dac_read_search, cap_sys_ptrace+eip +% } +% \end{verbatim} +% \end{shaded} +% \end{minipage} +% +% \warning{15cm}{赋予用户某些特权,可能会导致系统不安全,请谨慎设置!} + +% \section{进程行为监督} +% 行为监督功能用于限制进程所能执行的程序,一旦进程试图执行不允许它执行的程序,该进程就被自动终止,从而有效地防止缓冲器溢出造成的不良后果。 +% +% 行为监督的配置有系统引导时的静态配置和系统正常运行时的动态配置两种。动态配置的设置覆盖静态配置的设置。 +% +% 行为监督机制的静态配置通过~\verb=/etc/dog.conf=~文件实现。 +% +% 主要涉及以下四个方面: +% \begin{myenumerate} +% \item 行为监督机制的使能/禁能 +% +% 在行为监督配置文件~\verb=/etc/dog.conf=~中加入~\verb=bark on=~即可使能行为监督安全机制,加入~\verb=bark off=~即可禁能行为监督安全机制。 +% +% 缺省设置:\verb=bark off= +% \item 受限项目 +% +% 由受限父进程映象名和相应的受限子进程映象文件名队组成。受限项目的格式为: +% \begin{verbatim} +% # 注释 +% < 受限父进程映象名 > +% { +% 相应的受限子进程映象文件名集合 +% } +% \end{verbatim} +% +% 受限父进程映象名和相应的受限子进程映象文件名中的空格“\textvisiblespace”以“\verb=\=\textvisiblespace”表示。受限子进程映象文件名给出方式有三种:全路径文件名、全路径目录名、全路径目录名除了某几个不带路径的文件名。全路径目录名除了某几个不带路径的文件名格式为: +% +% \verb=< 全路径目录名> ! < 除了某几个不带路径的目录名 >= +% +% 例如在配置文件中有下面的受限项目: +% \begin{verbatim} +% named{ +% # 实际目录名是"/named dir1/subdir/" +% # "/named dir1/subdir/"目录下的程序都受限制 +% /named\ \ dir1/subdir/ +% /dir/subdir/prog +% # 目录/dir2/subdir2目录中的除了prog1和prog2都受到限制 +% # 注意"!prog1"中"!"和"prog1"间没有空格;"!prog2"也与此相同 +% /dir2/subdir2/ !prog1 !prog2 +% } +% \end{verbatim} +% +% 表示对于映象名为~\verb=named=~的进程,可以执行~\verb=/named dir1/subdir/=~目录下的所有程序文件;可以运行~\verb=/dir/subdir/prog=~程序文件;可以运行~\verb=/dir2/subdir2/=~目录下除了~\verb=/dir2/subdir2/prog1=~和~\verb=/dir2/subdir2/prog2=~以外的所有程序文件。 +% \item 行为监督逻辑判断准则 +% +% 行为监督逻辑判断准则可以为:列出允许逻辑(\verb=list_allow=)或列出禁止逻辑(\verb=list_deny=)。使用列出允许逻辑(\verb=list_allow=)时,对于具有特定映象的父进程,只有列出的映象文件才可以作为子程序的映象。使用列出禁止逻辑(\verb=list_allow=)时,对于具有特定映象的父进程,只有列出的映象文件才被禁止作为子程序的映象。 +% +% 在行为监督配置文件~\verb=/etc/dog.conf=~中加入~\verb=logical list_allow=~选定列出允许逻辑(\verb=list_allow=),加入~\verb=logical list_deny=~选定列出禁止逻辑(\verb=list_deny=)。 +% +% 缺省设置:\verb=logical list_allow= +% +% 行为监督安全机制的动态配置通过对~\verb=/proc/dog/=~目录下的各个对应项的~\verb=proc=~文件进行操作来实现。 +% +% 主要涉及以下两个方面:行为监督的使能/禁能 +% +% \hint{15cm}{执行以下命令需要~\texttt{cap\_dac\_override}~能力。} +% +% 行为监督使能:\verb=$ echo 1>/proc/dog/bark= +% +% 行为监督禁能:\verb=$ echo 0>/proc/dog/bark= +% +% 缺省设置:\verb=echo 0>/proc/dog/bark= +% \item 受限项目 +% +% \hint{15cm}{执行以下命令需要~\texttt{cap\_dac\_override}~能力。} +% +% \verb=echo < 相应的受限子进程映象文件名集合 > >/proc/dog/ < 受限父进程映象名 >= +% +% 受限父进程映象名和相应的受限子进程映象文件名中的空格“\textvisiblespace”以“\verb=\=\textvisiblespace”表示。受限子进程映象文件名给出方式有三种:全路径文件名、全路径目录名、除了某几个不带路径的目录名。 +% +% 例如,对~ftpd +% +% \verb=$ echo /usr/bin/some_program >/proc/dog/ ftpd= +% +% \note{15cm}{对映象名为~ftpd~的进程及其派生的子进程只能以映象文件~\texttt{/usr/bin/some\_program}~产生子进程。} +% \end{myenumerate} +% +% \subsubsection*{\texttt{/etc/dog.conf}~例样} +% \begin{verbatim} +% # set bark method, default is off. +% bark on +% +% # set bark logical to weak protection method +% # which means all listing child +% # images are denied to run. Default is list_allow. +% logical list_deny +% +% # some deemons and their child images +% +% named{ +% # 实际目录名是"/named dir1/subdir/" +% # "/named dir1/subdir/"目录下的程序都受限制 +% /named\ \ dir1/subdir/ +% /dir/subdir/prog +% # 目录/dir2/subdir2目录中的除了prog1和prog2都受到限制 +% # 注意"!prog1"中"!"和"prog1"间没有空格;"!prog2"也与此相同 +% /dir2/subdir2/ !prog1 !prog2 +% } +% dhcpd{ +% # this is a legal item +% } +% httpd{ +% # this tests session children +% /root/test/dog/tmp/sess +% /root/test/dog/tmp/childd +% } +% smbd{ +% # this test session children +% /root/test/dog/tmp/ !child +% } +% +% # add any items. +% \end{verbatim} + +\chapter{网络管理} +\section{网络参数配置} +\subsection{interfaces~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/network/interfaces= +\item 作用 + +设置网络接口参数。 +% \item 参数设置 +% +% \verb+HOSTNAME = # 主机名+ +\item 例样 + +下面是一个配置示例,它在一个网络接口中配置了两个静态~IP~地址: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +# This file describes the network interfaces available on your +# system and how to activate them. For more information, see +# interfaces(5). + +# The loopback interface +auto lo +iface lo inet loopback + +# The primary network interfaces +auto eth0 +iface eth0 inet static + address 192.168.1.1 + netmask 255.255.255.0 + network 192.168.1.0 + broadcast 192.168.1.255 + gateway 192.168.1.1 +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +auto eth0:0 +iface eth0:0 inet static + address 192.168.1.2 + netmask 255.255.255.0 + network 192.168.1.0 + broadcast 192.168.1.255 + gateway 192.168.1.1 +\end{verbatim} +\end{shaded} +\end{minipage} + +\vspace{1cm} +下面是一个从~DHCP~服务器自动获得~IP~地址的示例: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +# This file describes the network interfaces available on your +# system and how to activate them. For more information, see +# interfaces(5). + +# The loopback interface +auto lo +iface lo inet loopback + +# The primary network interfaces +allow-hotplug eth0 +iface eth0 inet dhcp +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{resolv.conf 文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/resolv.conf= +\item 作用 + +DNS~域名解析的配置文件。 +\item 参数设置 + +\begin{verbatim} + nameserver # 定义DNS服务器的IP地址 + domain # 定义本地域名 + search # 定义域名的搜索列表 + sortlist # 对返回的域名进行排序 +\end{verbatim} + +最主要是~\verb=nameserver=~关键字,如果没指定~\verb=nameserver=~找不到~DNS~服务器,其它关键字是可选的。 +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +nameserver 192.168.0.1 +domain linx-info.com +search www.linx-info.com +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{hostname~文件} +\begin{myitemize} +\item 路径 + +\verb+/etc/hostname+ +\item 作用 + +记录本机的主机名。 +\item 例样 + +该文件只有一行,如: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=Rocky= +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{services~文件} +\begin{myitemize} +\item 路径 + +\verb+/etc/services+ +\item 作用 + +Internet~网络服务文件,记录网络服务名和它们对应使用的端口号及协议。文件中的每一行对应一种服务,它由4个字段组成,中间用~\key{TAB}~或空格分隔,分别表示“服务名称”、“使用端口”、“协议名称”以及“别名”。 +\item 例样 + +下面是这个文件的节选内容: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +tcpmux 1/tcp # TCP port service multiplexer +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +msp 18/tcp # message send protocol +msp 18/udp +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp +ftp 21/tcp +fsp 21/udp fspd +ssh 22/tcp # SSH Remote Login Protocol +ssh 22/udp +telnet 23/tcp +smtp 25/tcp mail +time 37/tcp timserver +\end{verbatim} +\end{shaded} +\end{minipage} + +\hint{14cm}{一般情况下,不要修改该文件的内容,因为这些设置都是~Internet~标准的设置。一旦修改,可能会造成系统冲突,使用户无法正常访问资源。 + +Linux~系统的端口号的范围为~0~65535,不同范围有不同的意义。 +\begin{myitemize} + \item 0~~~~~~~~~~~~~~~~~~~~~~~~不使用 + \item 1~1023~~~~~~~~~~~~系统保留,只能由~root~用户使用 + \item 1024~4999~~~~~~由客户端程序自由分配 + \item 5000~65535~~~~由服务器端程序自由分配 +\end{myitemize}} +\end{myitemize} + +\subsection{hosts.allow~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/hosts.allow= +\item 作用 + +设置系统的外部连接许可 +\item 参数设置 + +\verb=: = +% \verb=程序名列表: 主机名/IP地址列表= + +\note{14cm}{\texttt{hosts.allow}~优先程度高于~\texttt{hosts.deny}} +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +sshd : 192.168.0.0/255.255.255.0 +# 允许~192.168.0~网段的客户端通过~sshd~服务访问服务器 +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{hosts.deny~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/hosts.deny= +\item 作用 + +设置系统的外部连接拒绝 +\item 参数设置 + +\verb=: = +% \verb=程序名列表: 主机名/IP地址列表= + +特殊参数与~\verb=hosts.allow=~相同 + +\note{14cm}{\texttt{hosts.deny}~优先程度低于~\texttt{hosts.allow}} +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\verb=ALL: ALL: DENY= +\end{shaded} +\end{minipage} +\end{myitemize} +\vspace{1cm} + +\note{15cm}{为了保持系统的安全性,请尽量不要修改本文件,如需设置其他客户端通过服务访问本机,只需在~\texttt{/etc/hosts.allow}~文件中设置允许即可。} + +\subsection{host.conf~文件} +\begin{myitemize} +\item 路径 + +\verb=/etc/host.conf= +\item 作用 + +设置系统的配置信息。当系统中同时存在~DNS~域名解析和~\verb=/etc/hosts=~主机表机制时,由~\verb=/etc/host.conf=~确定主机名解释顺序。 +\item 参数设置 + +文件包含了为解析库声明的配置信息,它应该每行含一个配置关键字,其后跟着合适的配置信息。 + +系统识别的关键字有~\verb=order=、\verb=trim=、\verb=multi=、\verb=nospoof=~和~\verb=reorder=。 +\begin{myitemize} +\item \verb=order= + +确定了主机查询是如何执行的。它后面应该跟随一个或者更多的查询方式,这些查询方式用逗号分隔。有效的方式有:\verb=bind=、\verb=hosts=~和~\verb=nis=。 +\item \verb=trim= + +可以多次出现。每次出现其后应该跟随单个的以句点开头的域名。如果设置了它,\verb=resolver=~库会自动截去任何通过~DNS~解析出来的主机名后面的域名。这个选项用于本地主机和域。 +\item \verb=multi= + +有效的值为~\verb=on=~和~\verb=off=。如果设置为~\verb=on=,\verb=resolver=~库会返回一台主机在~\verb=/etc/hosts=~文件中出现的的所有有效地址,而不只是第一个。默认情况下设为~\verb=off=。 +\item \verb=nospoof= + +有效的值为~\verb=on=~和~\verb=off=。如果设置为~\verb=on=,\verb=resolver=~库会尝试阻止主机名欺骗以提高使用~\verb=rlogin=~和~\verb=rsh=~的安全性。在执行了一个主机地址的查询之后,\verb=resolver=~会对该地址执行一次主机名的查询;如果两者不匹配,查询即失败。 +\item \verb=spoofalert= + +如果该选项设为~\verb=on=,同时也设置了~\verb=nospoof=~选项,\verb=resolver=~会通过~\verb=syslog=~设施记录错误报警信息,默认的值为~\verb=off=。 +\item \verb=reorder= + +有效的值为~\verb=on=~和~\verb=off=。如果设置为~\verb=on=,\verb=resolver=~会试图重新排列主机地址,以便执行~\verb=gethostbyname(3)=~时,首先列出本地地址(即在同一子网中的地址),重新排序适合于所有查询方式,默认的值为~\verb=off=。 +\end{myitemize} +\item 例样 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +order hosts,bind +multi on +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\subsection{ifconfig~命令} +您还可以使用~\verb=ifconfig=~命令来配置和查看网卡参数。 + +当有多块网卡时,系统中网卡命名规律:eth0,eth1,eth2……另外,lo~为环回接口,它的~IP~地址固定为~127.0.0.1,掩码~8~位。它代表你的机器本身。 + +\begin{myenumerate} +\item 查看网卡信息 + +\verb=ifconfig [Interface]= + +\verb=Interface=~是可选项,如果不加此项,则显示系统中所有网卡的信息。如果添加此选项则显示所指定的网卡信息。 + +如: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +$ ifconfig +eth0 Link encap:Ethernet HWaddr 00:11:D8:6D:C5:A1 + inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 + inet6 addr: fe80::211:d8ff:fe6d:c5a1/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:9771 errors:0 dropped:0 overruns:0 frame:0 + TX packets:8802 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:958022 (935.5 Kb) TX bytes:9606400 (9.1 Mb) + Interrupt:17 + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:824 errors:0 dropped:0 overruns:0 frame:0 + TX packets:824 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:374847 (366.0 Kb) TX bytes:374847 (366.0 Kb) +\end{verbatim} +\end{shaded} +\end{minipage} +\begin{myitemize} +\item \verb=Link encap= + +连接类型,\verb=Ethernet=~指以太网。 +\item \verb=HWaddr= + +硬件~mac~地址。 +\item \verb=inet addr= + +网卡的~IP~地址。 +\item \verb=Bcast= + +网卡的广播地址。 +\item \verb=Mask= + +网卡的子网掩码。 +\item \verb=inet6= + +网卡的~IPv6~地址。 +\item \verb=Scope= + +范围。 +\item \verb=UP BROADCAST RUNNING MULTICAST MTU:1500= + +接口的活动类型。 +\begin{myitemize} +\item \verb=UP = \quad 网卡开启状态 +\item \verb=BROADCAST= \quad 网卡支持广播 +\item \verb=RUNNING = \quad 网卡的网线被接上 +\item \verb=MULTICAST= \quad 网卡支持组播 +\item \verb=MTU:1500 = \quad 最大传输单元为~1500~字节 +\end{myitemize} +\item \verb=RX packets= + +接收数据包情况统计。 +\item \verb=TX packets= + +发送数据包情况统计。 +\item \verb=RX bytes= + +接收数据字节数统计信息。 +\item \verb=TX bytes= + +发送数据字节数统计信息。 +\end{myitemize} + +\item 选项 + +在~\verb=ifconfig=~命令中可以指定许多选项以改变其行为: +\begin{myitemize} +\item \verb=-a= + +该选项告诉~\verb=ifconfig=显示所有接口信息,包括活动的和非活动的。 +% 在~erebus~上,\verb=ifconfig -a=~返回~eth0、lo~和~sit0~的结果。 +\item \verb=-s= + +这是一个“短列表”选项,它为每个接口显示一行摘要数据。该返回信息是有关接口活动性的,并且没有配置。该输出和~\verb=netstat -i=~命令的返回内容是一样的。 +\item \verb=-v= + +这个“详细的”选项在满足某些类型的错误条件时返回额外信息以帮助发现并处理故障。 +\end{myitemize} +\item 配置网卡参数 + +除此之外,还有几个选项可以配置网卡参数。 +\begin{myitemize} +\item 配置网卡的~IP~地址 + +\verb=ifconifg [Interface] [addr]= + +只在接口名称后指定一个地址,将设置该接口的~IP~地址。 + +如,在~eth0~上配置~192.168.0.1~的~IP~地址,使用以下命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 192.168.0.1= +\end{shaded} +\end{minipage} + +若想在~eth0~上再配置一个~192.168.1.1/24~的~IP~地址,使用以下命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0:0 192.168.1.1= +\end{shaded} +\end{minipage} + +这时再用~\verb=ifconifg=~命令查看,就可以看到两个网卡的信息了,分别为~eth0~和~eth0:0。若还想再增加~IP,那网卡的命名就接着是~eth0:1、eth0:2…… +\item 配置网卡的子网掩码 + +\verb=ifconifg [Interface] netmask [addr]= + +使用“\verb=netmask=”选项使得你可以为一个给定接口设置网络掩码。 + +如,在~eth0~上配置~24~位掩码,使用以下命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 netmask 255.255.255.0= +\end{shaded} +\end{minipage} + +\item 配置网卡的广播地址 + +\verb=ifconifg [Interface] broadcast [addr]= + +当“\verb=broadcast=”选项后面跟随一个地址参数,那么将设置指定接口 的广播地址。 + +如,在~eth0~上配置广播地址为~192.168.0.255,使用以下命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 broadcast 192.168.0.255= +\end{shaded} +\end{minipage} +\item 配置网卡的硬件地址 + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx= +\end{shaded} +\end{minipage} +\item 启用网卡 + +\verb=ifconfig [Interface] up= + +如果一个接口不是活动的,该选项将激活它。 + +如,启动网卡~eth0: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 up= +\end{shaded} +\end{minipage} +\item 禁用网卡 + +\verb=ifconfig [Interface] down= + +与~\verb=up=~相反,它使指定接口无效。 + +如,禁用网卡~eth0: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ ifconfig eth0 down= +\end{shaded} +\end{minipage} +\end{myitemize} +\end{myenumerate} + +% \caution{15cm}{用~\texttt{ifconfig}~命令配置的网卡参数在机器重启后就丢失了。要想保存上述的配置信息,还是要修改网卡的配置文件。} + +\section{网络服务} +凝思安全操作系统提供下列网络服务: + +\begin{myitemize} + \item Apache + \item BIND + \item Samba +% \item Procmail +% \item postgresql + \item SSH + \item DHCP +\end{myitemize} + +所有服务都通过适当修改和配置,充分发挥了凝思安全操作系统的安全机制,能够完全防止缓冲器溢出攻击,大大增强了网络服务的安全性。 + +\begin{myenumerate} +\item 运行服务 + +以管理员用户登录,对所有网络服务可以进行配置、启动、停止。各服务的启动脚本位于~\verb=/etc/init.d/=~下。 +\begin{myenumerate} +\item 启动服务 + +例如,要启动~apache2~服务,以管理员登录,执行命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=/etc/init.d/apache2 start= +\end{shaded} +\end{minipage} +\item 停止服务 + +例如,要停止~apache2~服务,以管理员登录,执行命令: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=/etc/init.d/apache2 stop= +\end{shaded} +\end{minipage} +\end{myenumerate} +\item 设置开机自动启动 + +% 在~\verb=/etc/rc.d/rc3.d/=~中,建立相关服务的链接,并以“S~+~数字”开头。 +% +% 其中,S~表示赋与~sshd~脚本~start~参数,数字大小代表启动顺序的先后,数字大的启动顺序排在后面。 +% +% 例如,设置~sshd~服务开机自动启动: +% +% \begin{minipage}{14cm} +% \begin{shaded} +% \verb=ln -s /etc/rc.d/init.d/sshd /etc/rc.d/rc3.d/S205sshd= +% \end{shaded} +% \end{minipage} +% \end{myenumerate} + +下面以设置~apache2~服务开机自动启动为例。 + +将~apache2~启动脚本复制到~\verb=/etc/init.d=~目录下(一般安装软件时会自动装入,也可以手动复制),并命名为~apache2。 + +\begin{minipage}{15cm} +\begin{shaded} +\verb=cp /usr/sbin/apachectl /etc/init.d/apache2= +\end{shaded} +\end{minipage} + +查看系统的当前启动级别(系统默认为“N 2”)。 + +\begin{minipage}{15cm} +\begin{shaded} +\verb=runlevels= +\end{shaded} +\end{minipage} + +进入系统开机启动级别(例如“N 2”)目录,建立软件启动文件的符号链接。S~表示~start(启动),K~表示~kill(关闭),数字大小代表启动顺序的先后,数字大的启动顺序排在后面。 + +\begin{minipage}{15cm} +\begin{shaded} +\verb=cd /etc/rc2.d= + +\verb=ln -s /etc/init.d/apache2 S20apache2= +\end{shaded} +\end{minipage} + +这样,apache2~服务将在开机时自动启动。 + +\vspace{1cm} +您还可以使用~\verb=update-rc.d=~命令设置启动级别: + +\begin{enumerate} + \item 从(所有的)运行级别配置目录中是删除指定的服务(K~和~S) + +\begin{minipage}{15cm} +\begin{shaded} +\verb=update-rc.d -f remove= +\end{shaded} +\end{minipage} + \item 配置服务在运行级别列表中按指定的顺序启动 + +\begin{minipage}{15cm} +\begin{shaded} +\verb=update-rc.d start = +\end{shaded} +\end{minipage} + \item 配置服务在运行级别列表中指定的顺序停止 + +\begin{minipage}{15cm} +\begin{shaded} +\verb=update-rc.d stop = +\end{shaded} +\end{minipage} +\end{enumerate} + +例如: + +\begin{minipage}{15cm} +\begin{shaded} +\verb=$ update-rc.d -f apache2 remove= + +\verb=$ update-rc.d apache2 stop 91 0 1 2 3 4 5 6 .= + +(注意带着“.”) +\end{shaded} +\end{minipage} + +第一个命令移除了所有的指向~\verb=/etc/init.d/apache2=~服务脚本的运行级别链接,\verb=-f=~选项将会使得~\verb=update-rc.d=~在~apache2~脚本本身已经存在的情况下仍然进行相应的处理。 + +第二个命令在每一个运行级别创建了一个服务顺序为91的停止脚本。例如,这会创建一个~\verb=/etc/rc3.d/K91apache2=~的符号链接来禁止运行级别3中~apache2~的运行。(这里要注意的是要添加~reboot~与~shutdown~运行级别,即0和6,尽管其中所有的服务都会被设置成为 “stop”)。 + +作为另外的一个例子,下面所显示的命令将会在运行级别3、4、5允许~apache2~的运行,而在其他的运行级别中则被禁止: + +\begin{minipage}{14cm} +\begin{shaded} +\verb=$ update-rc.d -f apache2 remove= + +\verb=$ update-rc.d apache2 start 91 3 4 5 . stop 91 0 1 2 6 . = + +(注意带着“.”) +\end{shaded} +\end{minipage} + +\hint{14cm}{每个运行级别中,同一个服务的符号链接只能有一个要么~K~开头的要么~S~开头的,不能同时存在。} + +\end{myenumerate} + +\vspace{1cm} +下面逐一说明各个网络服务的配置。 + +\subsection{Apache} +\subsubsection{简介} +Apache~服务用于实现~WEB~服务,它是~Internet~网上应用最为广泛的~Web~服务器软件之一。Apache~服务器源自美国国家超级技术计算应用中心(NCSA)的~Web~服务器项目中。目前已在互联网中占据了领导地位。Apache~服务器经过配置之后,能适应高负荷,大吞吐量的互联网工作。 + +\subsubsection{配置文件} +Apache~的主配置文件~\verb=apache2.conf=~位于~\verb=/etc/apache2=~目录下,提供了最基本的服务器配置。这些配置文件控制着服务器各个方面的特性,因此,为了正常运行服务器便需要设置好这些文件。 +% \begin{myitemize} +% \item \verb=httpd.conf= +% +% 提供了最基本的服务器配置,描述了守护进程~httpd~如何运行; +% \item \verb=access.conf= +% +% 用于配置服务器的访问权限,控制不同用户和计算机的访问限制; +% \item \verb=srm.conf= +% +% 服务器的资源映射文件,告诉服务器各种文件的~MIME~类型,以及如何支持这些文件。 +% \end{myitemize} + +除了配置文件之外,Apache~还使用~\verb=mime.types=~文件用于标识不同文件对应的~MIME~类型,\verb=magic=~文件设置不同~MIME~类型文件的特殊标识,当~Apache~服务器从文档后缀不能判断出文件的~MIME~类型时,能通过文件内容中的这些特殊标记来判断文档的~MIME~类型。 + +在~\verb=apache2.conf=~中引用到了以下文件: + +\begin{itemize} + \item 动态模块的配置: + +\verb=/etc/apache2/mods-enabled/*.load= + +\verb=/etc/apache2/mods-enabled/*.conf= + \item 用户自己的配置: + +\verb=/etc/apache2/httpd.conf= + \item 端口监听的配置: + +\verb=/etc/apache2/ports.conf= + \item 一般性的配置语句片断: + +\verb=/etc/apache2/conf.d/= + \item 虚拟主机的配置指令: + +\verb=/etc/apache2/sites-enabled/= +\end{itemize} + +\subsubsection{配置文件参数} +\begin{myitemize} +\item \verb=ServerRoot “/usr”= +% \item \verb=ServerRoot= + +安装服务器的基础目录。 + +格式:\verb=ServerRoot directory-path= + +\verb=ServerRoot=~用于指定守护进程~httpd~的运行目录,httpd~启动之后会自动将进程的根目录改变为这个目录,因此如果设置文件中指定的文件或目录是相对路径,那么真实路径就位于这个~\verb=ServerRoot=~定义的路径之下。 +\item \verb=Listen 80= + +\noindent\verb=Listen 12.34.56.78:80= +% \item \verb=Listen 3000= +% +% \noindent\verb=Listen 12.34.56.78:80= + +服务器监听的~IP~地址和端口。 + +格式:\verb=Listen [IP-address:]portnumber [protocol]= + +\verb=Listen=~指示~Apache~只在指定的~IP~地址和端口上监听;默认情况下~Apache~会在所有~IP~地址上监听。\verb=Listen=~是必须设置的。如果在配置文件中找不到这个参数,服务器将无法启动。如果只指定一个端口,服务器将在所有地址上监听该端口。如果指定了地址和端口的组合,服务器将在指定地址的指定端口上监听。 + +使用多个~\verb=Listen=~可以指定多个不同的监听端口和/或地址端口组合。服务器将会对列出的所有端口和地址端口组合上的请求作出应答。 + +例如,想要服务器接受~80~和~8000~端口上的请求,可以这样设置: +\begin{verbatim} + Listen 80 + Listen 8000 +\end{verbatim} + +为了让服务器在两个确定的地址端口组合上接受请求,可以这样设置: +\begin{verbatim} + Listen 192.170.2.1:80 + Listen 192.170.2.5:8000 +\end{verbatim} + +IPv6~地址必须用方括号括起来: + +\verb=Listen [2001:db8::a00:20ff:fea7:ccea]:80= + +可选的~protocol~参数在大多数情况下并不需要。若未指定该参数,则将为~443~端口使用默认的~https~协议,为其它端口使用~http~协议。在这里指定协议是为了确定使用哪个模块来处理请求,以及根据~AcceptFilter~根据不同的协议有针对性的进行优化。 + +仅在使用非标准端口时才需要指定~protocol~参数。比如在~8443~端口运行~https~协议: + +\verb=Listen 192.170.2.1:8443 https= + +\note{14cm}{多个~\texttt{Listen}~指定了同一个地址和端口的组合后,会导致“Address already in use”错误。} +\item 模块 + +Apache~服务器的一个重要特性就是其模块化的结构,这不但表现在编译时能通过新的模块加入新的功能,还表现在运行时能动态加载入模块,而不必预先包含所有模块。使用~Apache~的动态加载模块只需要设置好~\verb=LoadModule=~参数就可以了,这种特性就是~Apache~的~DSO(Dynamic Shared Object)特性,然而要想充分使用~DSO~特性仍然不是一个简单的事情,不适当的改动这里的设置就可能造成服务器不能正常启动。因此如果不是要增加或减少服务器提供的功能,就不要改动这里的设置。 + +例如,编辑~\verb=/etc/apache2/httpd.conf=~文件内容如下: + +\begin{verbatim} + LoadModule authn_file_module lib/apache2/modules/mod_authn_file.so + LoadModule authn_dbm_module lib/apache2/modules//mod_authn_dbm.so + LoadModule authn_anon_module lib/apache2/modules/mod_authn_anon.so + LoadModule authn_dbd_module lib/apache2/modules/mod_authn_dbd.so + LoadModule authn_default_module lib/apache2/modules/mod_authn_default.so + LoadModule authz_host_module lib/apache2/modules//mod_authz_host.so + LoadModule authz_groupfile_module lib/apache2/modules/mod_authz_groupfile.so + LoadModule authz_user_module lib/apache2/modules/mod_authz_user.so + LoadModule authz_dbm_module lib/apache2/modules/mod_authz_dbm.so + LoadModule authz_owner_module lib/apache2/modules/mod_authz_owner.so + LoadModule authz_default_module lib/apache2/modules/mod_authz_default.so + LoadModule auth_basic_module lib/apache2/modules/mod_auth_basic.so + LoadModule auth_digest_module lib/apache2/modules/mod_auth_digest.so + LoadModule dbd_module lib/apache2/modules/mod_dbd.so + LoadModule dumpio_module lib/apache2/modules/mod_dumpio.so + LoadModule ext_filter_module lib/apache2/modules/mod_ext_filter.so + LoadModule include_module lib/apache2/modules/mod_include.so + LoadModule filter_module lib/apache2/modules/mod_filter.so + LoadModule substitute_module lib/apache2/modules/mod_substitute.so + LoadModule deflate_module lib/apache2/modules/mod_deflate.so + LoadModule log_forensic_module lib/apache2/modules/mod_log_forensic.so + LoadModule env_module lib/apache2/modules/mod_env.so + LoadModule mime_magic_module lib/apache2/modules/mod_mime_magic.so + LoadModule cern_meta_module lib/apache2/modules/mod_cern_meta.so + LoadModule expires_module lib/apache2/modules/mod_expires.so + LoadModule headers_module lib/apache2/modules/mod_headers.so + LoadModule ident_module lib/apache2/modules/mod_ident.so + LoadModule usertrack_module lib/apache2/modules/mod_usertrack.so + LoadModule unique_id_module lib/apache2/modules/mod_unique_id.so + LoadModule setenvif_module lib/apache2/modules/mod_setenvif.so + LoadModule version_module lib/apache2/modules/mod_version.so + LoadModule ssl_module lib/apache2/modules/mod_ssl.so + LoadModule mime_module lib/apache2/modules/mod_mime.so + LoadModule dav_module lib/apache2/modules/mod_dav.so + LoadModule status_module lib/apache2/modules/mod_status.so + LoadModule autoindex_module lib/apache2/modules/mod_autoindex.so + LoadModule asis_module lib/apache2/modules/mod_asis.so + LoadModule info_module lib/apache2/modules/mod_info.so + LoadModule cgi_module lib/apache2/modules/mod_cgi.so + LoadModule dav_fs_module lib/apache2/modules/mod_dav_fs.so + LoadModule vhost_alias_module lib/apache2/modules/mod_vhost_alias.so + LoadModule negotiation_module lib/apache2/modules/mod_negotiation.so + LoadModule dir_module lib/apache2/modules/mod_dir.so + LoadModule imagemap_module lib/apache2/modules/mod_imagemap.so + LoadModule actions_module lib/apache2/modules/mod_actions.so + LoadModule speling_module lib/apache2/modules/mod_speling.so + LoadModule userdir_module lib/apache2/modules/mod_userdir.so + LoadModule alias_module lib/apache2/modules/mod_alias.so + LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so + + LoadModule php5_module lib/apache2/modules//libphp5.so + + +\end{verbatim} + +上面这些列表就显示了凝思安全操作系统中可以支持的模块,事实上很多模块是没有必要的,不必要的模块不会被载入内存。模块可以静态连接到~Apache~服务器内部,也可以动态加载,这样就以很小的性能的代价,带来极大的灵活性。 + +但是动态可加载的能力还是对性能有轻微的影响,因此可以重新编译~Apache,将自己所需要的功能编译进~Apache~服务器内部,让系统显得更为干净,效率也有轻微的提高。通常仅仅为了这一个目的就重新编译~Apache~是没有必要的,如果需要增加其它特性而重新编译~Apache,不妨在增加其它模块的同时将所有的模块都静态连接入~Apache~服务器。有的使用者更喜欢动态加载模块,那么也不妨全部都使用动态加载模块。这些模块都被放置到~\verb=/usr/lib/apache2/modules/=~目录下,每个模块对应~Apache~服务器的一个特性。 +\item \verb=User httpd= + +\noindent\verb=Group httpd= +% \item \verb=User nobody= +% +% \noindent\verb=Group nogroup= + +User~和~Group~配置是~Apache~的安全保证,Apache~在打开端口之后,就将其本身设置为这两个选项设置的用户和组权限进行运行,这样就降低了服务器的危险性。凝思安全操作系统通过能力机制允许任何用户在任何端口上(可以小于1024)运行~Apache。 + +Apache~的缺省设置为~\verb=nobody=~和~\verb=nogroup=,这个用户和组在系统中不拥有文件,保证了服务器本身和由它启动的~CGI~进程没有权限更改文件系统。在某些情况下,例如为了运行~CGI~与~UNIX~交互,也需要让服务器来访问服务器上的文件,如果仍然使用~\verb=nobody=~和~\verb=nogroup=,那么系统中将会出现属于~\verb=nobody=~的文件,这对于系统安全是不利的,因为其它程序也会以~\verb=nobody=~和~\verb=nogroup=~的权限执行某些操作,就有可能访问这些~\verb=nobody=~拥有的文件,造成安全问题。一般情况下要为~Web~服务设定一个特定的用户和组,同时在这里更改用户和组设置。凝思安全操作系统缺省的~Apache~用户和组是~httpd~和~httpd。 +% \item \verb=ServerAdmin you@example.com= +\item \verb=ServerAdmin netadmin@localhost= + +配置文件中应该改变的也许只有~\verb=ServerAdmin=,这一项用于配置~WWW~服务器的管理员的~email~地址,这将在~HTTP~服务出现错误的条件下返回给浏览器,以便让~Web~使用者和管理员联系,报告错误。习惯上使用服务器上的~webmaster~作为~WWW~服务器的管理员,通过邮件服务器的别名机制,将发送给~webmaster~的电子邮件转发给真正的~Web~管理员。 +\item \verb=ServerName new.host.name:80= + +服务器用于辨识自己的主机名和端口号。 + +格式:\verb=ServerName [scheme://]fully-qualified-domain-name[:port]= + +\verb=ServerName=~设置了服务器用于辨识自己的主机名和端口号。这主要用于创建重定向~URL。 + +通常一个~Web~服务器可以具有多个名字,客户浏览器可以使用所有这些名字或~IP~地址访问这台服务器,但在没有定义虚拟主机的情况下,服务器总是以自己的正式名字回应浏览器。\verb=ServerName=~就定义了~Web~服务器自己承认的正式名字,例如一台服务器名字(在~DNS~中定义了~A~类型)为~exmaple.org.cn,同时为了方便记忆还定义了一个别名(CNAME~记录)为~www.exmaple.org.cn,那么~Apache~自动解析得到的名字就为~example.org.cn,这样不管客户浏览器使用哪个名字发送请求,服务器总是告诉客户程序自己为~example.org.cn。虽然这一般并不会造成什么问题,但是考虑到某一天服务器可能迁移到其它计算机上,而只想通过更改~DNS~中的~www~别名配置就完成迁移任务,所以不想让客户在其书签中使用~Linux~记录下这个服务器的地址,就必须使用~\verb=ServerName=~来重新指定服务器的正式名字。 + +当没有指定~\verb=ServerName=~时,服务器会尝试对~IP~地址进行反向查询来推断主机名。但如果服务器的名字解析有问题(通常为反向解析不正确),或者没有正式的~DNS~名字,也可以在这里指定~IP~地址。当~\verb=ServerName=~设置不正确的时候,服务器不能正常启动。如果在~\verb=ServerName=~中没有指定端口号,服务器会使用接受请求的那个端口。为了加强可靠性和可预测性,您应该使用~\verb=ServerName=~显式的指定一个主机名和端口号。 + +如果使用的是基于域名的虚拟主机,在~\verb==~段中的~\verb=ServerName=~将是为了匹配这个虚拟主机,在“\verb=Host:=”请求头中必须出现的主机名。 +\item \verb=DocumentRoot "/var/www/htdocs"= + +\verb=DocumentRoot=~定义这个服务器对外发布的超文本文档存放的路径,客户程序请求的~URL~就被映射为这个目录下的网页文件。这个目录下的子目录,以及使用符号连接指出的文件和目录都能被浏览器访问,只是要在~URL~上使用同样的相对目录名。 + +注意,符号连接虽然逻辑上位于根文档目录之下,但实际上可以位于计算机上的任意目录中,因此可以使客户程序能访问那些根文档目录之外的目录,这在增加了灵活性的同时减少了安全性。Apache~在目录的访问控制中提供了~\verb=FollowSymLinks=~选项来打开或关闭支持符号连接的特性。 +\item 文档访问控制 +\begin{verbatim} + + Options FollowSymLinks + AllowOverride None + Order deny, allow + Deny from all + +\end{verbatim} + +Apache~服务器可以针对目录进行文档的访问控制,然而访问控制可以通过两种方式来实现,一个是在设置文件~\verb=httpd.conf=中针对每个目录进行设置,另一个方法是在每个目录下设置访问控制文件,通常访问控制文件名字为~\verb=.htaccess=。虽然使用这两个方式都能用于控制浏览器的访问,然而第一种方法要求每次改动后重新启动~httpd~守护进程,比较不灵活,因此主要用于配置服务器系统的整体安全控制策略,而使用每个目录下的~\verb=.htaccess=~文件设置具体目录的访问控制更为灵活方便。 + +\verb=Directory=~语句就是用来定义目录的访问限制,这里可以看出它为一个目录定义访问限制的标准语法。上例的这个设置是针对系统的根目录进行的,设置了允许符号连接的选项~\verb=FollowSymLinks=,以及使用~\verb=AllowOverride None=~表示不允许这个目录下的访问控制文件改变这里进行的配置,这也意味着不用查看这个目录下的相应访问控制文件。 + +由于~Apache~对一个目录的访问控制设置是能够被下一级目录继承的,因此对根目录的设置将影响到它的下级目录。注意由于~\verb=AllowOverride None=~的设置,使得~Apache~服务器不需要查看根目录下的访问控制文件,也不需要查看以下各级目录下的访问控制文件,直至~\verb=httpd.conf=(或~\verb=access.conf=)中为某个目录指定了允许~\verb=Alloworride=,即允许查看访问控制文件。由于~Apache~对目录访问控制是采用的继承方式,如果从根目录就允许查看访问控制文件,那么~Apache~就必须一级一级的查看访问控制文件,对系统性能会造成影响。而缺省关闭了根目录的这个特性,就使得~Apache~从~\verb=httpd.conf=~中具体指定的目录向下搜寻,减少了搜寻的级数,增加了系统性能。因此对于系统根目录设置~\verb=AllowOverride None=~不但对于系统安全有帮助,也有益于系统性能。 +\item 目录访问位置 + +\begin{verbatim} + + Options Indexes FollowSymLinks + AllowOverride None + Order allow, deny + Allow from all + +\end{verbatim} + +这里定义的是系统对外发布文档的目录的访问设置,设置不同的~\verb=AllowOverride=~选项,以定义配置文件中的目录设置和用户目录下的安全控制文件的关系,而~\verb=Options=~选项用于定义该目录的特性。 + +\begin{myenumerate} + \item \verb=AllowOverride=~的设置 + +对每个目录访问控制文件作用的影响。 + +配置文件和每个目录下的访问控制文件都可以设置访问限制,设置文件是由管理员设置的,而每个目录下的访问控制文件是由目录的属主设置的,因此管理员可以规定目录的属主是否能覆盖系统在设置文件中的设置,这就需要使用~\verb=AllowOverride=~参数进行设置,通常可以设置的值为: +\begin{myitemize} + \item \verb=All= + +缺省值,使访问控制文件可以覆盖系统配置。 + \item \verb=None= + +服务器忽略访问控制文件的设置。 + \item \verb=Options= + +允许访问控制文件中可以使用~\verb=Options=~参数定义目录的选项。 + \item \verb=FileInfo= + +允许访问控制文件中可以使用~\verb=AddType=~等参数设置。 + \item \verb=AuthConfig= + +允许访问控制文件使用~\verb=AuthName=,\verb=AuthType=~等针对每个用户的认证机制,这使目录属主能用口令和用户名保护目录。 + \item \verb=Limit= + +允许对访问目录的客户机的IP地址和名字进行限制。 +\end{myitemize} + \item \verb=Options=~的设置 + +服务器特性设置。 + +每个目录具备一定属性,可以使用~\verb=Options=来控制这个目录下的一些访问特性设置,以下为常用的特性选项: +\begin{myitemize} + \item \verb=All= + +所有的目录特性都有效,这是缺省状态。 + \item \verb=None= + +所有的目录特性都无效。 + \item \verb=FollowSymLinks= + +允许使用符号连接,这将使浏览器有可能访问文档根目录(DocumentRoot)之外的文档。 + \item \verb=SymLinksIfOwnerMatch= + +只有符号连接的目的与符号连接本身为同一用户所拥有时,才允许访问,这个设置将增加一些安全性。 + \item \verb=ExecCGI= + +允许这个目录下可以执行~CGI~程序。 + \item \verb=Indexes= + +允许浏览器可以生成这个目录下所有文件的索引,使得在这个目录下没有~\verb=index.html=(或其它索引文件)时,能向浏览器发送这个目录下的文件列表。 +\end{myitemize} +\end{myenumerate} + +此外,上例中还使用了~\verb=Order=,\verb=Allow=,\verb=Deny=~等参数,这是~\verb=Limit=~语句中用来根据浏览器的域名和~IP~地址来控制访问的一种方式。其中~\verb=Order=~定义处理~\verb=Allow=~和~\verb=Deny=~的顺序,而~\verb=Allow=,\verb=Deny=~则针对名字或IP进行访问控制设置,上例使用~\verb=allowfrom all=,表示允许所有的客户机访问这个目录,而不进行任何限制。 +\item +\begin{verbatim} + + DirectoryIndex index.html + +\end{verbatim} + +很多情况下,URL~中并没有指定文档的名字,而只是给出了一个目录名。那么~Apache~服务器就自动返回这个目录下由~\verb=DirectoryIndex=~定义的文件,当然可以指定多个文件名字,系统会在这个目录下顺序搜索。当所有由~\verb=DirectoryIndex=~指定的文件都不存在时,Apache~服务器可以根据系统设置,生成这个目录下的所有文件列表,提供用户选择。此时该目录的访问控制选项中的~\verb=Indexes=~选项(\verb=Options Indexes=)必须打开,使得服务器能够生成目录列表,否则~Apache~将拒绝访问。 +\item \verb=AccessFileName .htaccess= + +\verb=AccessFileName=~定义每个目录下的访问控制文件的文件名,缺省为~\verb=.htaccess=,可以通过更改这个文件,来改变不同目录的访问控制限制。 + +\begin{verbatim} + + Order allow,deny + Deny from all + Satisfy All + +\end{verbatim} + +除了可以针对目录进行访问控制之外,还可以根据文件来设置访问控制,这就是~\verb=File=~语句的任务。使用~\verb=File=~语句,不管文件处于哪个目录,只要名字匹配,就必须接受相应的访问控制。这个语句对于系统安全比较重要,例如上例将屏蔽所有的使用者不能访问~\verb=.htaccess=文件,这样~\verb=.htaccess=~中的安全信息就不能被客户获取。 +\item 日志记录 +\begin{verbatim} + ErrorLog "/var/log/apache2/error_log" + LogLevel warn + + + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" + combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" + %I %O" combinedio + + + CustomLog "/var/log/apache2/access_log" common + +\end{verbatim} + +这里定义了系统日志的形式。对于服务器错误记录,由~\verb=ErrorLog=~指定记录错误日志的文件,\verb=LogLevel=~指定要记录的内容。 + +对于系统的访问日志,缺省使用~\verb=CustomLog=~参数定义日志的位置。可以使用~\verb=combined=~参数指定将所有的访问日志放在一个文件中,也可以将不同种类的访问日志放在不同的日志记录文件中,这是通过在~\verb=CustomLog=~中指定不同的记录类型来完成的。 +\begin{myitemize} +\item \verb=common=~表示普通的对单页面请求访问记录; +\item \verb=referer=~表示每个页面的引用记录,可以看出一个页面中包含的请求数; +\item \verb=agent=~表示对客户机的类型记录。 +\end{myitemize} + +显然可以将现有的~\verb=combined=~定义的设置行注释掉,并使用~\verb=common=、\verb=referer=~和~\verb=agent=~作为~\verb=CustomLog=~的参数,来为不同种类的日志分别指定日志记录文件。 + +显然,\verb=LogFormat=~是用于定义不同类型的日志进行记录时使用的格式,这里使用了以~\%~开头的宏定义,以记录不同的内容。如果这些参数指定的文件使用的是相对路径,那么就是相对于~\verb=ServerRoot=~的路径。 +\item 别名映射 + +\begin{verbatim} + + Alias /test "/var/www/htdocs/test" + + Options Indexes MultiViews + AllowOverride AuthConfig + Order allow,deny + Allow from all + + + ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" + + + + AllowOverride None + Options None + Order allow,deny + Allow from all + +\end{verbatim} + +\verb=Alias=~用于将~URL~与服务器文件系统中的真实位置进行直接映射,一般的文档将在~\verb=DocumentRoot=~中进行查询,然而使用~\verb=Alias=~定义的路径将直接映射到相应目录下,而不再到~\verb=DocumentRoot=~下面进行查询。因此~\verb=Alias=~可以用来映射一些公用文件的路径,例如保存了各种常用图标的~\verb=icons=~路径。这样使得除了使用符号连接之外,文档根目录( \verb=DocumentRoot=)外的目录也可以通过使用了~\verb=Alias=~映射,提供给浏览器访问。 + +定义好映射的路径之后,应该需要使用~\verb=Directory=~语句设置访问限制。 + +\verb=ScriptAlias=~也是用于~URL~路径的映射,但与~\verb=Alias=~的不同在于,\verb=ScriptAlias=~是用于映射~CGI~程序的路径,这个路径下的文件都被定义为~CGI~程序,通过执行它们获得结果,而不是由服务器直接返回其内容。缺省情况下~CGI~程序使用~\verb=cgi-bin=~目录作为虚拟路径。 + +\item \verb=DefaultType text/plain= + +如果~Web~服务器不能决定一个文档的缺省类型,这通常表示文档使用了非标准的后缀,那么服务器就使用~\verb=DefaultType=~定义的~MIME~类型将文档发送给客户浏览器。这里的设置为~\verb=text/plain=,这样设置的问题是,如果服务器不能判断出文档的~MIME,那么大部分情况下这个文档为一个二进制文档,但使用~\verb=text/plain=~格式发送回去,浏览器将在内部打开它而不会提示保存。因此建议将这个设置更改为~\verb=application/octet-stream=,这样浏览器将提示用户进行保存。 +\item MIME~文件 +\begin{verbatim} + + TypesConfig /etc/mime.types + + #AddType application/x-gzip .tgz + + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + + #AddHandler cgi-script .cgi + + #AddHandler type-map var + + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +\end{verbatim} + +\verb=TypeConfig=~用于设置保存不同的MIME类型数据的文件名,缺省设置为~\verb=/etc/mime.types=。 + +\verb=AddEncoding= + +\verb=AddType=~可以为特定后缀的文件指定~MIME~类型,这里的设置将覆盖~\verb=mime.types=~中的设置。 + +\verb=AddHandler=~是用于指定非静态的处理类型,用于定义文档为一个非静态的文档类型,需要进行处理,再向浏览器返回处理结果。例如上面注释中的设置是将以~\verb=.cgi=~结尾的文件设置为~\verb=cgi-script=~类型,那么服务器将启动这个~CGI~程序以进行处理。如果需要在前面~\verb=AliasScript=~定义的路径之外执行~CGI~程序,就需要使用这个参数进行设置,此后以~\verb=.cgi=~结尾的文件将被当作~CGI~程序执行。 + +\verb=AddOutputFilter= +\item +\begin{verbatim} + + MIMEMagicFile /etc/apache2/magic + +\end{verbatim} + +除了从文件的后缀出发来判断文件的~MIME~类型之外,Apache~还可以进一步分析文件的一些特征,来判断文件的真实~MIME~类型。这个功能是由~\verb=mod_mime_magic=~模块实现的,它需要一个记录各种~MIME~类型特征的文件,以进行分析判断。上面的设置是一个条件语句,如果载入了这个模块,就必须指定相应的标志文件~\verb=magic=~的位置。 +\item 错误代码 +\begin{verbatim} + #ErrorDocument 500 "The server made a boo boo." + #ErrorDocument 404 /missing.html + #ErrorDocument 404 /cgi-bin/missing_handler.pl + #ErrorDocument 402 http://some.other_server.com/subscription_info.html +\end{verbatim} + +如果客户请求的网页不存在,或者没有访问权限等情况发生时,服务器将产生一个错误代码,同时也将回应客户浏览器一个标识错误的网页。 + +\verb=ErrorDocument=~就用于设置当出现哪个错误时应该回应客户浏览器哪些内容,\verb=ErrorDocument=~的第一个参数为错误的序号,第二个参数为回应的数据,可以为简单的文本,本地网页,本地~CGI~程序,以及远程主机上的网页。 +\item \verb=Include= + +在服务器配置文件中包含其它配置文件。 + +格式:\verb=Include file-path|directory-path= + +这个参数允许在服务器配置文件中加入其它配置文件。 + +Shell~风格(\verb=fnmatch()=)的通配符可以用于按照字母顺序一次包含多个文件。另外,如果~\verb=Include=~指向了一个目录而不是一个文件,Apache~将读入该目录及其子目录下的所有文件,并依照字母顺序将这些文件作为配置文件进行解析。但是并不推荐这么做,因为偶尔会有临时文件在这个目录中生成,从而导致~httpd~启动失败。 + +文件的路径可以是一个完整的绝对路径(以一个斜杠开头),如: + +\begin{verbatim} + Include /etc/apache2/mods-available/ssl.conf + Include /etc/apache2/mods-enabled/*.conf +\end{verbatim} + +或是相对于~\verb=ServerRoot=目录(假设为~\verb=/etc/apache2/=)的相对路径,如: + +\begin{verbatim} + Include mods-available/ssl.conf + Include mods-enabled/*.conf +\end{verbatim} + +请确保包含的目录中不包含任何诸如编辑器临时文件等引起误导的文件,因为~Apache~会尝试读取它们并把其中的内容作为配置参数来处理,这样可能会导致启动过程的失败。运行~\verb=apachectl configtest=~将会把配置检查时所使用的所有文件列出来以供参考。这将有助于检验配置中是否仅包含了您所希望出现那些文件。 + +这个参数~\verb=Include=~可用于与使用~\verb=srm.conf=~和~\verb=access.conf=设置文件的老版本~Apache~兼容。如果没有兼容的需要,可以将设置文件指定为~\verb=/dev/null=~,即~\verb=Include /dev/null=,这将表示不存在其它设置文件,而仅使用~\verb=apache2.conf=~一个文件来保存所有的设置选项。 +\item \verb=PidFile "/var/run/apache2/httpd.pid"= + +\verb=PidFile=~指定的文件将记录~httpd~守护进程的进程号,由于~httpd~能自动复制其自身,因此系统中有多个~httpd~进程,但只有一个进程为最初启动的进程,它为其它进程的父进程,对这个进程发送信号将影响所有的~httpd~进程。\verb=PidFILE=~定义的文件中就记录~httpd~父进程的进程号。 +\item \verb=LockFile "/var/log/apache2/accept.lock"= + +接受串行锁文件的位置。 + +由于~httpd~会经常进行并发的文件操作,就需要使用加锁的方式来保证文件操作不冲突,由于~NFS~文件系统在文件加锁方面能力有限,因此这个目录应该是本地磁盘文件系统,而不应该使用~NFS~文件系统。 + +\verb=LockFile=~指定了~httpd~守护进程的加锁文件,一般不需要设置这个参数,Apache~服务器将自动在~\verb=ServerRoot=~下面的路径中进行操作。但如果~\verb=ServerRoot=~为~NFS~文件系统,便需要使用这个参数指定本地文件系统中的路径。 + +\important{14cm}{最好不要将此文件放在任何人都可以具有写权限的目录(比如~\texttt{/var/tmp})中,因为别人可以通过建立一个与服务器企图建立的锁文件同名的文件,来阻止服务器启动,从而造成一个拒绝服务攻击。} +\item \verb=StartServers 5= + +\verb=StartServers=~就是用来设置~httpd~启动时产生的子进程副本数量,这个参数与上面定义的~\verb=MinSpareServers=~和~\verb=MaxSpareServers=~相关,都是用于启动空闲子进程以提高服务器的反应速度的。这个参数应该设置为前两个值之间的一个数值,小于~\verb=MinSpareServers=~和大于~\verb=MaxSpareServers=~都没有意义。 +\item \verb=MinSpareServers 5= + +\noindent\verb=MaxSpareServers 10= + +在使用子进程处理~HTTP~请求的~Web~服务器上,由于要首先生成子进程才能处理客户的请求,因此反应时间就有一些延迟。Apache~服务器使用了一个特殊技术解决这个问题,这就是预先生成多个空余的子进程驻留在系统中,一旦有请求出现,就立即使用这些空余的子进程进行处理,这样就不存在生成子进程造成的延迟了。在运行中随着客户请求的增多,启动的子进程会随之增多,但这些服务器副本在处理完一次~HTTP~请求之后并不立即退出,而是停留在计算机中等待下次请求。但是空余的子进程副本不能只增加不减少,太多的空余子进程没有处理任务,也占用服务器的处理能力,因此就要限制空余副本的数量,使其保持一个合适的范围,这样既能及时回应客户请求,又能减少不必要的进程数量。 + +因此就可以使用~\verb=MinSpareServers=~来设置最少的空余子进程数量,以及使用~\verb=MaxSpareServers=~来限制最多的空闲子进程数量,多余的服务器进程副本就会退出。根据服务器的实际情况来进行设置,如果服务器性能较高,并且也被频繁访问,就应该增大这两个参数的设置。对于高负载的专业网站,这两个值应该大致相同,并且等同于系统支持的最多服务器副本数量,也减少不必要的副本退出。 +\item \verb=MaxClients 150= +% \item \verb=MaxClients 256= + +在另一方面,服务器的能力毕竟是有限的,不可能同时处理无限多的连接请求,因此~\verb=Maxclients=~就用于规定服务器支持的最多并发访问的客户数,如果这个值设置得过大,系统在繁忙时不得不在过多的进程之间进行切换,这样就会减慢对每个客户的反应,并降低了整体的效率。如果这个值设置的较小,那么系统繁忙时就会拒绝一些客户的连接请求,并将其放入请求队列。当服务器性能较高时,就可以适当增加这个值的设置。对于专业网站,应该使用提高服务器效率的策略,因此这个参数不能超过硬件本身的限制,如果频繁出现拒绝访问现象,就说明需要升级服务器硬件了。对于非专业网站,不太在意对客户浏览器的反应速度,或者认为反应速度较慢也比拒绝连接好,就也可以略微超过硬件条件来设置这个参数。 +% \item \verb=MaxRequestsPerChild 0= +\item \verb=MaxRequestsPerChild 30= + +使用子进程的方式提供服务的~Web~服务器,常用的方式是一个子进程为一次连接服务,这样造成的问题就是每次连接都需要进行生成和退出子进程的系统操作,使得这些额外的处理过程占据了计算机的大量处理能力。因此最好的方式是一个子进程可以为多次连接请求服务,这样就不需要这些生成和退出进程的系统消耗,Apache~就采用了这样的方式,一次连接结束后,子进程并不退出,而是停留在系统中等待下一次服务请求,这样就极大的提高了性能。 + +但由于在处理过程中子进程要不断的申请和释放内存,次数多了就会造成一些内存垃圾,从而影响系统的稳定性,浪费不必要的系统资源。因此在一个副本处理过一定次数的请求之后,就可以让这个子进程副本退出,再从原始的~httpd~进程中重新复制一个干净的副本,这样就能提高系统的稳定性。每个子进程处理服务请求次数由~\verb=MaxRequestPerChild=~定义。缺省的设置值为30,这个值对于具备高稳定性特点的~Linux~系统来讲是过于保守的设置,可以设置为~1000~甚至更高,设置为~0~支持每个副本进行无限次的服务处理。 +\item 索引和图标 + +\begin{verbatim} + IndexOptions FancyIndexing HTMLTable VersionSort + + Alias /icons/ "/var/www/icons/" + + + Options Indexes MultiViews + AllowOverride None + Order allow,deny + Allow from all + + + AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip + + AddIconByType (TXT,/icons/text.gif) text/* + AddIconByType (IMG,/icons/image2.gif) image/* + AddIconByType (SND,/icons/sound2.gif) audio/* + AddIconByType (VID,/icons/movie.gif) video/* + + AddIcon /icons/binary.gif .bin .exe + AddIcon /icons/binhex.gif .hqx + AddIcon /icons/tar.gif .tar + AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv + AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip + AddIcon /icons/a.gif .ps .ai .eps + AddIcon /icons/layout.gif .html .shtml .htm .pdf + AddIcon /icons/text.gif .txt + AddIcon /icons/c.gif .c + AddIcon /icons/p.gif .pl .py + AddIcon /icons/f.gif .for + AddIcon /icons/dvi.gif .dvi + AddIcon /icons/uuencoded.gif .uu + AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl + AddIcon /icons/tex.gif .tex + AddIcon /icons/bomb.gif core + + AddIcon /icons/back.gif .. + AddIcon /icons/hand.right.gif README + AddIcon /icons/folder.gif ^^DIRECTORY^^ + AddIcon /icons/blank.gif ^^BLANKICON^^ + + DefaultIcon /icons/unknown.gif + + #AddDescription "GZIP compressed document" .gz + #AddDescription "tar archive" .tar + #AddDescription "GZIP compressed tar archive" .tgz + + ReadmeName README.html + HeaderName HEADER.html + + IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t +\end{verbatim} + +当一个~HTTP~请求的~URL~为一个目录的时候,服务器返回这个目录中的索引文件。但如果一个目录中不存在缺省的索引文件,并且该服务器又许可显示目录文件列表的时候,就会显示出这个目录中的文件列表,为了使得这个文件列表能具有可理解性,而不仅仅是一个简单的列表,就需要前面的这些设置参数。 + +如果使用了~\verb=IndexOptions FancyIndexing=~选项,可以让服务器产生的目录列表中针对各种不同类型的文档引用各种图标。而哪种文件使用哪种图标,则使用下面的~\verb=AddIconByEncoding=,~\verb=AddIconByType=~以及~\verb=AddIcon=~来定义,分别依据~MIME~的编码,类型以及文件的后缀来判断使用何种图标。如果不能确定文档使用的图标,就使用~\verb=DefaultIcon=~定义的缺省图标。 + +同样,使用~\verb=AddDescription=~可以为不同类型的文档加入不同的描述。服务器还在目录下,查询使用~\verb=ReadmeName=~和~\verb=HeaderName=~定义的文件(自动加上~\verb=.html=~后缀,如果没有发现,再使用~\verb=.txt=~后缀进行搜索),如果发现了这些文件,就在文件列表之前首先显示这些文件的内容,以使得普通目录列表具备更大的可理解性。 + +\verb=IndexIgnore=~让服务器在列出文件列表时忽略相应的文件, 这里使用模式配置的方式定义文件名。 +\item 语言设置 + +\begin{verbatim} + AddLanguage ca .ca + AddLanguage cs .cz .cs + AddLanguage da .dk + AddLanguage de .de + AddLanguage el .el + AddLanguage en .en + AddLanguage eo .eo + AddLanguage es .es + AddLanguage et .et + AddLanguage fr .fr + AddLanguage he .he + AddLanguage hr .hr + AddLanguage it .it + AddLanguage ja .ja + AddLanguage ko .ko + AddLanguage ltz .ltz + AddLanguage nl .nl + AddLanguage nn .nn + AddLanguage no .no + AddLanguage pl .po + AddLanguage pt .pt + AddLanguage pt-BR .pt-br + AddLanguage ru .ru + AddLanguage sv .sv + AddLanguage tr .tr + AddLanguage zh-CN .zh-cn + AddLanguage zh-TW .zh-tw + + LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl + nn no pl pt pt-BR ru sv tr zh-CN zh-TW + + ForceLanguagePriority Prefer Fallback + + AddCharset us-ascii.ascii .us-ascii + AddCharset ISO-8859-1 .iso8859-1 .latin1 + AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen + AddCharset ISO-8859-3 .iso8859-3 .latin3 + AddCharset ISO-8859-4 .iso8859-4 .latin4 + AddCharset ISO-8859-5 .iso8859-5 .cyr .iso-ru + AddCharset ISO-8859-6 .iso8859-6 .arb .arabic + AddCharset ISO-8859-7 .iso8859-7 .grk .greek + AddCharset ISO-8859-8 .iso8859-8 .heb .hebrew + AddCharset ISO-8859-9 .iso8859-9 .latin5 .trk + AddCharset ISO-8859-10 .iso8859-10 .latin6 + AddCharset ISO-8859-13 .iso8859-13 + AddCharset ISO-8859-14 .iso8859-14 .latin8 + AddCharset ISO-8859-15 .iso8859-15 .latin9 + AddCharset ISO-8859-16 .iso8859-16 .latin10 + AddCharset ISO-2022-JP .iso2022-jp .jis + AddCharset ISO-2022-KR .iso2022-kr .kis + AddCharset ISO-2022-CN .iso2022-cn .cis + AddCharset Big5.Big5 .big5 .b5 + AddCharset cn-Big5 .cn-big5 + + AddCharset WINDOWS-1251 .cp-1251 .win-1251 + AddCharset CP866 .cp866 + AddCharset KOI8 .koi8 + AddCharset KOI8-E .koi8-e + AddCharset KOI8-r .koi8-r .koi8-ru + AddCharset KOI8-U .koi8-u + AddCharset KOI8-ru .koi8-uk .ua + AddCharset ISO-10646-UCS-2 .ucs2 + AddCharset ISO-10646-UCS-4 .ucs4 + AddCharset UTF-7 .utf7 + AddCharset UTF-8 .utf8 + AddCharset UTF-16 .utf16 + AddCharset UTF-16BE .utf16be + AddCharset UTF-16LE .utf16le + AddCharset UTF-32 .utf32 + AddCharset UTF-32BE .utf32be + AddCharset UTF-32LE .utf32le + AddCharset euc-cn .euc-cn + AddCharset euc-gb .euc-gb + AddCharset euc-jp .euc-jp + AddCharset euc-kr .euc-kr + AddCharset EUC-TW .euc-tw + AddCharset gb2312 .gb2312 .gb + AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2 + AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4 + AddCharset shift_jis .shift_jis .sjis +\end{verbatim} + +\verb=AddLanguage=~在文件扩展名与特定的语言之间建立映射。定义以~\verb=extension=~为扩展名的文件是以~MIME-lang~语言写成的。这个映射关系会添加在所有有效的映射关系上,并覆盖所有相同的~\verb=extension=~扩展名映射。虽然内容的语言会返回给客户端,但浏览器一般未必会使用这一信息。\verb=AddLanguage=~更多的用于内容协商,以决定哪个文档应当被返回给用户。如果同一个扩展名被赋予多个语言,那么使用最后出现的那个。 + +在处理~\verb=MultiViews=~请求时,\verb=LanguagePriority=~在客户没有指示语言偏爱的情况下,设定语言变体的优先级列表。这个~MIME-lang~列表是按优先级降序排列的。 + +\note{14cm}{本参数只在根据其它信息无法决定最好的语言或者~\texttt{ForceLanguagePriority}~不是~\texttt{None}~时才有效。对正确实现的~HTTP/1.1~请求,本参数没有任何作用。} + +\verb=ForceLanguagePriority=~使用~\verb=LanguagePriority=~的设置,在服务器无法返回单个匹配文档的情况下,指定完成协商过程的方法。\verb=ForceLanguagePriority Prefer=~在有几个等价选择的情况下,使用~\verb=LanguagePriority=~的设定以提供一个有效的结果,而不是返回~HTTP~结果~300(多重选择)。\verb=ForceLanguagePriority Fallback=~使用~\verb=LanguagePriority=~在无法找到合适结果的情况下,指定一个有效的结果,而不是返回~HTTP~结果~406(不可接受)。\verb=Prefer=~和~\verb=Fallback=~两个选项可以同时指定,这样在有一个以上有效变体的情况下,返回~\verb=LanguagePriority=~列表中第一个匹配的变体文档,而在没有变体能够匹配客户可接受的语言的情况下,返回第一个可用的变体文档。 + +\verb=AddCharset=~在特定的文件扩展名与特定的字符集之间建立映射。\verb=charset=~是以~\verb=extension=~为扩展名的文件的MIME字符集参数。这个映射关系会强制添加在所有现存的映射关系上,并覆盖所有现存的~\verb=extension=~扩展名映射。\verb=AddCharset=~除了用于通知客户端文档的字符集编码方式以便正确地翻译和显示以外,还用于内容协商(根据用户的优先选择信息,从几个文档中选择一个返回给用户)。\verb=extension=~参数是大小写无关的,并且可以带或不带前导点。 +\item 多用户主页设置 + +\verb=UserDir public_html= + +当在一台~Linux~上运行~Apache~服务器时,这台计算机上的所有用户都可以有自己的网页路径,形如~http://example.org.cn/\textasciitilde user,使用波浪符号加上用户名就可以映射到用户自己的网页目录上。映射目录为用户个人主目录下的一个子目录,其名字就用~\verb=UseDir=~这个参数进行定义,缺省为~\verb=public_html=。如果不想为正式的用户提供网页服务,使用~\verb=DISABLED=~作~\verb=UserDir=~的参数即可。 + +\item +\begin{verbatim} + + AllowOverride FileInfo AuthConfig Limit Indexes + Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec + + Order allow, deny + Allow from all + + + Order deny, allow + Deny from all + + +\end{verbatim} + +这里可以看到~\verb=Directory=~的另一个用法,即可以通过简单的模式匹配方法,针对分布在不同目录下的子目录定义访问控制权限。这样设置需要~Apache~服务器对每个路径进行额外的处理,因此就会降低服务器的性能,所以缺省情况并没有打开这种访问限制。 + +这里可以看到另外一个语句~\verb=Limit=,\verb=Limit=~语句就是用来针对具体的请求方法来设定访问控制的,其中可以使用~\verb=GET=,\verb=POST=~等各种服务器支持的请求方法做~\verb=Limit=~的参数,设定不同请求方法的访问限制。一般可以打开对~\verb=GET=,\verb=POST=,~\verb=HEAD=三种请求方法,而屏蔽其它的请求方法,以增加安全性。\verb=Limit=~语句中,可以用~\verb=Order=、\verb=Allow=、\verb=Deny=,\verb=Allow=~和~\verb=Deny=~中可以使用匹配的方法针对域名和~IP~进行限制,只是对于域名是从后向前匹配,对于~IP~地址则从前向后匹配。 +\item 访问控制 +\begin{verbatim} + + SetHandler server-status + Order deny, allow + Deny from all + Allow from .your_domain.com + + + + SetHandler server-info + Order deny,allow + Deny from all + Allow from .your_domain.com + +\end{verbatim} + +用于设置访问控制的设置主要是针对目录和文件进行设置的,然而也可以针对不同的~URL~进行访问控制的设置,这样就不必担心~\verb=ScriptAlias=~,\verb=Alias=~是否将路径设置到了受控制的目录之外。针对~URL~进行控制的语句为~\verb=Location=,这样不但能对服务器上的文件,~CGI~提供保护,此外,它还能保护不能找到对应文件,而是由服务器本身提供的特殊功能~URL。http://servername/server-status~用于报告当前~Apache~服务器的状态,http://servername/server-info~用于报告~Apache~服务器的统计信息。与此相关的设置还有~\verb=ExtendedStatus=~,可以让服务器输出更详细的的报告。 +\item \verb=ExtendedStatus On= + +Apache~服务器可以通过特殊的~HTTP~请求报告自身的运行状态,打开这个~\verb=ExtendedStatus=~可以让服务器报告更全面的运行状态信息。 +\item 虚拟主机 +\begin{verbatim} + NameVirtualHost *:80 + + + ServerAdmin webmaster@dummy-host.example.com + DocumentRoot "/usr/docs/dummy-host.example.com" + ServerName dummy-host.example.com + ServerAlias www.dummy-host.example.com + ErrorLog "/var/log/apache2/dummy-host.example.com-error_log" + CustomLog "/var/log/apache2/dummy-host.example.com-access_log" common + + + + ServerAdmin webmaster@dummy-host2.example.com + DocumentRoot "/usr/docs/dummy-host2.example.com" + ServerName dummy-host2.example.com + ErrorLog "/var/log/apache2/dummy-host2.example.com-error_log" + CustomLog "/var/log/apache2/dummy-host2.example.com-access_log" common + +\end{verbatim} + +缺省设置文件中的这些内容是用于设置命名基础的虚拟主机服务器时使用。 + +其中~\verb=NameVirtualHost=~用来指定虚拟主机使用的~IP~地址,这个~IP~地址将对应多个~DNS~名字,如果~Apache~使用了~\verb=Listen=~控制了多个端口,那么就可以在这里加上端口号以进一步进行区分对不同端口的不同连接请求。此后,使用~\verb=VirtualHost=~语句,使用~\verb=NameVirtualHost=~指定的~IP~地址作参数,对每个名字都定义对应的虚拟主机设置。 + +虚拟主机是在一台~Web~服务器上,可以为多个单独域名提供~Web~服务,并且每个域名都完全独立,包括具有完全独立的文档目录结构及设置,这样域名之间完全独立,不但使用每个域名访问到的内容完全独立,并且使用另一个域名无法访问其它域名提供的网页内容。 + +虚拟主机的概念对于~ISP~来讲非常有用,因为虽然一个组织可以将自己的网页挂在具备其它域名的服务器上的下级网址上,但使用独立的域名和根网址更为正式,易为众人接受。传统上,必须自己设立一台服务器才能达到单独域名的目的,然而这需要维护一个单独的服务器,很多小单位缺乏足够的维护能力,更为合适的方式是租用别人维护的服务器。ISP也没有必要为一个机构提供一个单独的服务器,完全可以使用虚拟主机能力,使服务器为多个域名提供~Web~服务,而且不同的服务互不干扰,对外就表现为多个不同的服务器。 + +有两种设定虚拟主机的方式,一种是基于~HTTP 1.0~标准,需要一个具备多~IP~地址的服务器,再配置~DNS~服务器,给每个~IP~地址以不同的域名,最后才能配置~Apache~的配置文件,使服务器对不同域名返回不同的~Web~文档。由于这需要使用额外的~IP~地址,对每个要提供服务的域名都要使用单独的~IP~地址,因此这种方式实现起来问题较多。 + +可以在一个网络界面上绑定多个~IP~地址,Linux~下需要使用~\verb=ifconfig=~的~\verb=alias=~来进行这个配置,但此时会影响网络性能。 + +HTTP 1.1~标准在协议中规定了对浏览器和服务器通信时,服务器能够跟踪浏览器请求的是哪个主机名字。因此可以利用这个新特性,使用更轻松的方式设定虚拟主机。这种方式不需要额外的~IP~地址,但需要新版本的浏览器支持。这种方式已经成为建立虚拟主机的标准方式。 + +要建立非~IP~基础的虚拟主机,多个域名是不可少的配置,因为每个域名对应一个要服务的虚拟主机。因此需要更改~DNS~服务器的配置,为服务器增加多个~\verb=CNAME=~选项,如: +\begin{verbatim} + linux IN A 192.168.1.64 + vhost1 IN CNAME linux + vhost2 IN CNAME linux +\end{verbatim} + +基本的设置选项都是为了~Linux~主机设定的,如果要为~\verb=vhost1=~和~\verb=vhost2=~设定虚拟主机,就要使用~\verb=VirtualHost=~语句定义不同的选项,在语句中可以使用配置文件前面中的大部分选项,而可以重新定义几乎所有的针对服务器的设置。 +\begin{verbatim} + DocumentRoot "/var/www/htdocs" + ServerName localhost + ServerAdmin root@localhost + ErrorLog /var/log/httpd/error_log + TransferLog /var/log/httpd/access_log +\end{verbatim} + +这里需要注意的是,\verb=VirtualHost=~的参数地址一定要和~\verb=NameVirtualHost=~定义的地址相一致,必须保证所有的值严格一致,Apache~服务器才承认这些定义是为这个~IP~地址定义的虚拟主机。 + +此外,定义过~\verb=NameVirtualHost=~之后,那么对这个~IP~地址的访问都被区分不同的虚拟主机进行处理,而对其它~IP~地址的访问,例如~127.0.0.1,才应用前面定义的缺省选项。 +\item 特性支持 +\begin{verbatim} + BrowserMatch "Mozilla/2" nokeepalive + BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 + BrowserMatch "RealPlayer 4\.0" force-response-1.0 + BrowserMatch "Java/1\.0" force-response-1.0 + BrowserMatch "JDK/1\.0" force-response-1.0 + BrowserMatch "Microsoft Data Access Internet Publishing Provider" + redirect-carefully + BrowserMatch "MS FrontPage" redirect-carefully + BrowserMatch "^WebDrive" redirect-carefully + BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully + BrowserMatch "^gnome-vfs/1.0" redirect-carefully + BrowserMatch "^XML Spy" redirect-carefully + BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully +\end{verbatim} + +\verb=BrowserMatch=~为特定的客户程序,设置特殊的参数,以保证对老版本浏览器的兼容性,并支持新浏览器的新特性。 + +\item \verb=Timeout 300= + +\verb=Timeout=~定义客户程序和服务器连接的超时间隔,超过这个时间间隔(秒)后服务器将断开与客户机的连接。 + +\item \verb=KeepAlive On= + +在~HTTP 1.0~中,一次连接只能作传输一次~HTTP~请求,而~\verb=KeepAlive=~用于支持~HTTP 1.1~版本的一次连接,多次传输功能,这样就可以在一次连接中传递多个~HTTP~请求。虽然只有较新的浏览器才支持这个功能,但还是打开这个选项。打开的结果是允许用户建立永久连接。 +\item \verb=MaxKeepAliveRequests 100= +% \item \verb=MaxKeepAliveRequests 0= + +\verb=MaxKeepAliveRequests=~为一次连接可以进行的~HTTP~请求的最大次数。将其值设为~0~将支持在一次连接内进行无限次的传输请求。事实上没有客户程序在一次连接中请求太多的页面,通常达不到这个上限就完成连接了。 +% \item \verb=KeepAliveTimeout 5= +\item \verb=KeepAliveTimeout 15= + +\verb=KeepAliveTimeout=~测试一次连接中的多次请求传输之间的时间,如果服务器已经完成了一次请求,但一直没有接收到客户程序的下一次请求,在间隔超过了这个参数设置的值之后,服务器就断开连接。 +% \item \verb=UseCanonicalName Off= +\item \verb=UseCanonicalName On= + +打开~\verb=UseCanonicalName=~是~Web~服务器的标准做法,因为客户发送的大部分请求都是对本服务器的引用,这样服务器就能使用~\verb=ServerName=~和~\verb=Port=~选项的设置内容构建完整的~URL,并回应客户,使浏览器能得到规范的~URL。如果将这个参数设置为~\verb=Off=,那么~Apache~将使用从客户请求中获得服务器的名字和端口值(支持~HTTP 1.1~的客户的请求中将会有这些信息),重新构建~URL。 +\item \verb=AccessFileName .htaccess= + +分布式配置文件的名字。如果为某个目录启用了分布式配置文件功能,那么在向客户端返回其中的文档时,服务器将在这个文档所在的各级目录中查找此配置文件。 +\item \verb=ServerTokens Full= + +这个参数控制了服务器回应给客户端的“\verb=Server:=”应答头是否包含关于服务器操作系统类型和编译进的模块描述信息。 + +\begin{myitemize} + \item \verb=ServerTokens Prod[uctOnly]= + +服务器会发送(比如):\verb=Server: Apache= + \item \verb=ServerTokens Major= + +服务器会发送(比如):\verb=Server: Apache/2= + \item \verb=ServerTokens Minor= + +服务器会发送(比如):\verb=Server: Apache/2.0= + \item \verb=ServerTokens Min[imal]= + +服务器会发送(比如):\verb=Server: Apache/2.0.41= + \item \verb=ServerTokens OS= + +服务器会发送(比如):\verb=Server: Apache/2.0.41 (Unix)= + \item \verb=ServerTokens Full=(或未指定) + +服务器会发送(比如):\verb=Server: Apache/2.0.41 (Unix) PHP/4.3.2 MyMod/1.2= +\end{myitemize} + +此设置将作用于整个服务器,而且不能用在虚拟主机的配置段中。这个参数还控制着~\verb=ServerSignature=~的显示内容。 +\item \verb=ServerSignature On= + +一些情况下,例如当客户请求的网页并不存在时,服务器将产生错误文档,缺省情况下由于打开了~\verb=ServerSignature=~选项,错误文档的最后一行将包含服务器的名字,Apache~的版本等信息。有的管理员更倾向于不对外显示这些信息,就可以将这个参数设置为~\verb=Off=,或者设置为~\verb=Email=,最后一行将替换为对~\verb=ServerAdmin=~的~\verb=Email=~提示。 + +\verb=HostnameLookups Off= + +此参数启用了~DNS~查询,使得主机名能被记入日志(并用~\verb=REMOTE_HOST=~变量传递给~CGI/SSI)。参数~\verb=Double=~指定进行一次双向~DNS~查询。也就是说在一次反向查询之后,再对返回的结果进行一次正向查询。在正向查询结果中至少应该有一个~ip~地址与初始的地址相符。 + +不论此处如何设置,当您使用~\verb=mod_authz_host=~来根据主机名控制访问的时候,就会执行一次双向查询。这对安全来说非常必要。请注意如果您没有设置~\verb=HostnameLookups Double=,这种双向查询的结果不是自动生成的。比如说:如果仅仅设置了~\verb=HostnameLookups On=~而且请求是针对一个根据主机名做了限制的对象,不论双向查询是否失败,CGI~还是会把单向查询的结果用~\verb=REMOTE_HOST=~来传送。 + +默认值设置为~\verb=Off=~是为了那些不需要进行反向查询的站点节约网络带宽考虑的。这对最终用户也是有益的,因为这样他们就不用忍受查询造成的延迟了。高访问量的网站应该将此参数设置为~\verb=Off=~因为~DNS~查询会造成明显的时间消耗。在~\verb=bin=~目录下的~logresolve~工具可以在离线的情况下对已经记入日志的~IP~地址进行主机名的查询。 + + +\item \verb=ScoreBoardFile /var/run/httpd.scoreboard= + +httpd~使用~\verb=ScoreBoardFile=~文件维护进程的内部数据,因此通常不需要改变这个参数,除非管理员想在一台计算机上运行几个~Apache~服务器,这时每个~Apache~服务器都需要独立的设置文件~\verb=httpd.conf=~,并使用不同的~\verb=ScoreBoardFile=。 +\item \verb=CacheNegotiatedDocs On= + +缺省情况下如果代理服务器和~Apache~服务器协商是否缓存其网页,Apache~给予否定的回答,不希望自己的网页被代理服务器缓存。然而这样就不能有效的利用代理服务器的优势,因此可以设置~\verb=CacheNegotiatieDocs=~选项为~\verb=On=, 使得代理服务器可以对网页进行缓存。然而即使不设置这个选项,有的代理服务器(或通过调整设置)也能对网页进行缓存。 +\item \verb=Redirect permanent /foo= + +\verb=Redirect=~是用来重写~URL~的,当浏览器访问服务器上的一个已经不存在的资源的时候,服务器返回给浏览器新的~URL,告诉浏览器从该~URL~中获取资源。这主要用于原来存在于服务器上的文档,改变了位置之后,而又希望能使用老~URL~能访问到,以保持与以前的~URL~兼容。 +\item \verb=MetaDir .web= + +\noindent\verb=MetaSuffix .meta= + +\verb=Meta=~信息是在文档发送给客户之前,预先发送给客户浏览器一些数据,因此浏览器可以通过~\verb=HEAD=~请求来访问这些~\verb=Meta=~信息而不必真正通过~\verb=GET=~来返回全部文档数据。服务器通常发送给浏览器的是一些标准的~HTTP~头信息,如果要想增加额外的信息,就需要使用~\verb=MetaDir=~来定义~\verb=Meta=~数据存放的目录, 而~\verb=MetaSuffix=~用于指定包含~\verb=Meta=~数据的文件后缀。 +\item 浏览器代理设置 +\begin{verbatim} + # + # ProxyRequests On + # + # + # Allow from .your_domain.com + # + + # + # Order deny,allow + # Deny from all + # Allow from .your_domain.com + # + + # Enable/disable the handling of HTTP/1.1 "Via:" headers. + # ("Full" adds the server version; + # "Block" removes all outgoing Via: headers) + # Set to one of: Off | On | Full | Block + + # ProxyVia On + + # To enable the cache as well,edit and uncomment the following lines: + # (no cacheing without CacheRoot) + + # CacheRoot "/var/www/cache" + # CacheSize 5 + # CacheGcInterval 4 + # CacheMaxExpire 24 + # CacheLastModifiedFactor 0.1 + # CacheDefaultExpire 1 + # NoCache a_domain.com another_domain.edu joes.garage_sale.com + + # +\end{verbatim} + +Apache~服务器本身就具备代理的功能,然而这要求加载入~\verb=mod_proxy=~模块。这能使用~\verb=IfModule=~语句进行判断,如果存在~\verb=mod_proxy=~模块,就使用~\verb=ProxyRequests=~打开代理支持。此后的~\verb=Directory=~用于设置对~\verb=Proxy=~功能的访问权限设置,以及用于设置缓冲的各个参数设置。 +\end{myitemize} + +\subsubsection{日志} +Apache~内建了记录服务活动的功能,这就是它的日志。 +\begin{myitemize} + \item \verb=/var/log/apache2/access_log= + +访问日志,记录了所有对~Web~服务器的访问活动。 + +访问日志文件的位置实际上是一个配置选项。在~\verb=/etc/apache2/httpd.conf=~配置文件中,有如下这行内容: + +\verb=CustomLog "/var/log/apache2/access_log" common= + +\verb=CustomLog=~指定了保存日志文件的具体位置以及日志的格式。上面这行指定的是~\verb=common=~日志格式。 + +\verb=CustomLog=~中的路径是日志文件的路径。注意,由于日志文件是由~HTTP~用户打开的(用~User~指定),因此必须注意这个路径要有安全保证,防止该文件被随意改写。 + \item \verb=/var/log/apache2/error_log= + +错误日志,记录了~Apache~发生的错误。 + +错误日志和访问日志一样也是~Apache~服务的标准日志。 + +错误日志无论在格式上还是在内容上都和访问日志不同。然而,错误日志和访问日志一样也提供丰富的信息,我们可以利用这些信息分析服务器的运行情况,哪里出现了问题。 + +错误日志的位置可以通过~\verb=/etc/apache2/httpd.conf=~文件中的~\verb=ErrorLog=~选项进行设置: + +\verb=ErrorLog "/var/log/apache2/error.log"= + +除非文件位置用“\verb=/=”开头,否则这个文件位置是相对于~\verb=ServerRoot=~目录的相对路径。 + +错误日志记录了服务器运行期间遇到的各种错误,以及一些普通的诊断信息,比如服务器何时启动,何时关闭等。 + +我们可以设置日志文件记录信息级别的高低,控制日志文件记录信息的数量和类型。这是通过~\verb=LogLevel=~设置的,该参数默认设置的级别是~\verb=error=,即记录称得上错误的事件。 + +大多数情况下,我们在日志文件中见到的内容分属两类:文档错误和~CGI~错误。但是,错误日志中偶尔也会出现配置错误,另外还有前面提到的服务器启动和关闭信息。 +\end{myitemize} + +\begin{myenumerate} +\item \textbf{解读日志} + +下面是访问日志中一个典型的记录: + +\verb=216.35.116.91 - - [19/Aug/2000:14:47:37 -0400] "GET / HTTP/1.0" 200 654= + +这行内容由7项构成,上面的例子中有两项空白,但整行内容仍旧分成了7项。 + +第一项信息是远程主机的地址,即它表明访问网站的究竟是谁。在上面的例子中,访问网站的主机是~216.35.116.91。随便说一句,这个地址属于一台名为~si3001.inktomi.com~的机器(要找出这个信息,可以使用~nslookup~工具查找~DNS),inktomi.com~是一家制作~Web~搜索软件的公司。可以看出,仅仅从日志记录的第一项出发,我们就可以得到有关访问者的不少信息。 + +默认情况下,第一项信息只是远程主机的~IP~地址,但我们可以要求~Apache~查出所有的主机名字,并在日志文件中用主机名字来替代~IP~地址。然而,这种做法通常不值得推荐,因为它将极大地影响服务器记录日志的速度,从而也就减低了整个网站的效率。另外,有许多工具能够将日志文件中的~IP~地址转换成主机名字,因此要求~Apache~记录主机名字替代~IP~地址是得不偿失的。 + +然而,如果确实有必要让~Apache~找出远程主机的名字,那么我们可以使用如下命令: + +\verb=HostNameLookups on= + +如果~\verb=HostNameLookups=~设置成~\verb=double=~而不是~\verb=on=,日志记录程序将对它找到的主机名字进行反向查找,验证该主机名字确实指向了原来出现的~IP~地址。默认情况下~\verb=HostNameLookups=~设置为~\verb=off=。 + +上例日志记录中的第二项是空白,用一个占位符“-”替代。实际上绝大多数时候这一项都是如此。这个位置用于记录浏览者的标识,这不只是浏览者的登录名字,而是浏览者的~email~地址或者其它唯一标识符。这个信息由~identd~返回,或者直接由浏览器返回。很早的时候,那时~\textbf{Netscape 0.9}~还占据着统治地位,这个位置往往记录着浏览者的~email~地址。然而,由于有人用它来收集邮件地址和发送垃圾邮件,所以它未能保留很长时间,很久之前市场上几乎所有的浏览器就取消了这项功能。因此,到了今天,我们在日志记录的第二项看到~email~地址的机会已经微乎其微了。 + +日志记录的第三项也是空白。这个位置用于记录浏览者进行身份验证时提供的名字。当然,如果网站的某些内容要求用户进行身份验证,那么这项信息是不会空白的。但是,对于大多数网站来说,日志文件的大多数记录中这一项仍旧是空白的。 + +日志记录的第四项是请求的时间。这个信息用方括号包围,而且采用所谓的“公共日志格式”或“标准英文格式”。因此,上例日志记录表示请求的时间是2000年8月19日星期三14:47:37。时间信息最后的“-0400”表示服务器所处时区位于~UTC~之前的4小时。 + +日志记录的第五项信息或许是整个日志记录中最有用的信息,它告诉我们服务器收到的是一个什么样的请求。该项信息的典型格式是“\verb=METHOD RESOURCE PROTOCOL=”,即“方法~~资源~~协议”。 + +在上例中,\verb=METHOD=~是~\verb=GET=,其它经常可能出现的~\verb=METHOD=~还有~\verb=POST=~和~\verb=HEAD=。此外还有不少可能出现的合法~\verb=METHOD=,但主要就是这三种。 + +\verb=RESOURCE=~是指浏览者向服务器请求的文档,或~URL。在这个例子中,浏览者请求的是“\verb=/=”,即网站的主页或根。大多数情况下,“\verb=/=”指向~\verb=DocumentRoot=~目录的~\verb=index.html=~文档,但根据服务器配置的不同它也可能指向其它文件。 + +\verb=PROTOCOL=~通常是~HTTP,后面再加上版本号。版本号或者是1.0,或者是1.1,但出现1.0的时候比较多。我们知道,HTTP~协议是~Web~得以工作的基础,HTTP/1.0~是~HTTP~协议的早期版本,而1.1是最近的版本。当前大多数~Web~客户程序仍使用1.0版本的~HTTP~协议。 + +日志记录的第六项信息是状态代码。它告诉我们请求是否成功,或者遇到了什么样的错误。大多数时候,这项值是200,它表示服务器已经成功地响应浏览器的请求,一切正常。一般地说,以2开头的状态代码表示成功,以3开头的状态代码表示由于各种不同的原因用户请求被重定向到了其它位置,以4开头的状态代码表示客户端存在某种错误,以5开头的状态代码表示服务器遇到了某个错误。 + +日志记录的第七项表示发送给客户端的总字节数。它告诉我们传输被打断(即,该数值是否和文件的大小相同)。把日志记录中的这些值加起来就可以得知服务器在一天,一周或者一月内发送了多少数据。 + +\item \textbf{CGI错误} + +错误日志最主要的用途可能是诊断行为异常的~CGI~程序。为了进一步分析和处理方便,CGI~程序输出到~STDERR(Standard Error,标准错误设备)的所有内容都将直接进入错误日志。这意味着,任何编写良好的~CGI~程序,如果出现了问题,错误日志就会告诉我们有关问题的详细信息。 + +然而,把~CGI~程序错误输出到错误日志也有它的缺点,错误日志中将出现许多没有标准格式的内容,这使得用错误日志自动分析程序从中分析出有用的信息变得相当困难。 + +由于~CGI~程序运行环境的特殊性,如果没有错误日志的帮助,大多数~CGI~程序的错误都将很难解决。 + +有不少人在邮件列表或者新闻组中抱怨说自己有一个~CGI~程序,当打开网页时服务器却返回错误,比如“\verb=Internal Server Error=”。我们可以肯定,这些人还没有看过服务器的错误日志,或者根本不知道错误日志的存在。决多大多数情况下,错误日志能够精确地指出~CGI~错误的所在以及如何修正这个错误。 + +\item \textbf{定义日志格式} + +定制日志文件的格式涉及到两个参数,即~\verb=LogFormat=~和~\verb=CustomLog=~,默认~\verb=httpd.conf=~文件提供了关于这两个参数的几个示例。 + +\verb=LogFormat=~定义格式并为格式指定一个名字,以后我们就可以直接引用这个名字。\verb=CustomLog=~设置日志文件,并指明日志文件所用的格式(通常通过格式的名字)。 + +\verb=LogFormat=~的功能是定义日志格式并为它指定一个名字。例如,在默认的~\verb=httpd.conf=~文件中,我们可以找到下面这行代码: + +\verb=LogFormat “%h %l %u %t \”%r\” %>s %b” common= + +该命令创建了一种名为“\verb=common=”的日志格式,日志的格式在双引号包围的内容中指定。格式字符串中的每一个变量代表着一项特定的信息,这些信息按照格式串规定的次序写入到日志文件。 + +Apache~文档已经给出了所有可用于格式串的变量及其含义,下面是其译文: + +\verb=%...a=:远程~IP~地址 + +\verb=%...A=:本地~IP~地址 + +\verb=%...B=:已发送的字节数,不包含~HTTP~头 + +\verb=%...b=:CLF~格式的已发送字节数量,不包含~HTTP~头。例如当没有发送数据时,写入“-”而不是0。 + +\verb=%...{FOOBAR}e=:环境变量~\verb=FOOBAR=~的内容 + +\verb=%...f=:文件名字 + +\verb=%...h=:远程主机 + +\verb=%...H=:请求的协议 + +\verb=%...{Foobar}i=:\verb=Foobar=~的内容,发送给服务器的请求的标头行 + +\verb=%...l=:远程登录名字(自~identd,如提供的话) + +\verb=%...m=:请求的方法 + +\verb=%...{Foobar}n=:来自另外一个模块的注解“\verb=Foobar=”的内容 + +\verb=%...{Foobar}o=:\verb=Foobar=~的内容,应答的标头行 + +\verb=%...p=:服务器响应请求时使用的端口 + +\verb=%...P=:响应请求的子进程~ID + +\verb=%...q=:查询字符串(果存在查询字符串,则包含“?”后面的部分;则它是一个空字符串) + +\verb=%...r=:请求的第一行 + +\verb=%...s=:状态,对于进行内部重定向的请求,这是指“原来”请求的状态. 如果用~\verb=%...>s=,则是指后来的请求 + +\verb=%...t=:以公共日志时间格式表示的时间(称为标准英文格式) + +\verb=%...{format}t=:以指定格式~\verb=format=~表示的时间 + +\verb=%...T=:为响应请求而耗费的时间,以秒计 + +\verb=%...u=:远程用户(如果返回状态(\verb=%s=)401则可能是伪造的) + +\verb=%...U=:用户所请求的~URL~路径 + +\verb=%...v=:响应请求的服务器的~\verb=ServerName= + +\verb=%...V=:依照~\verb=UseCanonicalName=~设置得到的服务器名字 + +在所有上面列出的变量中,“...”表示一个可选的条件。如果没有指定条件,则变量的值将以“-”取代。分析前面来自默认~\verb=httpd.conf=~文件的~\verb=LogFormat=~示例,可以看出它创建了一种名为“\verb=common=”的日志格式,其中包括:远程主机,远程登录名字,远程用户,请求时间,请求的第一行代码,请求状态,以及发送的字节数。 + +有时候我们只想在日志中记录某些特定的,已定义的信息,这时就要用到“...”。如果在“\verb=%=”和变量之间放入了一个或者多个~HTTP~状态代码,则只有当请求返回的状态代码属于指定的状态代码之一时,变量所代表的内容才会被记录。例如,如果我们想要记录的是网站的所有无效链接,那么可以使用: + +\verb=LogFormat %404{Referer}i BrokenLinks= + +反之,如果我们想要记录那些状态代码不等于指定值的请求,只需加入一个“!”符号即可: + +\verb=LogFormat %!200U SomethingWrong= +\end{myenumerate} + +\subsubsection{参考信息} +有关~\textbf{Apache}~的详细信息,请参见位于~http://www.apache.org/~的官方主页。 + +\subsection{BIND} +\subsubsection{简介} +DNS~服务提供主机名字之间和互联网地址之间的映射。 + +\subsubsection{配置文件} +\begin{myitemize} + \item DNS~服务的配置文件为~\verb=/etc/bind/named.conf=。 + \item 区数据文件位于~\verb=/var/cache/bind=~下,分为两种: +\begin{myitemize} +\item 正向解析:以机器域名开头,实现从机器名到~IP~地址的转换。 +\item 反向解析:以~IP~地址域开头,实现从~IP~地址到机器名的转换。 +\end{myitemize} +\end{myitemize} + +\subsubsection{配置文件参数} +下面是~\verb=named.conf=~文件的一个示例: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +options { + directory "/var/cache/bind"; + notify-source 10.0.0.2; + pid-file "/var/run/bind/run/named.pid"; +}; +zone "." { + type master; + file "root.hint"; +}; +zone "example.com" { + type master; + file "sample.com.zone"; +}; +\end{verbatim} +\end{shaded} +\end{minipage} + +DNS~服务器的配置有多种可用的选项,如果需要更加详细的信息请参考有关DNS服务器的书籍。在上面的例子中~\verb=directory "/var/cache/bind"=~语句指明了区数据库文件存放的具体位置;\verb=notify-source=~语句指明服务器把区变动通知(NOTIFY)消息发送到IP地址所指的地方,当主~DNS~服务器检测到区数据库文件发生变动时就会向辅助服务器发出区数据文件变动的消息。\verb=pid-file=~语句只是告诉守护进程(daemon)服务器写入~ID~信息的路径,通常是~\verb=/var/run/bind/run/named.pid=~文件,但如果你重新设置了目录的布局,也可以根据需要对其进行手动更改。 + +在上面的例子中第一个区登记项(即~\verb=zone "."=)是用来告知~DNS~服务在何处定位其根服务器的信息。服务器发送和接收的信息不仅仅是自己所在区域的信息,同时也包括~Internet~上所有的区域的信息。并不是每个服务器上都有每个域名的登记项,但每个服务器都知道怎样获取此类信息。当然,由于每个区数据库文件列表会定期定时更新其数据文件,所以也应当定期定时作备份记录。 + +在以上~\verb=named.conf=~示例文件中第二个区登记项(即~\verb=zone "example.com"=)是一个“主控”域项,意思是这个~DNS~服务器保存着~example.com~的有效信息, Internet~上其它所有的~DNS~服务器都将用它来参照任何与这个域相关的信息。Example.com~项引用~\verb=/var/cache/bind/sample.com.zone=~这个文件。这是一个纯文本文件,它告诉~DNS~服务器所有有关~example.com~的信息,包括~\verb=serial=~值,刷新时间等所有的~DNS~记录以及其它一些相关项目信息。 + +\begin{myenumerate} +\item \textbf{区数据文件} + +\noindent 示例: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +@ IN SOA ns1.sample.com. root.sample.com. ( +200001001 # serial 序列号 +14400 # refresh 刷新时间(秒) +3600 # retry 重试时间(秒) +3600000 # expire 过期时间(秒) +86400) # TTL (time to live) 否定缓存~TTL(秒) +IN NS ns1.sample.com. +IN NS ns2.sample.com. +# +# Domain Mail Handlers +# +sample.com. IN MX 10 mail +# +# Hosts in order +# +www IN A 212.204.319.71 +ftp IN A 212.204.319.71 +mail IN A 212.204.319.71 +pop IN CNAME mail +\end{verbatim} +\end{shaded} +\end{minipage} + +\renewcommand{\arraystretch}{1.2} +\begin{center} +\begin{longtable}{|p{2.7cm}|p{2.6cm}|p{8cm}|} +% \caption{用户或进程特权列表} \\ +\hline +\centering{\bfseries 资源记录类型} & \centering{\bfseries 说明} & \centering{\bfseries 解释} \tabularnewline +\hline +\endfirsthead +\caption[]{(续上页)} \\ +\hline +\centering{\bfseries 资源记录类型} & \centering{\bfseries 说明} & \centering{\bfseries 解释} \tabularnewline +\hline +\endhead +\hline +\multicolumn{3}{r}{接下页} +\endfoot +\hline \endlastfoot + +@ & & 代表目前所管辖的域。 \tabularnewline \hline +SOA & 起始授权机构 & 此记录指定区域的起点。它所包含的信息有区域名、区域管理员电子邮件地址,以及指示辅~DNS~服务器如何更新区域数据文件的设置等。 \tabularnewline \hline +A & 地址 & 此记录列出特定主机名的~IP~地址。这是名称解析的重要记录。 \tabularnewline \hline +CNAME & 标准名称 & 此记录指定标准主机名的别名。 \tabularnewline \hline +MX & 邮件交换器 & 此记录列出了负责接收发到域中的电子邮件的主机。 \tabularnewline \hline +NS & 名称服务器 & 此记录指定负责给定区域的名称服务器。 +\end{longtable} +\end{center} +\renewcommand{\arraystretch}{1} + +\begin{myitemize} +\item 序列号(serial) + +作用于本区的所有数据。当辅域名服务器与主域名联系得到区数据时,先会请求相关数据的序列号,如果辅域名服务器的序列号比主域名服务器的序列号小,则说明辅域名服务器的数据已经过时,需加载新的区数据拷贝。 + +\item 刷新时间(refresh) + +刷新间隔说明辅域名服务器间隔多久检查该区的数据是最新的。 + +\item 重试时间(retry) + +如果辅域名服务器超过刷新间隔后无法访问主域名服务器,则开始按照每隔一段重试时间间隔就试着连接一次。通常重试时间要比刷新时间短。 + +\item 过期时间(expire) + +如过期时间内仍无法与主域名服务器联系,则辅域名服务器将使这个区失效。使一个区失效就意味着辅域名服务器将停止关于该区的回答。 + +\item 否定缓存~TTL(TTL (time to live)) + +表示可以将一个区的否定响应(negative response)缓存的时间。 +\end{myitemize} + +\vspace{1cm} +所有区数据库文件都要以~SOA(Start of Authority)打头;序列号(serial)使服务器能够纪录所经过的各次更新。守护进程在最近一次启动后只要此数字出现了增长变化,它就会重新把信息读入到数据库中去。举例来说,你可以从0开始然后在每次更新之后加上一个数字,也可以使用日期项如20000101(这样能够看到最近的一次更新的发生并且看出一天是否发生过多次更新)。接下来的四行以秒为单位(亦可以以分钟、小时、天等为单位)处理刷新时间和超时周期等,如果~DNS~数据库文件没有发生过人工或者服务器范围的刷新,此服务器会自动的重新读入新信息。在此不需要经常改变此处所列出的数值信息,只有由于某种特殊原因此域需要非常频繁地改变它们的信息时才需要对这些数值进行更改。接着列出的是此域的主~DNS~服务器,这样~DNS~就会知道是谁会控制整个域。下面列出的是~MX~纪录,它使服务器知道当有邮件信息请求~sample.com~区域时应当发出什么样信息,在本例中~mail.samle.com~的优先级是10,同时可以列出多个~MX~纪录作为邮件服务器的备份。数字越小代表优先级越高。要注意的是必须有一个相应的~A~记录给出了~mail.sample.com~的~IP~地址,这是必不可少的,这样~DNS~服务器就可以知道怎样根据域信息直接把邮件请求发往目的地。一个~A~记录仅仅是把~IP~地址赋给一个子域项,如~www,mail,ftp~等等,这些都必须用以上格式录入,而且必须都与一个~IP~地址相对应。例如,当某个用户请求~www.sample.com~时,他将会被指向该域所在的~Web~服务器的~IP~地址212.104.319.71。另外在上面的例子中还有一个~CNAME~项,CNAME(Canonical Name)~用于指定~IP~地址的别名,当使用这些别名时还是要回过头参考已经使用过的~A~记录。 + +\item \textbf{辅域名服务器部分} + +以下是辅助域名服务器~\verb=name.conf=~文件中一部分的一个例子: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +zone "sample2.com" { + type slave; + file "/var/cache/bind/sample2.com.zone"; + master { 10.0.0.1}; +}; +\end{verbatim} +\end{shaded} +\end{minipage} + +与主域名服务器相比较,二者最主要的两个区别在于:一是~\verb=type=~项,它既可以是~\verb=master=~也可以是~\verb=slave=,二是~IP~地址指定的是主控~DNS~服务器。其它选项大致基本相同。 +\end{myenumerate} + +\subsubsection{参考信息} +有关~\textbf{BIND}~的详细信息,请参见位于~http://www.isc.org/~的官方主页。 + +\subsubsection{日志} +DNS~服务的日志文件存放于~\verb=/var/log/=,其日志文件分为两部分,一部分为存储~DNS~服务信息文件,其存放位置为~\verb=/var/log/message=,另一部分为~DNS~服务出错信息文件,其存放位置为~\verb=/var/log/errors=,通过这两个文件,我们就可以清楚的了解~DNS~服务的各种动态,以及各种出错信息,以便我们更加有效的配置~DNS~服务。 + +\subsection{Samba} +\subsubsection{简介} +Samba~是一组软件包,运行于~Linux~系统中,用来实现与~Windows~系统之间的通信。它允许~Linux~系统出现在~Windows~的网络邻居中,使~Windows~用户享受由~Linux~主机提供的文件与打印服务。 + +Samba~由两个主要程序组成,它们是~smbd~和~nmbd。这两个守护进程在服务器启动到停止期间持续运行,Samba~提供了四个服务:文件和打印服务、授权与被授权、名字解析、浏览服务。前两项服务由~smbd~提供,后两项服务则由~nmbd~提供。简单地说,smbd~进程的作用是处理到来的~SMB~软件包,为使用该软件包的资源与~Linux~进行协商,nmbd~进程使主机(或工作站)能浏览~Linux~服务器。 + +\subsubsection{配置文件} +Samba~的配置文件~\verb=smb.conf=~位于~\verb=/etc/samba/=~目录下,可以设置各种参数,设置哪些资源被共享、以及其它用户对这些资源的操作权限等等。 + +\subsubsection{配置文件参数} +\verb=smb.conf=~文件的格式非常容易理解,可以对它进行编辑与修改使它适合自己的需求。 + +\begin{myenumerate} +\item \textbf{三个特殊段} + +除了控制访问共享的定制外,\verb=smb.conf=~有三个特殊段: +\begin{myitemize} + \item \verb=[global]=~段定义了整个过程中的全局参数,并为其它段提供缺省值。 + \item \verb=[homes]=~段定义远程用户存取在本地~Linux~机的用户主目录的参数。 + \item \verb=[printers]=~段定义远程用户共享本地~Linux~的打印机。 +\end{myitemize} + +下面就配置文件中比较重要的几个段分别给与说明。 + +\begin{myenumerate} +\item \verb=[global]= + +\verb=[global]=~节是全局参数节,该部分提供了全局参数,对~Samba~的功能具有很大的影响,主要用来设置整个系统规则,其设置直接影响~Samba~系统的行为。 +\begin{myitemize} + \item \verb=netbios name= + +设置主机名称,即~Windows~系统“网上邻居”中所见的机器名。 + \item \verb=workgroup= + +用来指定主机所在网络上所属的~NT~域名或者工作组名称。格式是: + +\verb+workgroup= Nt Domain-Name or workgroup-name+ + \item \verb=server string= + +用来设置本机描述,说明服务器用途,缺省是~\verb=Samba Server=。 + \item \verb=host allow= + +允许访问的主机~IP~地址,对安全非常重要。它设置了哪些机器可以访问~Samba~服务器。 + \item \verb=load printers= + +允许自动加载打印机列表,而不需要单独设置每一台打印机。 + \item \verb=interface= + +配置~Samba~使用多个网络接口。 + \item \verb=domain controller= + +仅当网络中有主域控制器时使用此选项。 + \item \verb=security= + +设置安全参数,定义安全模式。Samba~的安全模式有三种: + +\verb=share user server= + +其中~\verb=share=~安全级别最低,\verb=user=~模式要求连接时输入用户名和口令,\verb=server=~模式要求用户的认证由~Samba~服务器或~NT~服务器来完成。 + \item \verb=encrypt passwords= + +\verb=smb passwd file= + +设置是否需要加密口令。 +\end{myitemize} + +\noindent 例样: +\begin{verbatim} + [global] + netbios name=Samba test + workgroup = in.linx + smb passwd file = /etc/samba/private/smbpasswd + server string = Samba Server + hosts allow = 192.168.0. 192.168.0. 127. + dns proxy = no + security = user + encrypt passwords = yes + guest account = testuser + interfaces = 192.168.0.1/24 + max log size = 50 + socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 + log file = /var/log/samba/log.%m + load printers = yes + printcap name = /etc/printcap + ... ... +\end{verbatim} +\item \verb=[homes]= + +\verb=[homes]=~部分指定了~Windows~共享的主目录,如果在~Windows~工作站登录的名字与~Linux~用户名相同,提供的口令也一致,那么打开网络邻居,双击共享目录图标,就可获得访问该目录的权力。从~Windows~访问~Linux~主目录时,用户名作为主目录共享名。该部分通常定义了~Linux~机器上共享的目录资源,其名字可以由用户确定。段中的设置控制了每一个用户目录的共享权限。 + +% \verb=[homes]=~节是所有使用者的~\verb=home=~目录。 + +当任何一个客户访问~Samba~服务器时,在网络资源中都能出现自己的~\verb=home=~目录共享。其配置如下: +\begin{myitemize} +\item \verb=comment= + +设定在浏览本机资源时,出现在指定资源旁边的字符串。 +\item \verb=browseable= + +控制一项服务是否能够出现在网上邻居中,\verb=no=~意味着这个目录将在浏览时显示为要验证的用户名称,\verb=yes=~则显示~\verb=homes=~和要验证的用户名称的共享目录。 +\item \verb=writable= + +控制是否允许通过验证的用户对主目录有写入的权限,但最终取决于该目录的权限。设置~\verb+writable = yes+~后,主目录是可写的。 +\end{myitemize} + +\noindent 例样: +\begin{verbatim} + [homes] + comment = Home Directories + browseable = no + writable = no +\end{verbatim} + +\item \verb=[printers]= + +\verb=[printers]=~部分用于指定如何共享~Linux~网络打印机,从~windows~系统访问~Linux~网络打印机时,共享应是~printcap~中指定的~Linux~打印机名。其配置如下: +\begin{myitemize} +\item \verb=comment= + +指定为哪些设备进行设置。 +\item \verb=browseable= + +指定是否能够浏览~Windows~客户机的~printcap~文件定义的全部打印机。 +\item \verb=printable= + +指定是否允许不打印而去访问与打印服务相关的假脱机目录,例如:\verb=/var/spool/lpd/lp=。 +\item \verb=public= + +指定未被~Linux~用户名验证的~Windows~客户机是否有权使用~Samba~打印服务。 +\item \verb=writable= + +指定是否有权写假脱机目录。 +% \item \verb=create mode= +% +% 假脱机文件的缺省许可权限。 +\end{myitemize} + +\noindent 例样: +\begin{verbatim} + [printers] + comment = All Printers + browseable = no + printable = yes + public = no + writable = no +\end{verbatim} +\end{myenumerate} +% create mode = 0700 + +\item \textbf{其它配置方法} + +\begin{myenumerate} +\item 用户共享目录~\verb=[public]= + +设置公共访问目录。 + +\verb=[public]=~段提供了所有用户都可以共同访问的目录。除了那些属于维护人员具有读、写、执行权外,用户只具有读取的访问权限。其配置如下: + +\begin{myitemize} +\item \verb=path= + +指定公众共享目录路径。 +\item \verb=public= + +取值为~\verb=yes=时,允许公众共享,否则,禁止公众共享该目录。 +\item \verb=writable= + +取值为~\verb=yes=~时,公众对~\verb=/home/samba=~有可写权力。 +\item \verb=printable= + +取值为~\verb=yes=~时,公众对~\verb=/home/samba=~有打印权力。 +\item \verb=write list= + +指定具有可写权力的用户名单。 +\end{myitemize} + +\noindent 例样: +\begin{verbatim} + [public] + path = /home/samba + public = yes + writable = yes + printable = no + writelist = @staff +\end{verbatim} + +\item 用户映射 + +全局参数“\verb=username map=”用来控制用户映射,它允许管理员指定一个映射文件,该文件包含了在客户机和服务器之间进行用户映射的信息。 + +如:\verb+username map = /etc/samba/smbuser+ + +用户映射经常在~windows~和~linux~主机间进行。两个系统拥有不同的用户账号,用户映射的目的是将不同的用户映射成为一个用户,便于共享文件。 + +下面是一个映射文件的例子: +\begin{verbatim} + # Map Windows admin to sysadmin + sysadmin = admin administrator + # Map the member of developer to studio + studio = @developer +\end{verbatim} + +等号左边是单独的~Linux~账号,等号右边是要映射的账号列表。 + +服务器逐行分析映射文件,如果提供的账号和某行有右侧列表中的账号匹配,就把它替换为等号左边的账号。 + +\item 使用加密口令 + +新版本的~Windows 95~以及~Windows 98、Windows NT(sp3~以上版本),在网络传输中仅传递加密口令作为用户认证的信息。这类客户机和不支持加密口令并且以~user~安全级运行的~Samba~服务器通讯时,会出现故障。为了正常的通讯,Samba~服务器使用加密口令。下面讨论如何在~Samba~中使用加密口令。 + +\begin{myenumerate} +\item 口令文件~\verb=/etc/samba/private/smbpasswd= + +为了使用加密口令,Samba~需要一份口令文件,并且该文件应该和~Linux~的口令文件(\verb=/etc/passwd=)保持同步。下面是生成文件命令: + +\verb=$ less /etc/password | mksmbpasswd > /etc/samba/private/smbpasswd= + +\verb=smbpasswd=~是需要的口令文件,其权限是0600,所有者是~\verb=sysadmin=。 + +\verb=smbpasswd=~和~\verb=passwd=文件的记录对应,密码部分不同。密码有两部分组成,每部分是32个“X”,前部分用于和~Lanman~通讯,后部分和~Windows NT~通讯。\verb=sysadmin=~用户可以使用~\verb=smbpasswd=~命令为每个用户设定~Samba~口令。 + \item 修改配置文件~\verb=/etc/samba/smb.conf= + +要使~Samba~使用加密口令,需要在配置文件~\verb=smb.conf=~中加入如下参数。 +\begin{verbatim} + Encrypt passwords = yes + Smb passwd file = /etc/samba/private/smbpasswd +\end{verbatim} + +第一行通知~Samba~使用加密口令,第二行给出口令文件的位置。 +\end{myenumerate} + +\item Windows~系统中的明码口令 + +Samba~系统中使用明码口令作为连接~SMB~的默认设置。当~SMB~服务器对协商协议做出响应时,响应信息包含了一位,以说明服务器是否支持询问或者响应加密。随着~Win95~的网络重定向更新程序的发布,Microsoft~修改了默认值,这样,Windows~客户就不会向不支持加密的服务器发送明码口令了。 + +在这种情况下,有两种解决办法: +\begin{myenumerate} + \item 设置~Samba~服务器使用加密口令 + \item 让~Windows~客户使用明码口令 +\end{myenumerate} + +这里选用第2种解决办法,通过修改注册表来实现。下面对~Win95/Win98、~Winnt~用户分别给与说明。 +\begin{myenumerate} + \item Win98/Win95~系统用户 + +在注册表中加入下列注册字,并重新启动机器: +\begin{verbatim} + [HKLM\System\CurrentCntrolSet\Services\VxD\VNETSUP] + "EnablePlainTextPAssword" = dword:00000001 +\end{verbatim} + \item Winnt~系统用户 + +修改注册表,加入下列注册表项,并重新启动机器: +\begin{verbatim} + [HKLM\System\CurrentCntrolSet\Services\Rdr\Parameters] + "EnablePlainTextPAssword" = dword:00000001 +\end{verbatim} +\end{myenumerate} + +\item 配置~Samba~实现本地打印机共享 + +在开始之前,确信的~Samba~运行正常,并且~Windows~用户可以在网络邻居的列表中可以看到共享的~Samba~服务器。 + +为了配置~\verb=smb.conf=~文件实现共享一个本地打印机,检查~Linux~下的打印机是否工作正常。下一步在~Windows~客户端安装同一个打印机。这样做的话,需要~Windows~下打印机的安装盘。开始安装打印机,点击开始,选择打印机,并且双击添加打印机。 + +在打印机安装向导中,按照屏幕上的说明一步一步进行操作,直到在列表中选择打印机的名称。要点:写出打印机的准确名称,注意大小写(名称对大小写是敏感的)。如果需要,在安装完成后要重启计算机。 + +然后在~Samba~服务器上以系统管理员(\verb=sysadmin=)身份登录,对~Samba~配置文件~\verb=/etc/samba/smb.conf=~进行相应修改。 + +在~\verb=[global]=~这一节,找到打印名称这行,如果想使~Windows~用户可以使用所有本地打印机,去掉这一行,并且如果文件中没有这些内容的话,添加上: +\begin{verbatim} + printcap name = /etc/printcap + load printers = yes +\end{verbatim} + +如果只想让其它用户用一个打印机,不要删掉那行,也不用添加什么。需要注意的是在大多数从~BSD~发展而来的系统上,Samba~假设使用默认的打印系统。如果用的是其它打印系统,在打印系统配置中,找到相应的行,改变默认设置(\verb=bsd=)。选择包括~\verb=sysv=、\verb=plp=、\verb=lprng=、\verb=aix=、\verb=hpux=~和~\verb=qnx=。如果不能确认正在使用的打印系统,可以查看一下相关文件,但大多数情况下都是默认的。 + +下一步,使所有的本地打印机都实现共享。所有的打印机都在~\verb=/etc/printcap=~文件的打印机列表中,在~\verb=/etc/samba/smb.conf=~文件尾添加以下服务条目: +\begin{verbatim} + [printers] + writable = no + path = /tmp + printable = yes +\end{verbatim} + +如果只要共享一个打印机,在~\verb=smb.conf=~文件的~\verb=[global]=~小节添加一个自动服务行。和在~\verb=/etc/printcap=~中的相同,这行指定想使用的打印机名称。下行中在~lp~填写默认打印机的名称: + +\verb+auto services = lp+ + +而且,仿照下面创建一个打印机定义,添加到~\verb=[services]=~小节中(在~\verb=/etc/samba/smb.conf=~文件末尾): +\begin{verbatim} + [lp] + printable = yes + comment = Epson Stylus(Color) + public = yes + writable = no + browseable = yes + printer driver= Epson Stylus Color 740 +\end{verbatim} + +定义中的打印机名是~lp,这个名称必须和上面自动服务行中的名称相一致,并且也要和在~\verb=/etc/printcap=~文件中定义的打印机名称相同(或打印机的别名)。需要注意的是,打印机驱动行需要正确的输入~Windows~中的打印机信息(在这里,Epson Stylus Color 740,还是需要注意大小写)。 + +重新启动~Samba~服务后就可以共享使用打印机了。 +\end{myenumerate} +\end{myenumerate} + +\subsubsection{日志} +Samba~日志文件可以帮助诊断大多数的~Samba~管理员在初期可能面对的问题。Samba~在形成日志的时候非常灵活,可以随意设置服务器记录日志的大小。 + +Samba~日志文件位于~\verb=/var/log/samba/=,其中~\verb=log.nmbd=~和~\verb=log.smbd=~日志文件记录了~Samba~服务的开启、关闭以及出错信息。\verb=log.nmbd=~记录了~nmbd~进程的信息,而~\verb=log.smbd=~记录的是~smbd~进程的信息。另外,Samba~可以为每一个连接的客户使用唯一的配置和日志文件,并使用这个文件跟踪故障。只要某一个用户出现了问题,就可以利用查看某一个用户的~Samba~配置文件来进行正确的配置。 + +\subsubsection{参考信息} +有关~\textbf{Samba}~的详细信息,请参见位于~http://www.samba.org/~的官方主页。 + +\subsection{SSH} +\subsubsection{简介} +SSH(Secure Shell)是目前较可靠,专为远程登录会话和其它网络服务提供安全性的协议。利用~SSH~协议可以有效防止远程管理过程中的信息泄露问题。用户通过~SSH~可以把所有传输的数据进行加密,使“中间人”的攻击方式不可能实现,而且也能够防止~DNS~和~IP~欺骗。它还有一个额外的好处是传输的数据是经过压缩的,可以加快传输的速度。SSH~作用广泛,既可以代替~Telnet,又可以为~FTP、POP,甚至为~PPP~提供一个安全的“通道”,主要是解决口令在网上明文传输的问题。为了系统安全和用户自身的权益,推广~SSH~是必要的。 + +\hint{15cm}{管理员用户无法通过~ssh~远程登录到凝思安全操作系统~V6.0,只能由普通用户登录,然后再通过~su~切换到其它管理员用户。} + +\subsubsection{配置文件} +SSH~服务器的配置使用的是~\verb=/etc/ssh/sshd_config=。 + +\subsubsection{配置文件参数} +\begin{myenumerate} +\item \textbf{基本设置} + +编辑“\verb=sshd_config=”文件(\verb=vi /etc/ssh/sshd_config=),加入或改变下面的参数: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +# This is ssh server systemwide configuration file. +Port 22 +ListenAddress 192.168.1.1 +HostKey /etc/ssh/ssh_host_key +ServerKeyBits 1024 +LoginGraceTime 600 +KeyRegenerationInterval 3600 +PermitRootLogin no +IgnoreRhosts yes +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +IgnoreUserKnownHosts yes +StrictModes yes +X11Forwarding no +PrintMotd yes +SyslogFacility AUTH +LogLevel INFO +RhostsAuthentication no +RhostsRSAAuthentication no +RSAAuthentication yes +PasswordAuthentication yes +PermitEmptyPasswords no +AllowUsers admin  +\end{verbatim} +\end{shaded} +\end{minipage} + +\vspace{1cm} +下面将逐行说明上面的选项设置: +\begin{myitemize} +\item \verb=Port= + +设置~sshd~监听的端口号。 + +\item \verb=ListenAddress= + +设置~sshd~服务器绑定的~IP~地址。 + +\item \verb=HostKey= + +设置包含计算机私人密匙的文件。 + +\item \verb=ServerKeyBits= + +定义服务器密匙的位数。 + +\item \verb=LoginGraceTime= + +设置如果用户不能成功登录,在切断连接之前服务器需要等待的时间(以秒为单位)。 + +\item \verb=KeyRegenerationInterval= + +设置在多少秒之后自动重新生成服务器的密匙(如果使用密匙)。重新生成密匙是为了防止用盗用的密匙解密被截获的信息。 + +\item \verb=PermitRootLogin= + +设置~\verb=root=~能不能用~SSH~登录。这个选项一定不要设成“\verb=yes=”。 + +\item \verb=IgnoreRhosts= + +设置验证的时候是否使用“\verb=rhosts=” 和“\verb=shosts=”文件。 + +\item \verb=IgnoreUserKnownHosts= + +设置~sshd~是否在进行~\verb=RhostsRSAAuthentication=~安全验证的时候忽略用户的“\verb=$HOME/.ssh/known_hosts=”。 + +\item \verb=StrictModes= + +设置~SSH~在接收登录请求之前是否检查用户家目录和~\verb=rhosts=~文件的权限和所有权。这通常是必要的,因为新手经常会把自己的目录和文件设成任何人都有写权限。 + +\item \verb=X11Forwarding= + +设置是否允许~\verb=X11=~转发。 + +\item \verb=PrintMotd= + +设置~sshd~是否在用户登录的时候显示“\verb=/etc/motd=”中的信息。 + +\item \verb=SyslogFacility= + +设置在记录来自~sshd~的消息的时候,是否给出“\verb=facility code=”。 + +\item \verb=LogLevel= + +设置记录~sshd~日志消息的层次。\verb=INFO=~是一个好的选择。查看~sshd~的~man~帮助页,已获取更多的信息。 + +\item \verb=RhostsAuthentication= + +设置只用~\verb=rhosts=~或“\verb=/etc/hosts.equiv=”进行安全验证是否已经足够了。 + +\item \verb=RhostsRSAAuthentication= + +设置是否允许用~\verb=rhosts=~或“\verb=/etc/hosts.equiv=”加上~\verb=RSA=~进行安全验证。 + +\item \verb=RSAAuthentication= + +设置是否允许只有~\verb=RSA=~安全验证。 + +\item \verb=PasswordAuthentication= + +设置是否允许口令验证。 + +\item \verb=PermitEmptyPasswords= + +设置是否允许用口令为空的帐号登录。 + +\item \verb=AllowUsers= + +“\verb=AllowUsers=”的后面可以跟着任意的数量的用户名的匹配串(patterns)或~user@host~这样的匹配串,这些字符串用空格隔开。主机名可以是~DNS~名或~IP~地址。 +\end{myitemize} + +\vspace{1cm} +在默认的设置选项中需要注意的有: +\begin{myitemize} +\item \verb=PermitRootLogin= + +最好把这个选项设置成“\verb=PermitRootLogin without-password=”,这样“root”用户就不能从没有密匙的计算机上登录。把这个选项设置成“\verb=no=”将禁止“root”用户登录,只能用“\verb=su=”命令从普通用户转成“root”。 + +\item \verb=X11Forwarding= + +把这个选项设置成“\verb=yes=”允许用户运行远程主机上的~X~程序。就算禁止这个选项也不能提高服务器的安全因为用户可以安装他们自己的转发器(forwarder),请参看“man sshd”。 + +\item \verb=PasswordAuthentication= + +把这个选项设置为“\verb=no=”只允许用户用基于密匙的~mail。为~POP~加上“加密通道”可以防止~POP~的密码被网络监听器(sniffer)监听到。还有一个好处就是~SSH~的压缩方式可以让邮件传输得更快。 +\end{myitemize} + +\item \textbf{配置客户端的软件} + +OpenSSH~有三种配置方式:命令行参数、用户配置文件和系统级的配置文件~\verb=/etc/ssh/ssh_config=。命令行参数优先于配置文件,用户配置文件优先于系统配置文件。所有的命令行的参数都能在配置文件中设置。因为缺省设置时没有默认的用户配置文件,所以要把“\verb=/etc/ssh/ssh_config=”拷贝并重新命名为“\verb=~/.ssh/config=”。 + +标准的配置文件: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +[lots of explanations and possible options listed] +# Be paranoid by default +Host * +ForwardAgent no +ForwardX11 no +FallBackToRsh no +\end{verbatim} +\end{shaded} +\end{minipage} + +还有很多选项的设置可以用“man ssh”查看“CONFIGURATION FILES”这一章,配置文件是按顺序读取的。先设置的选项先生效。 + +假定你在~www.foobar.com~上有一个名为“bilbo”的帐号。而且你要把“\verb=ssh-agent=”和“\verb=ssh-add=”结合起来使用并且使用数据压缩来加快传输速度。因为主机名太长了,不愿意得输入这么长的名字,用“fbc”作为“www.foobar.com”的简称。你的配置文件可以是这样的: + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +Host *fbc +HostName www.foobar.com +User bilbo +ForwardAgent yes +Compression yes +# Be paranoid by default +Host * +ForwardAgent no +ForwardX11 no +FallBackToRsh no +\end{verbatim} +\end{shaded} +\end{minipage} + +输入“\verb=ssh fbc=”之后,SSH~会自动地从配置文件中找到主机的全名,用你的用户名登录并且用“\verb=ssh-agent=”管理的密匙进行安全验证。 + +用~SSH~连接到其它远程计算机用的还是“\verb=paranoid=(偏执)”默认设置。如果有些选项没有在配置文件或命令行中设置,那么还是使用默认的“\verb=paranoid=”设置。 + +在我们上面举的那个例子中,对于到~www.foobar.com~的~SSH~连接:“\verb=ForwardAgent=”和“\verb=Compression=”被设置为“\verb=Yes=”; 其它的设置选项(如果没有用命令行参数) “\verb=ForwardX11=”和“\verb=FallBackToRsh=”都被设置成“\verb=No=”。 + +\item \textbf{其它} + +还有一些需要注意的设置选项: + +\begin{myitemize} +\item \verb=CheckHostIP= + +这个选项用来进行~IP~地址的检查以防止~DNS~欺骗。 + +\item \verb=CompressionLevel= + +压缩的级别从“1”(最快)到“9”(压缩率最高)。默认值为“6”。 + +\item \verb=ForwardX11= + +为了在本地运行远程的~X程序必须设置这个选项。 + +\item \verb=LogLevel= + +当~SSH~出现问题的时候,即可设置该选项。默认值为“\verb=INFO=”。 +\end{myitemize} +\end{myenumerate} + +\subsection{DHCP} +\subsubsection{简介} +DHCP~是动态主机配置协议(Dynamic Host Configure Protocol)的缩写,它能自动地为网络中的客户机的~TCP/IP~配置分配~IP~地址、子网掩码以及缺省网关、DNS~服务器和~WINS~服务器的~IP~地址。它能使网络管理员不用前往现场对每台计算机上的~TCP/IP~参数进行配置,一切设置的修改只需直接在服务器上即可完成。 + +利用~DHCP~服务,还可以最高效地利用有限的~IP~地址。因为,比如,网络管理员在进行网络安装的时候,已经配置好了~DHCP~服务器,则当客户端启动时,DHCP~服务器就自动临时发放包含~IP~地址的相关~TCP/IP~配置参数给它,从而使它能够正常连入网络;而客户端只需装上~TCP/IP~协议即可,不用再作其他任何设置。在使用过程中,如果~DHCP~服务器的相关资源(比如服务器的~IP~地址等)发生了变化,则只需修改它的~DHCP~设定后,就可以自动为客户端发送新的配置值。 + +\subsubsection{配置文件} +DHCP~服务的配置文件为~\verb=/etc/dhcpd.conf=。 + +租约文件为~\verb=/var/lib/dhcp/dhcpd.leases=。 + +\subsubsection{配置文件参数} +\begin{myenumerate} +\item \textbf{服务配置文件} + +这是一个文本文件,dhcpd~里有一个语法分析器,能对这个文件进行语法分析,获得配置参数。\verb=dhcpd.conf=~格式是递归下降的,关键字大小写敏感,可以有注释,以“\verb=#=”开头为注释,一直到该行结束。这里给出一个简单的~\verb=dhcpd.conf=~的例子,所服务的网络为~C~类保留网络192.168.1.0。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +# examples +default-lease-time 28800; # 缺省租约时间 +max-lease-time 43200; # 最大租约时间 +option subnet-mask 255.255.255.0; # 子网掩码选项 +option broadcast-address 192.168.1.255; # 广播地址 +option routers 192.168.1.1; # 路由器地址 +option domain-name-servers 192.168.1.1; # DNS地址 +option domain-name "netreslab.org"; # 网域名称 + # 以上都是全局参数 + +subnet 192.168.1.0 netmask 255.255.255.0 { # 子网声明和掩码 +range 192.168.1.10 192.168.1.100; # 范围 +range 192.168.1.150 192.168.1.200; # 范围 +} +\end{verbatim} +\end{shaded} +\end{minipage} + +这段配置文件将允许~DHCP~服务器分配两段地址范围给~DHCP~客户,192.168.1.10-100~和~192.168.1.150-200。如果~DHCP~客户在申请租约时不请求一个特定租约失效时间,则以~\verb=default-lease-time=(28800秒)为租约时间,如果有请求一个特定的租约失效时间,则采用~\verb=max-lease-time=(432000秒)。 + +服务器发送下面的参数给~DHCP~客户机: +\begin{myitemize} + \item 子网掩码是255.255.255.0; + \item 广播地址是192.168.1.255; + \item 默认网关是192.168.1.1; + \item DNS~是192.168.1.1。 +\end{myitemize} + +如果要为一台叫做~hotdog~的机器指定固定的~IP~地址,可以在~\verb=dhcpd.conf=~文件加一条 + + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +host hotdog { +hardware ethernet 08:00:00:4c:58:23; # hotdog客户端上网卡的硬件地址 +fixed-address 192.168.1.210; # 固定IP +} +\end{verbatim} +\end{shaded} +\end{minipage} + +\item \textbf{租约文件} + +dhcpd~将客户的租用信息保存在~\verb=/var/lib/dhcp/dhcpd.leases=~文件中,该文件不断被更新,从这里面可以查到~IP~地址分配的情况。 + +\verb=dhcpd.leases=~是~DHCP~客户租约的数据库文件,默认目录在~\verb=/var/lib/dhcp/=,文件包含租约声明,每次一个租约被获取,更新或释放,它的新值就被记录到文件的的末尾。在~dhcpd~第一次安装后,并不会生成这个文件。但~dhcpd~的运行需要这个文件,所以可以建立一个空的文件。 + +\verb=$ touch /var/lib/dhcp/dhcpd.leases= + +dhcpd~记录这个文件的格式是: + +\verb=lease ip-address { statements... }= + +每个记录包含一个提供给客户的~IP~地址,在花括号里的语句包含一些租约信息。具体的租约信息因客户发出不同的~DHCP~请求而稍有差别。 +\end{myenumerate} + +\subsubsection{日志} +DHCP~服务的日志文件存放于~\verb=/var/log/=,其日志文件分为两部分,一部分为存储~DHCP~服务信息文件,其存放位置为~\verb=/var/log/message=,另一部分为~DHCP~服务出错信息文件,其存放位置为~\verb=/var/log/errors=,通过这两个文件,我们就可以清楚的了解~DHCP~服务的各种动态,以及各种出错信息,以便我们更加有效的配置~DHCP~服务。 + +\subsubsection{参考信息} +有关~\textbf{DHCP}~的详细信息,请参见位于~http://www.dhcp.org/~的官方主页。 + +\section{bonding} +Linux bonding驱动提供了一种可以将多个网络接口设备捆绑为一个逻辑“bonded”接口的方法,用于网络负载均衡及网络冗余。 + +\begin{myitemize} +\item 网络负载均衡 + +bonding的网络负载均衡是在文件服务器中常用到的,可以把多块网卡当一块来用。解决一个IP地址,流量过大,服务器网络压力过大的问题。bonding是在有限资源的情况下实现网络负载均衡的最好方法。 +\item 网络冗余 + +对于服务器来说,网络设备的稳定也是很重要的,特别是网卡。在生产型的系统中,大多通过硬件设备的冗余来提供服务器的可靠性和安全性,比如电源。bonding也能为网卡提供冗余支持。把多块网卡绑定到一个IP地址,当一块网卡发生物理性损坏时,另一块网卡自动启动,并提供正常服务,即:默认情况下只有一块网卡工作,其他网卡做备份。 +\end{myitemize} + +\subsection{参数说明} +\subsubsection{参数列表} +\begin{myenumerate} + \item primay + +指定哪个slave成为主设备(primary device),取值为字符串,如eth0,eth1等。只要指定的设备可用,它将一直是激活的slave。只有在主设备(primary device)断线时才会切换设备。这在希望某个slave设备优先使用的情形下很有用,比如,某个slave设备有更高的吞吐率。 + +\note{15cm}{primary选项只对active-backup模式有效。} + + \item updelay + +指定当发现一个链路恢复时,在激活该链路之前的等待时间,以毫秒计算。该选项只对miimon链路侦听有效。updelay应该是miimon值的整数倍,如果不是,它将会被向下取整到最近的整数。缺省值为0。 + \item arp\_interval + +指定ARP链路监控频率,单位是毫秒(ms)。如果APR监控工作于以太兼容模式(模式0和模式2)下,需要把switch(交换机)配置为在所有链路上均匀的分发网络包。如果switch(交换机)被配置为以XOR方式分发网络包,所有来自ARP目标的应答将会被同一个链路上的其他设备收到,这将会导致其 他设备的失败。ARP监控不应该和miimon同时使用。设定为0将禁止ARP监控。缺省值为0。 + \item arp\_ip\_target + +指定一组IP地址用于ARP监控的目标,它只在arp\_interval$>$0时有效。这些IP地址是ARP请求发送的目标,用于判定到目标地址的链路是否工作正常。该设定值为ddd.ddd.ddd.ddd格式。多个IP地址通 过逗号分隔。至少指定一个IP地址。最多可以指定16个IP地址。缺省值是没有IP地址。 + \item downdelay + +指定一个时间,用于在发现链路故障后,等待一段时间然后禁止一个slave,单位是毫秒(ms)。该选项只对miimon监控有效。downdelay值应该是miimon值的整数倍,否则它将会被取整到最接近的整数倍。缺省值为0。 + \item lacp\_rate + +指定在802.3ad模式下,我们希望的链接对端传输LACPDU包的速率。可能的选项 +\begin{myitemize} + \item slow或者0 + +请求对端每30s传输LACPDU + \item fast或者1 + +请求对端每1s传输LACPDU + \item 缺省值是slow +\end{myitemize} + \item max\_bonds + +为bonding驱动指定创建bonding设备的数量。比如:如果max\_bonds为3,而且bonding驱动还没有加载,那么bond0,bond1,bond2将会被创建。缺省值为1。 + \item miimon + +指定MII链路监控频率,单位是毫秒(ms)。这将决定驱动检查每个slave链路状态频率。 + +0表示禁止MII链路监控。100可以作为一个很好的初始参考值。下面的use\_carrier选项将会影响如果检测链路状态。更多的信息可以参考“高可靠性”章节。缺省值为0。 + \item mode + +指定bonding的模式。缺省是6 (balance-alb) Adaptive load balancing(适配器适应性负载均衡)。可选的mode包括:0,1,2,3,4,5,6。 +\end{myenumerate} + +\subsection{bonding模式} +linux操作系统下双网卡绑定有七种模式(由mode来配置)。 + +\begin{myitemize} +\item mode=0 + +即:(balance-rr) Round-robin policy(平衡抡循环模式) + +特点:此模式需要switch(交换机)支持及设定才能发挥效果,其特点是需要传输数据包顺序是依次传输(即:第1个包走eth0,下一个包就走eth1....一直循环下去,直到最后一个传输完毕), 此模式提供负载平衡和容错能力;但是我们知道如果一个连接或者会话的数据包从不同的接口发出的话,中途再经过不同的链路,在客户端很有可能会出现数据包无序到达的问题,而无序到达的数据包需要重新要求被发送,这样网络的吞吐量就会下降。 +\item mode=1 + +即: (active-backup) Active-backup policy(主-备份模式) + +特点:只有一个设备处于活动状态,当 一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见得,从外面看来,bond的MAC地址是唯一的,以避免switch(交换机)发生混乱。此模式只提供了容错能力;由此可见此算法的优点是可以提供高网络连接的可用性,但是它的资源利用率较低,只有一个接口处于工作状态,在有 N 个网络接口的情况下,资源利用率为1/N。 +\item mode=2 + +即:(balance-xor) XOR policy(平衡模式) + +特点:基于指定的传输HASH策略传输数据包。缺省的策略是:(源MAC地址 XOR 目标MAC地址) \% slave数量。其他的传输策略可以通过xmit\_hash\_policy选项指定,此模式提供负载平衡和容错能力。 +\item mode=3 + +即:broadcast(广播模式) + +特点:在每个slave接口上传输每个数据包,此模式提供了容错能力。 +\item mode=4 + +即:(802.3ad) IEEE 802.3ad Dynamic link aggregation(IEEE 802.3ad 动态链接聚合模式) + +特点:创建一个聚合组,它们共享同样的速率和双工设定。根据802.3ad规范将多个slave工作在同一个激活的聚合体下。 + +外出流量的slave选举是基于传输hash策略,该策略可以通过xmit\_hash\_policy选项从缺省的XOR策略改变到其他策略。需要注意的是, 并不是所有的传输策略都是802.3ad适应的,尤其考虑到在802.3ad标准43.2.4章节提及的包乱序问题。不同的实现可能会有不同的适应性。 + +必要条件: +\begin{myitemize} +\item 条件1:ethtool支持获取每个slave的速率和双工设定 +\item 条件2:switch(交换机)支持IEEE 802.3ad Dynamic link aggregation +\item 条件3:大多数switch(交换机)需要经过特定配置才能支持802.3ad模式 +\end{myitemize} +\item mod=5 + +即:(balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡模式) + +特点:不需要任何特别的switch(交换机)支持的通道bonding。在每个slave上根据当前的负载(根据速度计算)分配外出流量。如果正在接受数据的slave出故障了,另一个slave接管失败的slave的MAC地址。 + +该模式的必要条件:ethtool支持获取每个slave的速率。 +\item mod=6 + +即:(balance-alb) Adaptive load balancing(适配器适应性负载均衡模式) + +特点:该模式包含了balance-tlb模式,同时加上针对IPV4流量的接收负载均衡(receive load balance, rlb),而且不需要任何switch(交换机)的支持。接收负载均衡是通过ARP协商实现的。bonding驱动截获本机发送的ARP应答,并把源硬件地址改写为bond中某个slave的唯一硬件地址,从而使得不同的对端使用不同的硬件地址进行通信。 +\end{myitemize} + +\subsection{配置bonding} +\subsubsection{操作系统及环境} +操作系统为:凝思安全操作系统V6.0(系统中默认安装了ifenslave)。 + +需启用两块或两块以上网卡设备。 + +\begin{myenumerate} + \item 查看内核支持:(示例) + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# modprobe -l bond* +kernel/drivers/net/bonding/bonding.ko +root@Linx:~# modinfo bonding +filename: /lib/modules/2.6.32-5-linx-amd64/kernel/drivers/net/ +bonding/bonding.ko +author: Thomas Davis, tadavis@lbl.gov and many others +description: Ethernet Channel Bonding Driver, v3.5.0 +version: 3.5.0 +license: GPL +srcversion: C0EFCD8CB4AC214A8146EC2 +depends: +vermagic: 2.6.32-5-linx-amd64 SMP mod_unload modversions +parm: max_bonds:Max number of bonded devices (int) +parm: num_grat_arp:Number of gratuitous ARP packets to send +on failover event (int) +parm: num_unsol_na:Number of unsolicited IPv6 Neighbor +Advertisements packets to send on failover event (int) +parm: miimon:Link check interval in milliseconds (int) +parm: updelay:Delay before considering link up, in +milliseconds (int) +parm: downdelay:Delay before considering link down, in +milliseconds (int) +parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in +miimon; 0 for off, 1 for on (default) (int) +parm: mode:Mode of operation : 0 for balance-rr, 1 for +active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 +for balance-tlb, 6 for balance-alb (charp) +parm: primary:Primary network device to use (charp) +parm: lacp_rate:LACPDU tx rate to request from 802.3ad +partner (slow/fast) (charp) +parm: ad_select:803.ad aggregation selection logic: stable +(0, default), bandwidth (1), count (2) (charp) +parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 +(default), 1 for layer 3+4 (charp) +parm: arp_interval:arp interval in milliseconds (int) +parm: arp_ip_target:arp targets in n.n.n.n form (array of +charp) +parm: arp_validate:validate src/dst of ARP probes: none +(default), active, backup or all (charp) +parm: fail_over_mac:For active-backup, do not set all slaves +to the same MAC. none (default), active or follow (charp) +\end{verbatim} +\end{shaded} +\end{minipage} + +\item 加载模块 + +加载模块实现分为手动加载和开机启动自动加载。 +\begin{myitemize} +\item 手动加载 + +先卸载bonding模块。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# rmmod bonding +\end{verbatim} +\end{shaded} +\end{minipage} + +示例选模式为6;允许最大绑定数为1,加载bonding。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# modprobe bonding mode=6 max_bonds=1 +\end{verbatim} +\end{shaded} +\end{minipage} + +注意:手动加载bonding需重启网络,即:修改完配置文件~\verb=/etc/network/interfaces=~后重启网络。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# /etc/init.d/networking restart +\end{verbatim} +\end{shaded} +\end{minipage} + +\item 开机启动自动加载 + +修改配置文件~\verb=/etc/network/interfaces=~如~\ref{s4}~中所示:配置文件中添加了bonding的相关配置,开机重启可自动加载bonding模块。 +\end{myitemize} + +\subsubsection{配置文件}\label{s4} +编辑网络接口配置文件,指定IP。 + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# vim /etc/network/interfaces +\end{verbatim} +\end{shaded} +\end{minipage} + +查看示例文件: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# cat /etc/network/interfaces +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). +auto bond0 +iface bond0 inet static + address 172.16.0.73 + network 255.255.255.0 + netmask 255.255.255.0 + gateway 172.16.0.254 + slaves eth0 eth1 + bond_mode active-backup + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 +root@Linx:~# +\end{verbatim} +\end{shaded} +\end{minipage} + +查看网络信息: + +\begin{minipage}{15cm} +\begin{shaded} +\begin{verbatim} +root@Linx:~# ifconfig +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myenumerate} + + +\chapter{开发} +凝思安全操作系统V6.0支持多个开发环境与开发工具。 + +\section{开发环境} +凝思安全操作系统V6.0支持Java、C、C++、Python、Perl、Shell、Ruby、Php、Tcl/tk、~Lisp等开发环境。 + +\subsection{java开发环境} +\begin{enumerate} + \item 查看javac版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ javac -version +javac 1.6.0_26 +\end{verbatim} +\end{shaded} +\end{minipage} +\item 编译java程序 + +HelloWorld.java源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +public class HelloWorld{ + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} +\end{verbatim} +\end{shaded} +\end{minipage} + +编译: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ javac HelloWorld.java +\end{verbatim} +\end{shaded} +\end{minipage} +\item 运行java程序 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ java HelloWorld +\end{verbatim} +\end{shaded} +\end{minipage} + +输出结果: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{C开发环境} +\begin{enumerate} + \item 查看gcc版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ gcc -v +Using built-in specs. +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Linx 4.4.5-8linx1' +--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs +--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr +--program-suffix=-4.4 --enable-shared --enable-multiarch +--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib +--without-included-gettext --enable-threads=posix +--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib +--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug +--enable-objc-gc --with-arch-32=i586 --with-tune=generic +--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu +--target=x86_64-linux-gnu +Thread model: posix +gcc version 4.4.5 (Linx 4.4.5-8linx1) +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译gcc helloworld.c程序 + + helloworld.c源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#include +int main(int argc, char *argv[]){ + printf(“hello world!”); + return 0; +} +\end{verbatim} +\end{shaded} +\end{minipage} + \item 运行helloworld + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ./helloworld +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{C++开发环境} +\begin{enumerate} + \item 查看C++版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ g++ -v +Using built-in specs. +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Linx 4.4.5-8linx1' +--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs +--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr +--program-suffix=-4.4 --enable-shared --enable-multiarch +--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib +--without-included-gettext --enable-threads=posix +--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib +--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug +--enable-objc-gc --with-arch-32=i586 --with-tune=generic +--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu +--target=x86_64-linux-gnu Thread model: posix +gcc version 4.4.5 (Linx 4.4.5-8linx1) +\end{verbatim} +\end{shaded} +\end{minipage} +\item 编译g++ helloworld.c程序 + +helloworld.c源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#include +using namespace std; +int main() +{ + cout << "Hello World!" << endl; + cout << "Welcome to C++ Programming" << endl; +} +\end{verbatim} +\end{shaded} +\end{minipage} + +编译: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ g++ -g -Wall helloword.c -o helloworld +\end{verbatim} +\end{shaded} +\end{minipage} +\item 运行helloworld + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ./helloworld +Hello World! +Welcome to C++ Programming +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Python开发环境} +\begin{enumerate} + \item 查看Python版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ python -V +Python 2.6.6 +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行helloworld.py程序 + + helloworld.py源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#!/usr/bin/python +# Hello world python program +print "Hello World!"; +\end{verbatim} +\end{shaded} +\end{minipage} + +编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ python helloworld.py +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ chmod u+x helloworld.py +$ ./helloworld.py +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Perl开发环境} +\begin{enumerate} + \item 查看perl版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ perl -v +This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi +(with 56 registered patches, see perl -V for more detail) + +Copyright 1987-2009, Larry Wall + +Perl may be copied only under the terms of either the Artistic License or +the GNU General Public License, which may be found in the Perl 5 source +kit. + +Complete documentation for Perl, including FAQ lists, should be found on +this system using "man perl" or "perldoc perl". If you have access to the +Internet, point your browser at http://www.perl.org/, the Perl Home Page. +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行helloworld.pl程序 + + helloworld.pl源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#!/usr/bin/perl +# Hello world perl program +print "Hello World!"; +\end{verbatim} +\end{shaded} +\end{minipage} + +编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ perl helloworld.pl +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ chmod u+x helloworld.pl +$ ./helloworld.pl +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Shell开发环境} +\begin{enumerate} + \item 查看shell版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ sh -version +GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) +Copyright (C) 2009 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later + +This is free software; you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行helloworld.sh程序 + + helloworld.sh源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#!/bin/bash +echo "Hello, World!" +\end{verbatim} +\end{shaded} +\end{minipage} + + 编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +chmod +x hello.sh +./hello.sh +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Ruby开发环境} +\begin{enumerate} + \item 查看ruby版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ruby -v +ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行helloworld.rb程序 + +helloworld.rb源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#!/usr/bin/ruby +# Hello world ruby program +puts "Hello World!"; +\end{verbatim} +\end{shaded} +\end{minipage} + +查看是否安装ruby包,没有则安装ruby包:(以下为查看和安装命令) + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ sudo aptitude search ruby +$ sudo apt-get install ruby +\end{verbatim} +\end{shaded} +\end{minipage} + +编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ruby helloworld.rb +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} + +或者 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ chmod u+x helloworld.rb +$ ./helloworld.rb +Hello World! +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Php开发环境} +\begin{enumerate} + \item 查看php版本 + + 查看是否安装php5包,没有则安装php5包(以下为查看和安装命令): + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ sudo aptitude search php5 +$ sudo apt-get install php5 + +$ php -i +phpinfo() +PHP Version => 5.3.3-7+squeeze14 + +System => Linux linx 2.6.32-5-linx-amd64 #1 SMP Tue Oct 29 11:08:27 CST +2013 x86_64 +Build Date => Aug 6 2012 14:16:54 +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +Server API => Command Line Interface +Virtual Directory Support => disabled +Configuration File (php.ini) Path => /etc/php5/cli +Loaded Configuration File => /etc/php5/cli/php.ini +Scan this dir for additional .ini files => /etc/php5/cli/conf.d +Additional .ini files parsed => /etc/php5/cli/conf.d/pdo.ini +...... +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Tcl/tk开发环境} +\begin{enumerate} + \item 查看Tcl/tk版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ tclsh +% put $tcl_version +8.4 +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行tk\_hello.tk程序 + +tk\_hello.tk源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +#!/usr/bin/wish +#Make a label "Hello World" +label .hello -text "Hello World" +pack .hello +\end{verbatim} +\end{shaded} +\end{minipage} + +编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +chmod +x tk_hello.tk +./tk_hello.tk +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\subsection{Lisp开发环境} +\begin{enumerate} + \item 看lisp版本 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ clisp --version +GNU CLISP 2.48 (2009-07-28) (built 3487500463) (memory 3606457309) +Software: GNU C 4.4.4 +x86_64-linux-gnu-gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith +-Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare +-Wno-format-nonliteral -O -falign-functions=4 -DUNICODE -DDYNAMIC_FFI +-DDYNAMIC_MODULES -I. /usr/lib/libreadline.so -lncurses -ldl +\end{verbatim} +\end{shaded} +\end{minipage} + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +/usr/lib/libavcall.so /usr/lib/libcallback.so -L/usr/lib -lsigsegv +SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED +TRIVIALMAP_MEMORY +libsigsegv 2.5 +libreadline 5.2 +Features: +(ASDF2 ASDF CLC-OS-DEBIAN COMMON-LISP-CONTROLLER BERKELEY-DB +CLX-ANSI-COMMON-LISP CLX READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS +MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS +LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE BASE-CHAR=CHARACTER +WORD-SIZE=64 PC386 UNIX) +C Modules: (clisp i18n syscalls regexp readline linux clx bdb) +Installation directory: /usr/lib/clisp-2.48/ +User language: ENGLISH +Machine: X86_64 (X86_64) Sxx.sxx [172.16.0.13] +\end{verbatim} +\end{shaded} +\end{minipage} + \item 编译运行helloworld.lisp程序 + +需安装clisp + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ sudo apt-get install clisp +\end{verbatim} +\end{shaded} +\end{minipage} + +helloworld.lisp源程序如下: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +;hello world lisp program. + (print "Hello World") +\end{verbatim} +\end{shaded} +\end{minipage} + +编译运行: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ clisp helloworld +"Hello World" +\end{verbatim} +\end{shaded} +\end{minipage} +\end{enumerate} + +\newpage +\section{开发工具} +凝思安全操作系统V6.0支持eclipse、kdevelop、emacs、qtcreater等开发工具。 + +\subsection{eclipse} +下载~\verb=eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz=,下载地址为~\url{https://www.eclipse.org/downloads}。 + +解压获得eclipse目录: + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +tar -xf eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz +\end{verbatim} +\end{shaded} +\end{minipage} + +进入此目录,运行eclipse + + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ./eclipse +\end{verbatim} +\end{shaded} +\end{minipage} + +eclipse软件界面如图~\ref{eclipse}所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/eclipse.png} + \caption{eclipse软件界面}\label{eclipse} +\end{figure} + +\newpage +\subsection{kdevelop} +kdevelop已默认安装,运行~\verb=/usr/bin/kdevelop=~即可。 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ /usr/bin/kdevelop +\end{verbatim} +\end{shaded} +\end{minipage} + +kdevelop软件界面如图~\ref{kdevelop}所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/kdevelop.png} + \caption{kdevelop软件界面}\label{kdevelop} +\end{figure} + +\newpage +\subsection{emacs} +emacs已默认安装,在终端直接运行emacs即可。 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ emacs +\end{verbatim} +\end{shaded} +\end{minipage} + +或者用鼠标点击应用“程序——附件——GNU Emacs 23” + +emacs软件界面如图~\ref{emacs}所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/emacs.png} + \caption{emacs软件界面}\label{emacs} +\end{figure} + +\newpage +\subsection{qtcreater} +安装编译完成的~\verb=qt5.2.1-linx_5.2.1-1_amd64.deb=,安装qt及qtcreater后,在此qt安装目录下运行~\verb=./bin/qtcreater=。 + +\begin{minipage}{15.7cm} +\begin{shaded} +\begin{verbatim} +$ ./bin/qtcreater +\end{verbatim} +\end{shaded} +\end{minipage} + +qtcreater软件界面如图~\ref{qtcreater}所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/qtcreater.png} + \caption{qtcreater软件界面}\label{qtcreater} +\end{figure} + +\chapter{常见问题解答} +本章用于解答凝思安全操作系统~V6.0~使用过程中可能出现的一些问题,并建议了相应的解决方法。 + +当您无法解决该问题或者遇到文档中未提及的问题时,请详细记录该问题并联系北京凝思技术支持部。 + +\begin{myenumerate} +\vspace{1cm} +\item 无法登录 +\fancyhead[LE,RO]{\slshape 无法登录} + +用户输入用户名和口令无法登录到系统。 + +解决方法: + +\begin{myenumerate} +\item 确认用户名和口令是否正确。 +\item 口令可能已过期,帐户已锁定,请联系管理员。 +\end{myenumerate} + +\vspace{1cm} +\item 查找信息 +\fancyhead[LE,RO]{\slshape 查找信息} + +系统日志可以客观的反应出系统的运行状态,当出现异常情况时,应检查系统日志信息。凝思安全操作系统会记录大量的详细信息。在您遇到系统问题时,有几个地方可以查看。 + +以下是最常用到的日志文件及其通常所包含的内容: +\begin{myitemize} +\item \verb=/var/log/syslog= + +全局系统日志。 +\item \verb=/var/log/dmesg= + +内核启动日志。 +\item \verb=/var/log/debug= + +内核日志。 +% \item \verb=/var/log/boot.msg= +% +% 引导期间来自内核的信息。 +\item \verb=/var/log/messages= + +运行时来自内核和系统日志守护程序的信息。 +% \item \verb=/var/log/warn= +% +% 所有来自内核与系统日志守护程序、被指定为“警告”级别或更高级别的信息。 +\item \verb=/var/log/auth.log= + +包含系统授权信息,包括用户登录和使用的权限机制等。 +\item \verb=/var/log/wtmp= + +包含当前机器会话的用户登录记录的二进制文件。可使用~\verb=last=~命令查看它。 +\item \verb=/var/log/Xorg.*.log= + +来自~X Windows~系统的各种启动和运行时日志。在调试失败的~X~启动时,该日志很有用。 +\item \verb=/var/log/apache2= + +包含~Apache~服务器及客户机日志信息的目录。 +\item \verb=/var/log/samba/= + +包含~Samba~服务器及客户机日志信息的目录。 +\item \verb=/var/log/mail*= + +来自邮件系统的信息。 +\item \verb=/var/log/audit/= + +包含审计日志的目录。 +\end{myitemize} + +\vspace{1cm} +\item 网络问题 +\fancyhead[LE,RO]{\slshape 网络问题} + +系统的许多问题可能都与网络相关。您可以使用以下步骤来确定所遇到的网络问题的原因。 +\begin{myitemize} +\item 如果使用的是以太网连接,请首先检查硬件。请确保网线已正确地插入计算机。以太网连接器旁边的控制灯(如果有的话)应全部亮起。 + +如果连接失败,请检查网线在别的机器上是否正常。如果正常,则可能是网卡引起了该问题。如果网络设置中包含集线器和交换机,也需要对它们进行检查。 +\item 如果使用的是无线连接,请检查网络服务器是否可与其它机器建立此无线连接。如果无法建立,请与网络管理人员联系。 +% \item 完成对基本网络连通性的检查后,请尝试找出没有响应的服务。 +\item 请检查网络服务器是否正在运行并且您的网络设置是否允许您建立连接: +\begin{myenumerate} +\item %请先确定您运行的是否安全内核,可执行命令~\verb=cat /proc/version=,如果内核版本信息中带有~security~即为安全内核,那么, +请检查您的序列号是否过期或无效。可执行命令~\verb=cat /proc/cmdline=~查看序列号。 + +序列号为一串16个十六进制的字符,保存在~\verb=/etc/default/grub=~文件中,例如 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +GRUB_CMDLINE_LINUX="linx_serial=01234567890abcde security=linx" +\end{verbatim} +\end{shaded} +\end{minipage} + +修改为正确的序列号后,执行~\verb=update-grub=命令将其更新到~\verb=/boot/grub/grub.cfg=~文件中,然后重启机器。 +\item 可使用~\verb=ping localhost=(请将~\verb=localhost=~替换为服务器的主机名)来检查各台服务器是否正在运行且能够对网络作出响应。 +\begin{myitemize} +\item 如果~\verb=ping=~命令成功,表示您所查找的主机在正常运行,并且网络的名称服务配置正确。 +\item 如果~\verb=ping=~命令失败,同时显示讯息目标主机不可访问,则表明您的系统或期望的服务器未正确配置或已宕机。可从其它机器运行~\verb=ping=~命令来检查您的系统是否可被访问。如果能够从其他机器成功访问您的机器,则故障原因是服务器未在运行或未正确配置。 +\item 如果~\verb=ping=~命令失败,同时显示未知主机,则表示名称服务未正确配置或使用的主机名不正确。请使用~\verb=ping -c =~(\verb==~为尝试连接次数,\verb==~为主机~IP~地址)尝试连接到这一没有名称服务的主机。如果成功,则请检查主机名的拼写是否正确以及网络中的名称服务是否配置正确。如果~\verb=ping=~命令仍然失败,则可能网卡未正确配置或网络硬件存在故障。 +\end{myitemize} +\item 请使用~\verb=host localhost=~来检查您尝试连接的服务器的主机名是否能够正确地转换为~IP~地址,反之亦然。如果此命令返回了该主机的~IP~地址,则名称服务已在正常运行。如果~\verb=host=~命令失败,请检查您主机上所有与名称和地址解析相关的网络配置文件。 +\item 如果系统无法与网络服务器建立连接,并且已排除了名称服务出现问题的可能,则请检查网卡的配置。 +\item 如果名称服务和网络硬件已正确配置并正在运行,但是某些外部网络连接仍然长时间超时或完全失败,请使用~\verb=traceroute =~命令(\verb==~为完全合法的域名)来跟踪这些请求所经过的网络路由。此命令将列出某一请求从您的机器传递到其目的地所经过的所有网关。它列出了每个网关的响应时间以及该网关是否可访问。请将~\verb=traceroute=~和~\verb=ping=~结合使用以确定故障原因并通知网络管理人员。 +\end{myenumerate} +\end{myitemize} + +网络相关的检查工具较多,系统中还有其它常用的网络相关的命令如下: + +\begin{myitemize} + \item traceroute + + 查看包在网络中的路由情况可或者那个跳点(路由器)出了问题。 + \item netstat + + 查看网络状态信息。 + \item tcpdump + + 高级用户用来分析网络数据包格式。以检查网络通信协议是否出现问题。 +\end{myitemize} + +\vspace{.5cm} +详细的使用方法可以查阅系统中相关命令的man手册。 + +\vspace{1cm} +\item 在故障或硬件、软件出错后恢复系统至安全状态 +\fancyhead[LE,RO]{\slshape 在故障或硬件、软件出错后恢复系统至安全状态} + +“安全状态”的定义: + +\begin{myitemize} +\item 安全模块正常加载并正常发挥作用 +\item 标识与鉴别子系统正常工作 +\item 日志子系统和审计子系统按照配置正常运行 +\end{myitemize} + +在发生硬件故障时,比如风扇坏了直接更换风扇,对于硬盘如果系统分区损坏可能需要重新安装,但是应用软件故障不会影响系统进入不安全状态。如果是TCB(可信计算基)中的成员程序故障或脆弱性修复,我们的升级包会进行postinstall工作,如果postinstall正常完成(没有报错),就说明已经恢复到安全模式。 + + +\vspace{1cm} +\item 运行级别切换 +\fancyhead[LE,RO]{\slshape 运行级别的切换} + +% 不同的运行级别定义如下: +% +% \begin{myitemize} +% \item 0——系统停机状态 +% \item 1——单用户工作状态(类似~Windows~下的安全模式) +% \item 2——多用户状态(无~NFS) +% \item 3——完全多用户状态(有~NFS) +% \item 4——系统未使用,留给用户,一般在系统出现故障时使用 +% \item 5——X11~控制台(xdm、gdm~或~kdm) +% \item 6——系统正常关闭并重新启动(执行命令~\verb=init 6=~可以重启系统) +% \end{myitemize} +% +% 常用的运行级别是~3(系统启动后进入字符模式)和~5(系统启动后进入图形模式),您可以使用~\verb=runlevel=~命令查看当前的运行级别。 + +完成系统启动进程后,init~启动所有在默认运行级别配置为启动的服务。 默认运行级别由~\verb=/etc/inittab=~中的~id~给出。凝思安全操作系统~V6.0~默认使用~id=2。 + +凝思安全操作系统~V6.0~使用下列的运行级别: +\begin{myitemize} + \item 0——关闭系统 + \item 1——单用户模式(single-user mode) + \item 2~5——多用户模式(multi-user modes)\footnote{在没有定制过的系统中,运行级别2、3、4、5~是没有区别的。} + \item 6——重启系统 +\end{myitemize} + +您可以使用~\verb=runlevel=~命令查看当前的运行级别,使用~\verb=init=~命令来转换运行级别。 + +几种运行级别之间的切换方式有三种: + +\begin{myenumerate} +\item 执行~\verb=init [0-6]=~命令 + +以系统管理员身份登录系统,执行~\verb=init [0-6]=,则系统将立即切换到设定的运行级别。例如当系统处于2级时以系统管理员身份执行~\verb=init 1=,系统将立即进入单用户模式。 +\item 修改~\verb=/etc/inittab=~文件 + +\verb=/etc/inittab=~文件中“~\verb=id:2:initdefault:=~”字段中间的数字即为运行级别,例如将“~\verb=id:2:initdefault:=~”中的~2~改为~1,系统重启后将从多用户模式切换到单用户模式。 +\item 通过~grub~菜单修改系统运行级别 + +系统启动进入~grub~界面时,选择任意一项,按~\key{e}~键,在二级菜单中选择~kernel~所在的行,按~\key{e}~键,在此行的最后输入如“\textvisiblespace \texttt{5}”,按~\key{Esc}~键,再按~\key{b}~键,系统启动后将进入~5~级多用户模式。 +\end{myenumerate} + +\note{14cm}{如果想通过第三种方式进入运行级别~1,则需要在~kernel~一行的最后输入“\textvisiblespace \texttt{single}”而不是“\textvisiblespace \texttt{1}”。} + +\warning{14cm}{不要把运行级别~\texttt{initdefault}~设为~0~或~6,否则系统将不能正常启动。} + +\vspace{1cm} +\item 系统启动 + +在系统启动时,会启动若干服务程序,这些服务程序提供整个操作系统最为核心的基本功能。例如:用户登录界面,后台服务程序,日志服务程序,IPC通信服务等。要确保系统工能正常稳定,这些服务必须正常工作。 + +\begin{myitemize} + \item 诊断哪些服务在开机时正常启动,哪些服务没有正常启动? + + 执行以下命令列出当前系统所有服务列表。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +service –status-all +\end{verbatim} +\end{shaded} +\end{minipage} + +服务名左侧用-、+、?表示服务当前状态。-是未自启动,+自启动,?没有配置。 + +当某一个功能不可用时,首先检查相应的服务是否启动。如果没有启动,可以执行以下命令手动启动相应服务: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +service <服务名> start +\end{verbatim} +\end{shaded} +\end{minipage} +\item 诊断开机启动过程中的异常问题 + +当用户发现开机启动异常,需要查看开机过程中更多的信息,以便与技术支持人员联系。可以root用户身份执行以下操作: +\begin{myitemize} + \item 修改内核参数: + + 编辑~\verb=/etc/default/grub=~文件,删除其中的quiet。 + \item 更新grub配置文件 + + 执行命令: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +update-grub +\end{verbatim} +\end{shaded} +\end{minipage} + \item 重启系统 + +执行命令: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +reboot +\end{verbatim} +\end{shaded} +\end{minipage} + \item 检查启动过程中的信息 +\end{myitemize} + +\warning{13cm}{\texttt{/etc/default/grub}~对系统开机影响较大,请谨慎修改,必要时请联系技术支持人员。} +\end{myitemize} + +\vspace{1cm} +\item Core Files + +当有程序异常退出时,可以通过core文件对崩溃的程序进行调试从而找出问题所在。 + +使用core文件的前提是需要开启core文件生成开关。步骤如下: +\begin{myitemize} + \item 在运行异常代码前执行命令: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +ulimit -c 10000 +\end{verbatim} +\end{shaded} +\end{minipage} + \item 运行一个有异常的程序: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +./a.out +\end{verbatim} +\end{shaded} +\end{minipage} + \item 设置系统会生成一个core文件在当前目录中,core文件的名称可能是core或是一串数字。 + \item 使用调试工具进行调试: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +gdb ./a.out core +\end{verbatim} +\end{shaded} +\end{minipage} + \item 进入调试界面,输入命令查看程序的调用栈: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +bt +\end{verbatim} +\end{shaded} +\end{minipage} + \item 这时就会发现是哪个函数调用导致程序异常,然后定位这个函数。 +\end{myitemize} + +\vspace{1cm} +\item 内核崩溃转储 + +kdump是在系统崩溃、死锁或者死机的时候用来转储内存运行参数的一个工具和服务,打个比方,如果系统一旦崩溃那么正常的内核就没有办法工作了,在这个时候将由kdump产生一个用于capture当前运行信息的内核,该内核会将此时的内存中的所有运行状态和数据信息收集到一个dump core文件中以便于工程师分析崩溃原因,一旦内存信息收集完成,系统将自动重启。 + +配置步骤: +\begin{myitemize} + \item 安装Kdump软件包: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +#apt-get install kexec-tools kdump-tools +\end{verbatim} +\end{shaded} +\end{minipage} + \item 安装内核调试信息软件包: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +#apt-get install linux-image-2.6.32-5-amd64-dbg +\end{verbatim} +\end{shaded} +\end{minipage} + \item 配置kdump服务 + + 编辑~\verb=/etc/default/kdump-tools=~文件,修改USE\_KDUMP和debug kernel项。 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +USE_KDUMP=1 +DEBUG_KERNEL=/usr/lib/debug/boot/vmlinux-2.6.32-5-amd64 +\end{verbatim} +\end{shaded} +\end{minipage} + \item 修改GRUB(引导加载程序)配置 +编辑~\verb=/etc/default/grub=~文件,修改对应行内容: + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +GRUB_CMDLINE_LINUX_DEFAULT="crashkernel=64M quiet" +\end{verbatim} +\end{shaded} +\end{minipage} + +更新grub + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +update-grub +\end{verbatim} +\end{shaded} +\end{minipage} + + \item 重启系统 + +\begin{minipage}{13cm} +\begin{shaded} +\begin{verbatim} +reboot +\end{verbatim} +\end{shaded} +\end{minipage} +\end{myitemize} + +\warning{14cm}{当遇到系统内核崩溃或严重错误时请立即通知北京凝思技术支持部门,由技术人员帮助解决,切勿自行修改系统配置文件从而导致不可逆转的错误。} + +\vspace{1cm} +\item 命令丢失 + +系统中提供大量的基础命令,供用户完成日常系统使用之用。系统中还可能部署很多其他的应用软件或程序。往往使用者会出现这种现象,当输入某一个命令时,系统提示找不到该命令或命令不存在。这可能会有两种可能,一是命令安装了但没有找到,二是命令没有被安装。 + +首先,需要确定命令是否被安装。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +find / -name <命令>; #在系统中查找命令 +whereis <命令>; #在系统中查找命令,用户手册 +\end{verbatim} +\end{shaded} +\end{minipage} + +\vspace{1cm} +\item root密码恢复 + +当某些设备由于长时间没人接管,而导致root口令丢失时,可以采取某种方法重置root口令。由于这种方法需要对所操作的设备直接控制权(即,需要在设备启动早期阶段介入设备拿到设备控制权,这需要操作人员对设备有直接操作权而非远程操作。) + +在设备启动阶段会看到如图~\ref{grub}~所示界面。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.7]{./pic/grub.png} + \caption{GRUB启动界面}\label{grub} +\end{figure} + +在当前界面中输入字符e,进入命令配置界面如图~\ref{grub3}~所示。 + +\begin{figure}[H] +\centering + \includegraphics[scale=0.5]{./pic/grub3.png} + \caption{GRUB命令编辑界面}\label{grub3} +\end{figure} + +图中红框白字是需要添加的内容,写好后按Ctrl+x键启动系统。 + +系统会直接启动一个终端程序,为您使用。通过这个终端程序你可以使用passwd命令修改root用户的口令。 +\item 诊断和调试工具 + +部分应用程序在运行时会出现异常情况,这时管理员或开发者可能需要跟踪这些程序的运行轨迹,以便发现其中的问题。 + +在系统运行的程序可能有两种一种是二进制程序,其执行代码是二进制的是人类不可读的,另一种是脚本程序是它是人类可读的,对于这两种程序的调试方法可能略有不同。 + +首先,介绍二进制程序。 + +当有一个二进制程序需要调试时可以用strace命令。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +strace ./a.out +\end{verbatim} +\end{shaded} +\end{minipage} + +这时系统会运行~\verb=./a.out=~程序,同时将它调用的系统调用打印出来。使用者可以通过strace命令的输出信息了解到~\verb=./a.out=~程序的运行轨迹。 + +在系统中有很多非二进制程序,如bash脚本程序,当遇到这个的程序出现异常时可以通过加命令行选项的方式进行调试。 + +\begin{minipage}{14cm} +\begin{shaded} +\begin{verbatim} +bash -x ./install.sh +\end{verbatim} +\end{shaded} +\end{minipage} + +当使用上述命令时,系统会运行上述命令并开启调式信息,系统会将~\verb=./install.sh=~每一行的运行结果打印出来,以便用户观察系统出现的问题。 +\end{myenumerate} + +\appendix +\titleformat{\chapter}{\Huge\bfseries}{附录\,\thechapter}{1em}{} +\renewcommand{\chaptermark}[1]{\markboth{\large附录\,\thechapter\,~~#1}{}} +\titlecontents{chapter}[4em]{}{\renewcommand{\baselinestretch}{2}\bfseries\contentslabel[附录 \thecontentslabel]{3.5em}}{}{\titlerule*{}\bfseries\contentspage} + +\chapter{文件和目录}\label{s10} +\fancyhead[LE,RO]{\slshape \rightmark} + +本章从目录的角度出发,总览整个系统,有关各个文件的详情,请参考手册页。 + +完整的目录树分为若干部分,如果将各部分挂载到不同的分区,将更易于进行备份和系统管理。目录树中,主要的几个部分是~\verb=/、/usr、/var=~和~\verb=/home=~,各部分用途不同。具体描述如下: + +\verb=/=~目录是每台机器特有的(它一般保存在本地磁盘上,但也可保存在~RAM~磁盘或网络驱动器上),其中包含启动系统和引导装入文件系统所需的文件。因此,对单用户模式来说,只使用一个分区挂载\verb=/=~目录就足够了。另外,该目录内还包含一些工具,用于修复损坏的系统和从备份中恢复丢失的文件。 + +\verb=/usr=~目录内包含所有的命令库,手册页和其他没有变动过的文件(这些文件是普通操作期间所需要的)。\verb=/usr=~目录内没有专门针对哪台机器的文件,也没有普通用户操作期间应该修改的文件。这样一来,便可以通过网络实现文件共享,从而有效地节约成本,因为这样可节省磁盘空间(要知道~\verb=/usr=~文件系统起码也有几百个~MB),使管理工作更容易(在更新应用程序时,只有~\verb=master/usr=~需要改动,而不是逐一在每台机器上改动)。即使文件系统是在本地磁盘上,也可以采用只读方式装入它,减小系统崩溃时文件系统受损的可能性。 + +\verb=/var=~目录中包含有变动的文件,比如假脱机目录(用于邮件、新闻、打印机等)、日志文件、格式化的手册页和临时文件。%\verb=/var=~内原来的所有东西都已经转移到~\verb=/usr=~下,但其结果是不能采取只读装入~\verb=/usr=。 + +\verb=/home=~目录中包含用户的家目录,一般是系统保存用户数据的地方。把家目录和其它目录区分开是为了方便备份;其它部分通常是不需要备份的,或者说至少不需要经常备份(因为它们几乎没有变动)。一个大型的~\verb=/home=~目录可能必须分为若干个小型的目录,这就需要在~\verb=/home=~下面加一个额外的命名级别,比如~\verb=/home/students=~和~\verb=/home/staff=。 + +上述各个目录可以分别挂载到不同的分区。如果是一个小型的单用户系统,而且用户想一切简单明了的话,可以只挂载一个~\verb=/=~目录。 + +不同用途的目录所需空间大小不同,可根据需要挂载到不同的分区。如果要使两个目录在同一个分区,例如~\verb=/var=~和~\verb=/usr=,可以将~\verb=/var=~挂载到~\verb=/usr/var=目录~,然后在~\verb=/=~中建立一个链接到~\verb=/usr/var=~的符号链接~\verb=/var=~。 + +\section{\texttt{/}} +一般说来,\verb=/=~应该较小,因为其中包含非常关键的文件和一个小型的,非频繁变动的文件系统。受损的~\verb=/=~目录一般意味着系统不能启动,除非借助于特殊的启动设备(比如说软盘),所以一般不要轻易更改它。 + +\verb=/=~目录一般不包含任何文件,系统的标准启动镜像除外,这个镜像通常称为~\verb=/vmlinuz=。其他的所有文件都保存在~\verb=/=~目录的子目录下: +\begin{myenumerate} + +\item \verb=/bin= + +启动期间,可供普通用户使用的命令(也可能在启动之后)。 +\item \verb=/sbin= + +和~\verb=/bin=~一样,但不是供普通用户使用的,虽然在必要或经过允许的情况下,普通用户也可使用它们。 +\item \verb=/etc= + +某台机器专用的配置文件。 +\item \verb=/root= + +用户~\verb=root=~的家目录。 +\item \verb=/lib、/lib32= + +\verb=/=~目录上的程序所需的共享库。 +\item \verb=/lib/modules= + +可装载的内核模块,特别是从灾难中恢复时,启动系统所需的那些模块(比如,网络和文件系统驱动程序)。 +\item \verb=/dev= + +设备文件。 +\item \verb=/tmp= + +临时文件。%启动后的程序运行应该采用~\verb=/var/tmp=,而不是~\verb=/tmp=,因为前者可能在空间较大的磁盘上。 +\item \verb=/boot= + +启动装载程序所用文件,比如~LILO。内核镜像通常保存在这里,而不是~\verb=/=~目录中。如果有多个内核镜像,这个目录就可能增长得很快,所以最好把它单独保存在一个文件系统内。这样做的另一个原因是确保内核镜像在~IDE~磁盘的前1024个磁道内。 +\item \verb=/mnt= + +系统管理员临时装入的装入点。程序不会自行装入~\verb=/mnt=。\verb=/mnt=~也可以分为若干个子目录(比如~\verb=/mnt/dosa=~可能是使用~MS-DOS~文件系统的软驱,而~\verb=/mnt/extra=~则可能和~ext2~文件系统如出一辙)。 +\item \verb=/proc、/usr、/var=~和~\verb=/home= + +其它目录的装入点。 +\end{myenumerate} + +\section{\texttt{/etc}} +\verb=/etc=~目录中包含许多文件。下面将讨论其中的一部分。另外的文件,则应该由你决定它们属于哪个程序,并参考该程序的手册页。许多网络配置文件也被包含在~\verb=/etc=~内。 + +\begin{myenumerate} +\item \verb=/etc/rc=~或~\verb=/etc/rc.d=~或~\verb=/etc/rc?.d= + +启动时或运行级别发生变化时运行的脚本或脚本的目录。 +\item \verb=/etc/passwd= + +用户数据库,其中有一些字段指定用户名,用户真名,根目录,加密密码以及该用户的其他信息。 +% \item \verb=/etc/fdprm= +% +% 软盘参数表。描述各种软盘的不同格式。供~setfdprm~使用。更多详情参考~setfdprm~手册页。 +\item \verb=/etc/fstab= + +列出启动时由~\verb=mount -a=~命令(在~\verb=/etc/rc=~或等同的启动文件内)自动装入的文件系统。Linux~系统中,这个文件还包含一些信息,这些信息和~\verb=swapon -a=~自动采用的交换区有关。 +\item \verb=/etc/group= + +类似于~\verb=/etc/passwd=,但它描述的不是用户,而是组。更多详情,请参考~group~手册页。 +\item \verb=/etc/inittab= + +init~配置文件。 +\item \verb=/etc/issue= + +登录提示出现之前的~getty~输出。通常包含对系统的简短说明或欢迎消息。其内容由系统管理员决定。 +% \item \verb=/etc/magic= +% +% 文件的配置文件。其中包含不同文件格式的说明,以便根据格式猜测出文件的类型。更多详情,请参考~magic~和~file~手册页。 +\item \verb=/etc/motd= + +日期消息,是在成功登录之后自动输出的。其内容由系统管理员决定。通常用来提示每个用户,比如既定的系统关闭警告等。 +\item \verb=/etc/mtab= + +列出当前已装入的文件系统。最初是由启动脚本设置,由~mount~命令自动更新的。用于需要已装入文件系统列表时(比如说在运行~df~命令时)。 +\item \verb=/etc/shadow= + +在已安装影子密码软件的系统上的影子密码文件。影子密码把已加密的密码从~\verb=/etc/passwd=~移入~\verb=/etc/shadow=;后者只有~\verb=root=~才能读取。这样可进一步保证密码的安全性。 +\item \verb=/etc/login.defs= + +login~命令的配置文件。 +% \item \verb=/etc/printcap= +% +% 类似于~\verb=/etc/termcap=,但对象是打印机。而且采用的语法也不同。 +\item \verb=/etc/profile、/etc/csh.login=~和~\verb=/etc/csh.cshrc= + +登录或启动时,由~Bourne~或~C~外壳执行的文件。这些文件允许系统管理员为所有的用户设置全局默认设置。各外壳的详情,请参考手册页。 +\item \verb=/etc/securetty= + +标识安全终端,也就是允许~\verb=root=~通过哪些终端登录。一般说来,只列出了虚拟控制台,如此一来,恶意用户不可能通过~modem~或网络攻击系统,从而获得超级用户特权(至少说很难)。 +\item \verb=/etc/shells= + +列出受托(信得过的)外壳。chsh~命令允许用户把他们自己的登录外壳改成这个文件内列出的受托外壳。为计算机提供~FTP~服务的。ftpd~服务器进程,将复查用户的外壳是否在~\verb=/etc/shells=~内,如果在,将允许用户登录,如果不在,就不会让用户登录。 +% \item \verb=/etc/termcap= +% +% 终端性能数据库。描述按照什么样的“转义序列”来控制不同的终端。编写程序时,不是直接输出转义序列(只运行于特定品牌的终端),而是查找正确的序列,以执行自己打算在~\verb=/etc/termcap=~内执行的操作。这样做的结果是,多数程序都可利用各种各样的终端。更多详情,请参考~termcap、curs\_termcap~和~terminfo~手册页。 +\end{myenumerate} + +\section{\texttt{/dev}} +\verb=/dev=~目录下包含所有设备的特定设备文件。设备文件的命名有特殊的约定;对这些约定的描述包括在~Device~列表中。%设备文件是在安装期间或后期,利用~\verb=/dev/MAKEDEV=~脚本创建的。 + +% \verb=/dev/MAKEDEV.local=~是由系统管理员编写的一个脚本,它创建只用于本地的设备文件或链接(也就是那些不属于标准~MA KEDEV~的设备文件,比如用于某些非标准设备驱动程序的设备文件)。 + +\section{\texttt{/usr}} +\verb=/usr=~通常较大,因为所有的程序都是保存在这个文件系统中的。\verb=/usr=~内的文件通常是系统文件;本地安装的程序和其他东西都保存在~\verb=/usr/local=~下面。这样一来,就能够通过安装该目录的新版本来升级系统,而不需要再次安装所有的程序。下面列出了部分~\verb=/usr=~子目录。 +\begin{myenumerate} +% \item \verb=/usr/X11R6= +% +% X Window System~包含所有的文件。为了简化~X~的开发和安装,X~文件尚未和系统的其他部分集成。\verb=/usr/X11R6=~下面有一个目录树,它类似于~\verb=/usr=~本身的目录树。 +% \item \verb=/usr/X386= +% +% 类似于~\verb=/usr/X11R6=,但针对的是~X115~版本。 +\item \verb=/usr/bin= + +几乎包含所有的用户命令。有些命令在~\verb=/bin=~或~\verb=/usr/local/bin=~内。 +\item \verb=/usr/sbin= + +\verb=root=~文件系统上不需要的系统管理命令,例如,大多数服务器程序。 +\item \verb=/usr/share/man=,\verb=/usr/share/info=~和~\verb=/usr/share/doc= + +分别包含手册页,GNU~信息文档和名目繁多的其他文档文件。 +\item \verb=/usr/include= + +C~编程语言的头文件。实际上,为了保持数据的一致,这个文件应该保存在~\verb=/usr/lib=~下面,但过去一直都采用这个名称。 +\item \verb=/usr/lib、/usr/lib32= + +程序和子系统所用的未变动过的数据文件,其中包括一些和站点有关的配置文件。lib~这个名称源于库(library);最初用来编写子例程的库都保存在~\verb=/usr/lib=~和~\verb=/usr/lib32=~内。 +% \item \verb=/usr/local= +% +% 本地安装的软件和其他文件的地方。 +\end{myenumerate} + +\section{\texttt{/var}} +\verb=/var=~内包含系统正常运行时所改动的数据。它是各个系统专有的,也就是说,不能通过网络和其他计算机共享。 + +\begin{myenumerate} +% \item \verb=/var/catman= +% +% 按需格式化的手册页之缓冲区。手册页的原件通常保存在~\verb=/usr/man/man*=~内;有的手册页还可能有一个预先格式化版本,这个版本保存在~\verb=/usr/man/cat*=~内。至于其他手册页,则需要在初次查看时,进行格式化;格式化过后的版本保存在~\verb=/var/man=~内,以便下一个查看该手册页的用户无须等待其格式化(\verb=/var/catman=~的清空方式和临时目录的清空方式一样)。 +\item \verb=/var/lib= + +系统正常运行期间发生变化的文件。 +% \item \verb=/var/local= +% +% 针对安装在~\verb=/usr/local=~内的程序的变化数据(也就是已经由系统管理员安装的程序)。注意,即使是本地安装的程序,如果适当的话,也应该使用其他的~\verb=/var=~目录(比如~\verb=/var/lock=)。 +\item \verb=/var/lock= + +锁文件。许多程序都习惯在~\verb=/var/lock=~内建立一个锁文件,借以表明它们正在使用某个特定的设备或文件。其他程序将注意到这个锁文件,并不再尝试使用这个特定的设备或文件。 +\item \verb=/var/log= + +日志文件,它源于各个程序,特别是~login(\verb=/var/log/wtmp=,记录所有的系统登录和注销活动)和~syslog(\verb=/var/log/messages=,通常保存所有的内核和系统程序消息)。\verb=/var/log=~内的文件通常增长较快,需要定期清空。 +\item \verb=/var/run= + +系统信息文件,其中包含系统相关信息,在系统下一次启动之前,都是有效的。例如,\verb=/var/run/utmp=~内包含和当前登录用户有关的信息。 +\item \verb=/var/spool= + +用于邮件,新闻,打印机队列和其他队列作业的目录。对每个不同的假脱机来说,在~\verb=/var/spool=~下面都有其自己的子目录,比如用户信箱就在~\verb=/var/spool/mail=~内。 +\item \verb=/var/tmp= + +临时文件,通常存放较大或需要保存的时间比~\verb=/tmp=~长的文件。%(系统管理员可能不允许~\verb=/var/tmp=~内保存一些非常老的文件)。 +\end{myenumerate} + +\section{\texttt{/proc}} +\verb=/proc=~内包含一个伪文件系统,用于提供和系统相关的信息(最初是进程相关信息,并由此得名)。下面将对有些比较重要的文件和目录进行解释。\verb=/proc=~文件系统的更多详情,请参考~proc~手册页。 + +\begin{myenumerate} +\item \verb=/proc/1= + +目录,其中有1号进程的相关信息。每个进程在~\verb=/proc=~下面都有一个子目录,这个子目录名就是该进程的编号。 +\item \verb=/proc/cpuinfo= + +其中保存关于中央处理器的信息,比如型号,制造商,模型和性能等。 +\item \verb=/proc/devices= + +其中列出了已经配置到当前正在运行的内核之中的设备驱动程序。 +\item \verb=/proc/dma= + +展示当前正在使用的~DMA~通道。 +\item \verb=/proc/filesystems= + +已配置到内核中的文件系统。 +\item \verb=/proc/interrupts= + +展示哪些中断号正在使用中,以及各中断号使用了多少次。 +\item \verb=/proc/ioports= + +展示此时哪些~I/O~端口正在使用中。 +\item \verb=/proc/kcore= + +系统物理内存的镜像。其大小完全和你的物理内存一样,但事实上占不了多少内存;它是在程序访问它时,即时生成的(记住,除非你把它复制到别的地方,否则,\verb=/proc=~根本就不占用任何磁盘空间)。 +% \item \verb=/proc/kmsg= +% +% 内核输出的消息。同时,也被路由到~syslog。 +% \item \verb=/proc/ksyms= +% +% 内核的符号表。 +\item \verb=/proc/loadavg= + +系统的“装载平衡”;无意义的三个识别符,表示此时系统应该做多少操作。 +\item \verb=/proc/meminfo= + +包含和内存使用相关的信息,其中既包括物理内存,又有交换空间。 +\item \verb=/proc/modules= + +表明此时正在装载哪些内核模块。 +\item \verb=/proc/net= + +目录,其中包含和网络协议相关的状态信息。 +\item \verb=/proc/self= + +指向一个程序进程目录的符号链接,这个程序此刻正在查看~\verb=/proc=。如果有两个程序都在查看~\verb=/proc=,它们就会得到两个不同的符号链接。这主要是为了方便程序更容易得到自己的进程目录。 +\item \verb=/proc/stat= + +关于系统的各种统计数据,比如自系统启动以来出现的页故障次数统计。 +\item \verb=/proc/uptime= + +表明系统已启用多久。 +\item \verb=/proc/version= + +内核版本号。 + +注意,上面的文件越来越发展成为易于理解的文本化文件,但有时,它们采用的格式却是难以理解的。所以,目前有许多命令将上面的文件转换为更便于理解的格式。比如,有个自由软件读取~\verb=/proc/meminfo=,并将指定的字节转换为千字节(同时,还增加了少许信息)。 +\end{myenumerate} + +\end{sloppypar} +\clearpage +\end{CJK*} +\end{document} diff --git a/latex/6.0user.toc b/latex/6.0user.toc new file mode 100755 index 0000000..292bc1a --- /dev/null +++ b/latex/6.0user.toc @@ -0,0 +1,197 @@ +\contentsline {chapter}{产品概述}{1}{chapter*.3} +\contentsline {chapter}{关于本书}{5}{chapter*.4} +\contentsline {section}{文档约定}{5}{section*.5} +\contentsline {section}{术语简介}{7}{section*.5} +\contentsline {section}{如何使用本书}{9}{section*.5} +\ttl@change@i {\@ne }{chapter}{4em}{}{\renewcommand {\baselinestretch }{2}\bfseries \contentslabel [第\,{\thecontentslabel }\,章]{3.5em}}{}{\titlerule *{}\bfseries \contentspage }\relax +\ttl@change@v {chapter}{}{}{}\relax +\contentsline {chapter}{\numberline {1}登录和注销}{10}{chapter.1} +\contentsline {section}{\numberline {1.1}登录}{10}{section.1.1} +\contentsline {subsection}{\numberline {1.1.1}从桌面登录}{11}{subsection.1.1.1} +\contentsline {subsubsection}{\numberline {1.1.1.1}桌面的使用}{14}{subsubsection.1.1.1.1} +\contentsline {subsubsection}{\numberline {1.1.1.2}控制会话}{15}{subsubsection.1.1.1.2} +\contentsline {subsubsection}{\numberline {1.1.1.3}锁定屏幕}{16}{subsubsection.1.1.1.3} +\contentsline {subsection}{\numberline {1.1.2}从控制台登录}{16}{subsection.1.1.2} +\contentsline {section}{\numberline {1.2}文档和帮助}{18}{section.1.2} +\contentsline {section}{\numberline {1.3}注销}{19}{section.1.3} +\contentsline {subsection}{\numberline {1.3.1}从桌面注销}{19}{subsection.1.3.1} +\contentsline {subsection}{\numberline {1.3.2}从控制台注销}{19}{subsection.1.3.2} +\contentsline {section}{\numberline {1.4}远程登录}{20}{section.1.4} +\contentsline {chapter}{\numberline {2}系统基本使用}{23}{chapter.2} +\contentsline {section}{\numberline {2.1}Bash\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 简介}{23}{section.2.1} +\contentsline {subsection}{\numberline {2.1.1}命令}{23}{subsection.2.1.1} +\contentsline {subsection}{\numberline {2.1.2}文件和目录}{24}{subsection.2.1.2} +\contentsline {subsection}{\numberline {2.1.3}Bash\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 功能}{25}{subsection.2.1.3} +\contentsline {subsection}{\numberline {2.1.4}指定路径}{26}{subsection.2.1.4} +\contentsline {subsection}{\numberline {2.1.5}通配符}{26}{subsection.2.1.5} +\contentsline {subsection}{\numberline {2.1.6}less\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 和\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces more}{27}{subsection.2.1.6} +\contentsline {subsection}{\numberline {2.1.7}管道}{27}{subsection.2.1.7} +\contentsline {subsection}{\numberline {2.1.8}存档和数据压缩}{28}{subsection.2.1.8} +\contentsline {section}{\numberline {2.2}用户和访问控制}{29}{section.2.2} +\contentsline {subsection}{\numberline {2.2.1}文件系统权限}{29}{subsection.2.2.1} +\contentsline {subsection}{\numberline {2.2.2}修改文件权限}{31}{subsection.2.2.2} +\contentsline {subsection}{\numberline {2.2.3}setuid\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 位}{32}{subsection.2.2.3} +\contentsline {subsection}{\numberline {2.2.4}setgid\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 位}{32}{subsection.2.2.4} +\contentsline {subsection}{\numberline {2.2.5}粘滞位}{32}{subsection.2.2.5} +\contentsline {subsection}{\numberline {2.2.6}自主访问控制}{33}{subsection.2.2.6} +\contentsline {subsubsection}{\numberline {2.2.6.1}访问控制列表}{34}{subsubsection.2.2.6.1} +\contentsline {section}{\numberline {2.3}重要的\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces Linux\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 命令}{36}{section.2.3} +\contentsline {subsection}{\numberline {2.3.1}文件命令}{36}{subsection.2.3.1} +\contentsline {subsection}{\numberline {2.3.2}系统命令}{40}{subsection.2.3.2} +\contentsline {chapter}{\numberline {3}分区与文件系统}{43}{chapter.3} +\contentsline {section}{\numberline {3.1}磁盘分区}{43}{section.3.1} +\contentsline {subsection}{\numberline {3.1.1}命令行分区工具——parted}{43}{subsection.3.1.1} +\contentsline {subsubsection}{\numberline {3.1.1.1}parted基本用法}{43}{subsubsection.3.1.1.1} +\contentsline {subsubsection}{\numberline {3.1.1.2}创建分区表}{43}{subsubsection.3.1.1.2} +\contentsline {subsubsection}{\numberline {3.1.1.3}查看磁盘分区情况}{44}{subsubsection.3.1.1.3} +\contentsline {subsubsection}{\numberline {3.1.1.4}添加分区}{44}{subsubsection.3.1.1.4} +\contentsline {subsubsection}{\numberline {3.1.1.5}删除分区}{45}{subsubsection.3.1.1.5} +\contentsline {subsection}{\numberline {3.1.2}图形分区工具——gparted}{45}{subsection.3.1.2} +\contentsline {subsubsection}{\numberline {3.1.2.1}启动gparted程序}{45}{subsubsection.3.1.2.1} +\contentsline {subsubsection}{\numberline {3.1.2.2}gparted程序首界面}{46}{subsubsection.3.1.2.2} +\contentsline {subsubsection}{\numberline {3.1.2.3}创建分区表}{47}{subsubsection.3.1.2.3} +\contentsline {subsubsection}{\numberline {3.1.2.4}添加分区}{49}{subsubsection.3.1.2.4} +\contentsline {subsubsection}{\numberline {3.1.2.5}删除分区}{51}{subsubsection.3.1.2.5} +\contentsline {section}{\numberline {3.2}文件系统}{52}{section.3.2} +\contentsline {subsection}{\numberline {3.2.1}创建文件系统}{53}{subsection.3.2.1} +\contentsline {subsection}{\numberline {3.2.2}修复文件系统}{53}{subsection.3.2.2} +\contentsline {section}{\numberline {3.3}磁盘阵列RAID}{54}{section.3.3} +\contentsline {subsection}{\numberline {3.3.1}创建RAID}{54}{subsection.3.3.1} +\contentsline {subsection}{\numberline {3.3.2}关闭RAID}{55}{subsection.3.3.2} +\contentsline {section}{\numberline {3.4}逻辑卷管理LVM}{55}{section.3.4} +\contentsline {subsection}{\numberline {3.4.1}基本命令介绍}{56}{subsection.3.4.1} +\contentsline {subsection}{\numberline {3.4.2}逻辑卷创建}{57}{subsection.3.4.2} +\contentsline {subsection}{\numberline {3.4.3}逻辑卷扩容}{57}{subsection.3.4.3} +\contentsline {subsection}{\numberline {3.4.4}删除逻辑卷}{58}{subsection.3.4.4} +\contentsline {chapter}{\numberline {4}中文支持}{59}{chapter.4} +\contentsline {section}{\numberline {4.1}多语言环境支持}{59}{section.4.1} +\contentsline {section}{\numberline {4.2}字符编码与中文字体}{59}{section.4.2} +\contentsline {section}{\numberline {4.3}输入法}{62}{section.4.3} +\contentsline {chapter}{\numberline {5}系统管理}{63}{chapter.5} +\contentsline {section}{\numberline {5.1}关闭或重新启动系统}{63}{section.5.1} +\contentsline {subsection}{\numberline {5.1.1}关闭系统}{63}{subsection.5.1.1} +\contentsline {subsection}{\numberline {5.1.2}重启系统}{63}{subsection.5.1.2} +\contentsline {section}{\numberline {5.2}初始化设置}{63}{section.5.2} +\contentsline {subsection}{\numberline {5.2.1}设备驱动模块配置}{63}{subsection.5.2.1} +\contentsline {subsection}{\numberline {5.2.2}profile\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{64}{subsection.5.2.2} +\contentsline {subsection}{\numberline {5.2.3}issue\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{65}{subsection.5.2.3} +\contentsline {section}{\numberline {5.3}系统配置}{65}{section.5.3} +\contentsline {subsection}{\numberline {5.3.1}fstab\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{65}{subsection.5.3.1} +\contentsline {subsection}{\numberline {5.3.2}inittab\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{66}{subsection.5.3.2} +\contentsline {section}{\numberline {5.4}挂载和卸载}{69}{section.5.4} +\contentsline {subsection}{\numberline {5.4.1}挂载}{69}{subsection.5.4.1} +\contentsline {subsection}{\numberline {5.4.2}卸载}{70}{subsection.5.4.2} +\contentsline {section}{\numberline {5.5}系统监控}{70}{section.5.5} +\contentsline {section}{\numberline {5.6}数据备份与恢复}{72}{section.5.6} +\contentsline {subsection}{\numberline {5.6.1}数据备份的重要性}{72}{subsection.5.6.1} +\contentsline {subsection}{\numberline {5.6.2}工具名称}{72}{subsection.5.6.2} +\contentsline {subsection}{\numberline {5.6.3}工具安装}{72}{subsection.5.6.3} +\contentsline {subsection}{\numberline {5.6.4}备份与恢复策略}{72}{subsection.5.6.4} +\contentsline {subsubsection}{\numberline {5.6.4.1}完全备份}{72}{subsubsection.5.6.4.1} +\contentsline {subsubsection}{\numberline {5.6.4.2}增量备份}{73}{subsubsection.5.6.4.2} +\contentsline {subsubsection}{\numberline {5.6.4.3}差异备份}{74}{subsubsection.5.6.4.3} +\contentsline {subsection}{\numberline {5.6.5}工具参数}{75}{subsection.5.6.5} +\contentsline {subsection}{\numberline {5.6.6}功能演示}{76}{subsection.5.6.6} +\contentsline {chapter}{\numberline {6}软件包管理}{78}{chapter.6} +\contentsline {section}{\numberline {6.1}软件包管理机制}{78}{section.6.1} +\contentsline {subsection}{\numberline {6.1.1}软件包概述}{78}{subsection.6.1.1} +\contentsline {subsection}{\numberline {6.1.2}软件包命名约定}{78}{subsection.6.1.2} +\contentsline {subsection}{\numberline {6.1.3}维护脚本}{78}{subsection.6.1.3} +\contentsline {subsection}{\numberline {6.1.4}软件包优先级}{79}{subsection.6.1.4} +\contentsline {subsection}{\numberline {6.1.5}软件包依赖关系}{80}{subsection.6.1.5} +\contentsline {section}{\numberline {6.2}软件包管理工具}{80}{section.6.2} +\contentsline {subsection}{\numberline {6.2.1}常用的包管理工具}{80}{subsection.6.2.1} +\contentsline {subsection}{\numberline {6.2.2}dpkg}{80}{subsection.6.2.2} +\contentsline {subsection}{\numberline {6.2.3}apt}{81}{subsection.6.2.3} +\contentsline {subsubsection}{\numberline {6.2.3.1}设置软件源}{81}{subsubsection.6.2.3.1} +\contentsline {subsubsection}{\numberline {6.2.3.2}apt-get}{81}{subsubsection.6.2.3.2} +\contentsline {subsubsection}{\numberline {6.2.3.3}apt-cache}{82}{subsubsection.6.2.3.3} +\contentsline {subsection}{\numberline {6.2.4}aptitude}{82}{subsection.6.2.4} +\contentsline {subsection}{\numberline {6.2.5}安装软件包}{83}{subsection.6.2.5} +\contentsline {chapter}{\numberline {7}用户管理}{85}{chapter.7} +\contentsline {section}{\numberline {7.1}添加用户}{85}{section.7.1} +\contentsline {section}{\numberline {7.2}删除用户}{85}{section.7.2} +\contentsline {section}{\numberline {7.3}添加用户组}{85}{section.7.3} +\contentsline {section}{\numberline {7.4}删除用户组}{86}{section.7.4} +\contentsline {section}{\numberline {7.5}将用户添加到用户组}{86}{section.7.5} +\contentsline {section}{\numberline {7.6}将用户从用户组中删除}{86}{section.7.6} +\contentsline {section}{\numberline {7.7}改变用户当前所在组}{86}{section.7.7} +\contentsline {section}{\numberline {7.8}修改用户口令}{87}{section.7.8} +\contentsline {section}{\numberline {7.9}修改用户口令时限}{89}{section.7.9} +\contentsline {section}{\numberline {7.10}修改用户信息}{90}{section.7.10} +\contentsline {section}{\numberline {7.11}修改口令文件}{91}{section.7.11} +\contentsline {section}{\numberline {7.12}定义鉴别阈值}{92}{section.7.12} +\contentsline {chapter}{\numberline {8}网络管理}{93}{chapter.8} +\contentsline {section}{\numberline {8.1}网络参数配置}{93}{section.8.1} +\contentsline {subsection}{\numberline {8.1.1}interfaces\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{93}{subsection.8.1.1} +\contentsline {subsection}{\numberline {8.1.2}resolv.conf 文件}{94}{subsection.8.1.2} +\contentsline {subsection}{\numberline {8.1.3}hostname\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{95}{subsection.8.1.3} +\contentsline {subsection}{\numberline {8.1.4}services\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{95}{subsection.8.1.4} +\contentsline {subsection}{\numberline {8.1.5}hosts.allow\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{96}{subsection.8.1.5} +\contentsline {subsection}{\numberline {8.1.6}hosts.deny\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{97}{subsection.8.1.6} +\contentsline {subsection}{\numberline {8.1.7}host.conf\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 文件}{97}{subsection.8.1.7} +\contentsline {subsection}{\numberline {8.1.8}ifconfig\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces 命令}{99}{subsection.8.1.8} +\contentsline {section}{\numberline {8.2}网络服务}{102}{section.8.2} +\contentsline {subsection}{\numberline {8.2.1}Apache}{104}{subsection.8.2.1} +\contentsline {subsubsection}{\numberline {8.2.1.1}简介}{104}{subsubsection.8.2.1.1} +\contentsline {subsubsection}{\numberline {8.2.1.2}配置文件}{105}{subsubsection.8.2.1.2} +\contentsline {subsubsection}{\numberline {8.2.1.3}配置文件参数}{105}{subsubsection.8.2.1.3} +\contentsline {subsubsection}{\numberline {8.2.1.4}日志}{130}{subsubsection.8.2.1.4} +\contentsline {subsubsection}{\numberline {8.2.1.5}参考信息}{135}{subsubsection.8.2.1.5} +\contentsline {subsection}{\numberline {8.2.2}BIND}{135}{subsection.8.2.2} +\contentsline {subsubsection}{\numberline {8.2.2.1}简介}{135}{subsubsection.8.2.2.1} +\contentsline {subsubsection}{\numberline {8.2.2.2}配置文件}{135}{subsubsection.8.2.2.2} +\contentsline {subsubsection}{\numberline {8.2.2.3}配置文件参数}{135}{subsubsection.8.2.2.3} +\contentsline {subsubsection}{\numberline {8.2.2.4}参考信息}{139}{subsubsection.8.2.2.4} +\contentsline {subsubsection}{\numberline {8.2.2.5}日志}{139}{subsubsection.8.2.2.5} +\contentsline {subsection}{\numberline {8.2.3}Samba}{139}{subsection.8.2.3} +\contentsline {subsubsection}{\numberline {8.2.3.1}简介}{139}{subsubsection.8.2.3.1} +\contentsline {subsubsection}{\numberline {8.2.3.2}配置文件}{139}{subsubsection.8.2.3.2} +\contentsline {subsubsection}{\numberline {8.2.3.3}配置文件参数}{140}{subsubsection.8.2.3.3} +\contentsline {subsubsection}{\numberline {8.2.3.4}日志}{146}{subsubsection.8.2.3.4} +\contentsline {subsubsection}{\numberline {8.2.3.5}参考信息}{147}{subsubsection.8.2.3.5} +\contentsline {subsection}{\numberline {8.2.4}SSH}{147}{subsection.8.2.4} +\contentsline {subsubsection}{\numberline {8.2.4.1}简介}{147}{subsubsection.8.2.4.1} +\contentsline {subsubsection}{\numberline {8.2.4.2}配置文件}{147}{subsubsection.8.2.4.2} +\contentsline {subsubsection}{\numberline {8.2.4.3}配置文件参数}{147}{subsubsection.8.2.4.3} +\contentsline {subsection}{\numberline {8.2.5}DHCP}{151}{subsection.8.2.5} +\contentsline {subsubsection}{\numberline {8.2.5.1}简介}{151}{subsubsection.8.2.5.1} +\contentsline {subsubsection}{\numberline {8.2.5.2}配置文件}{152}{subsubsection.8.2.5.2} +\contentsline {subsubsection}{\numberline {8.2.5.3}配置文件参数}{152}{subsubsection.8.2.5.3} +\contentsline {subsubsection}{\numberline {8.2.5.4}日志}{153}{subsubsection.8.2.5.4} +\contentsline {subsubsection}{\numberline {8.2.5.5}参考信息}{154}{subsubsection.8.2.5.5} +\contentsline {section}{\numberline {8.3}bonding}{154}{section.8.3} +\contentsline {subsection}{\numberline {8.3.1}参数说明}{154}{subsection.8.3.1} +\contentsline {subsubsection}{\numberline {8.3.1.1}参数列表}{154}{subsubsection.8.3.1.1} +\contentsline {subsection}{\numberline {8.3.2}bonding模式}{156}{subsection.8.3.2} +\contentsline {subsection}{\numberline {8.3.3}配置bonding}{157}{subsection.8.3.3} +\contentsline {subsubsection}{\numberline {8.3.3.1}操作系统及环境}{157}{subsubsection.8.3.3.1} +\contentsline {subsubsection}{\numberline {8.3.3.2}配置文件}{159}{subsubsection.8.3.3.2} +\contentsline {chapter}{\numberline {9}开发}{161}{chapter.9} +\contentsline {section}{\numberline {9.1}开发环境}{161}{section.9.1} +\contentsline {subsection}{\numberline {9.1.1}java开发环境}{161}{subsection.9.1.1} +\contentsline {subsection}{\numberline {9.1.2}C开发环境}{162}{subsection.9.1.2} +\contentsline {subsection}{\numberline {9.1.3}C++开发环境}{162}{subsection.9.1.3} +\contentsline {subsection}{\numberline {9.1.4}Python开发环境}{163}{subsection.9.1.4} +\contentsline {subsection}{\numberline {9.1.5}Perl开发环境}{164}{subsection.9.1.5} +\contentsline {subsection}{\numberline {9.1.6}Shell开发环境}{165}{subsection.9.1.6} +\contentsline {subsection}{\numberline {9.1.7}Ruby开发环境}{165}{subsection.9.1.7} +\contentsline {subsection}{\numberline {9.1.8}Php开发环境}{166}{subsection.9.1.8} +\contentsline {subsection}{\numberline {9.1.9}Tcl/tk开发环境}{167}{subsection.9.1.9} +\contentsline {subsection}{\numberline {9.1.10}Lisp开发环境}{167}{subsection.9.1.10} +\contentsline {section}{\numberline {9.2}开发工具}{169}{section.9.2} +\contentsline {subsection}{\numberline {9.2.1}eclipse}{169}{subsection.9.2.1} +\contentsline {subsection}{\numberline {9.2.2}kdevelop}{170}{subsection.9.2.2} +\contentsline {subsection}{\numberline {9.2.3}emacs}{171}{subsection.9.2.3} +\contentsline {subsection}{\numberline {9.2.4}qtcreater}{172}{subsection.9.2.4} +\contentsline {chapter}{\numberline {10}常见问题解答}{173}{chapter.10} +\ttl@change@i {\@ne }{chapter}{4em}{}{\renewcommand {\baselinestretch }{2}\bfseries \contentslabel [附录 \thecontentslabel ]{3.5em}}{}{\titlerule *{}\bfseries \contentspage }\relax +\ttl@change@v {chapter}{}{}{}\relax +\contentsline {chapter}{\numberline {A}文件和目录}{183}{appendix.A} +\contentsline {section}{\numberline {A.1}\texttt {/}}{184}{section.A.1} +\contentsline {section}{\numberline {A.2}\texttt {/etc}}{185}{section.A.2} +\contentsline {section}{\numberline {A.3}\texttt {/dev}}{186}{section.A.3} +\contentsline {section}{\numberline {A.4}\texttt {/usr}}{186}{section.A.4} +\contentsline {section}{\numberline {A.5}\texttt {/var}}{187}{section.A.5} +\contentsline {section}{\numberline {A.6}\texttt {/proc}}{188}{section.A.6} +\contentsfinish diff --git a/latex/pic/.directory b/latex/pic/.directory new file mode 100755 index 0000000..3f4ff59 --- /dev/null +++ b/latex/pic/.directory @@ -0,0 +1,5 @@ +[Dolphin] +PreviewsShown=true +ShowPreview=true +Timestamp=2013,3,21,10,2,21 +Version=2 diff --git a/latex/pic/001.png b/latex/pic/001.png new file mode 100755 index 0000000..1d12191 Binary files /dev/null and b/latex/pic/001.png differ diff --git a/latex/pic/002.png b/latex/pic/002.png new file mode 100755 index 0000000..9b8f3bd Binary files /dev/null and b/latex/pic/002.png differ diff --git a/latex/pic/003.png b/latex/pic/003.png new file mode 100755 index 0000000..11f3d81 Binary files /dev/null and b/latex/pic/003.png differ diff --git a/latex/pic/005.png b/latex/pic/005.png new file mode 100755 index 0000000..64a4d48 Binary files /dev/null and b/latex/pic/005.png differ diff --git a/latex/pic/006.png b/latex/pic/006.png new file mode 100755 index 0000000..7ae18b2 Binary files /dev/null and b/latex/pic/006.png differ diff --git a/latex/pic/007.png b/latex/pic/007.png new file mode 100755 index 0000000..3d757bf Binary files /dev/null and b/latex/pic/007.png differ diff --git a/latex/pic/008.png b/latex/pic/008.png new file mode 100755 index 0000000..ea9f1ec Binary files /dev/null and b/latex/pic/008.png differ diff --git a/latex/pic/009.png b/latex/pic/009.png new file mode 100755 index 0000000..e37893a Binary files /dev/null and b/latex/pic/009.png differ diff --git a/latex/pic/010.png b/latex/pic/010.png new file mode 100755 index 0000000..3d399bf Binary files /dev/null and b/latex/pic/010.png differ diff --git a/latex/pic/011.png b/latex/pic/011.png new file mode 100755 index 0000000..9eb51b3 Binary files /dev/null and b/latex/pic/011.png differ diff --git a/latex/pic/012.png b/latex/pic/012.png new file mode 100755 index 0000000..db4992e Binary files /dev/null and b/latex/pic/012.png differ diff --git a/latex/pic/013.png b/latex/pic/013.png new file mode 100755 index 0000000..1aa37f6 Binary files /dev/null and b/latex/pic/013.png differ diff --git a/latex/pic/014.png b/latex/pic/014.png new file mode 100755 index 0000000..d2ad7d0 Binary files /dev/null and b/latex/pic/014.png differ diff --git a/latex/pic/015.png b/latex/pic/015.png new file mode 100755 index 0000000..b943ed7 Binary files /dev/null and b/latex/pic/015.png differ diff --git a/latex/pic/016.png b/latex/pic/016.png new file mode 100755 index 0000000..401732e Binary files /dev/null and b/latex/pic/016.png differ diff --git a/latex/pic/017.png b/latex/pic/017.png new file mode 100755 index 0000000..f3c115b Binary files /dev/null and b/latex/pic/017.png differ diff --git a/latex/pic/018.png b/latex/pic/018.png new file mode 100755 index 0000000..9aa06ed Binary files /dev/null and b/latex/pic/018.png differ diff --git a/latex/pic/019.png b/latex/pic/019.png new file mode 100755 index 0000000..c9e13db Binary files /dev/null and b/latex/pic/019.png differ diff --git a/latex/pic/020.png b/latex/pic/020.png new file mode 100755 index 0000000..bb75c65 Binary files /dev/null and b/latex/pic/020.png differ diff --git a/latex/pic/021.png b/latex/pic/021.png new file mode 100755 index 0000000..331b5df Binary files /dev/null and b/latex/pic/021.png differ diff --git a/latex/pic/022.png b/latex/pic/022.png new file mode 100755 index 0000000..261ee43 Binary files /dev/null and b/latex/pic/022.png differ diff --git a/latex/pic/023.png b/latex/pic/023.png new file mode 100755 index 0000000..56874ed Binary files /dev/null and b/latex/pic/023.png differ diff --git a/latex/pic/024.png b/latex/pic/024.png new file mode 100755 index 0000000..003fdda Binary files /dev/null and b/latex/pic/024.png differ diff --git a/latex/pic/025.png b/latex/pic/025.png new file mode 100755 index 0000000..1031b2f Binary files /dev/null and b/latex/pic/025.png differ diff --git a/latex/pic/026.png b/latex/pic/026.png new file mode 100755 index 0000000..8c6136c Binary files /dev/null and b/latex/pic/026.png differ diff --git a/latex/pic/027.png b/latex/pic/027.png new file mode 100755 index 0000000..52c6abb Binary files /dev/null and b/latex/pic/027.png differ diff --git a/latex/pic/028.png b/latex/pic/028.png new file mode 100755 index 0000000..cb50a2a Binary files /dev/null and b/latex/pic/028.png differ diff --git a/latex/pic/029.png b/latex/pic/029.png new file mode 100755 index 0000000..24a9a2b Binary files /dev/null and b/latex/pic/029.png differ diff --git a/latex/pic/030.png b/latex/pic/030.png new file mode 100755 index 0000000..e097c4e Binary files /dev/null and b/latex/pic/030.png differ diff --git a/latex/pic/031.png b/latex/pic/031.png new file mode 100755 index 0000000..d18884e Binary files /dev/null and b/latex/pic/031.png differ diff --git a/latex/pic/032.png b/latex/pic/032.png new file mode 100755 index 0000000..6d277c8 Binary files /dev/null and b/latex/pic/032.png differ diff --git a/latex/pic/033.png b/latex/pic/033.png new file mode 100755 index 0000000..e7882e0 Binary files /dev/null and b/latex/pic/033.png differ diff --git a/latex/pic/034.png b/latex/pic/034.png new file mode 100755 index 0000000..02abe39 Binary files /dev/null and b/latex/pic/034.png differ diff --git a/latex/pic/035.png b/latex/pic/035.png new file mode 100755 index 0000000..40505fb Binary files /dev/null and b/latex/pic/035.png differ diff --git a/latex/pic/036.png b/latex/pic/036.png new file mode 100755 index 0000000..dc54348 Binary files /dev/null and b/latex/pic/036.png differ diff --git a/latex/pic/037.png b/latex/pic/037.png new file mode 100755 index 0000000..7a103ca Binary files /dev/null and b/latex/pic/037.png differ diff --git a/latex/pic/038.png b/latex/pic/038.png new file mode 100755 index 0000000..9bf0da4 Binary files /dev/null and b/latex/pic/038.png differ diff --git a/latex/pic/039.png b/latex/pic/039.png new file mode 100755 index 0000000..901169e Binary files /dev/null and b/latex/pic/039.png differ diff --git a/latex/pic/040.png b/latex/pic/040.png new file mode 100755 index 0000000..188e3b9 Binary files /dev/null and b/latex/pic/040.png differ diff --git a/latex/pic/041.png b/latex/pic/041.png new file mode 100755 index 0000000..5c26a37 Binary files /dev/null and b/latex/pic/041.png differ diff --git a/latex/pic/042.png b/latex/pic/042.png new file mode 100755 index 0000000..e70392a Binary files /dev/null and b/latex/pic/042.png differ diff --git a/latex/pic/043.png b/latex/pic/043.png new file mode 100755 index 0000000..9c5c53b Binary files /dev/null and b/latex/pic/043.png differ diff --git a/latex/pic/044.png b/latex/pic/044.png new file mode 100755 index 0000000..1cdb83e Binary files /dev/null and b/latex/pic/044.png differ diff --git a/latex/pic/045.png b/latex/pic/045.png new file mode 100755 index 0000000..a439c5f Binary files /dev/null and b/latex/pic/045.png differ diff --git a/latex/pic/046.png b/latex/pic/046.png new file mode 100755 index 0000000..64dcf5b Binary files /dev/null and b/latex/pic/046.png differ diff --git a/latex/pic/047.png b/latex/pic/047.png new file mode 100755 index 0000000..2522d65 Binary files /dev/null and b/latex/pic/047.png differ diff --git a/latex/pic/048.png b/latex/pic/048.png new file mode 100755 index 0000000..54ae0af Binary files /dev/null and b/latex/pic/048.png differ diff --git a/latex/pic/058.png b/latex/pic/058.png new file mode 100755 index 0000000..85d0300 Binary files /dev/null and b/latex/pic/058.png differ diff --git a/latex/pic/059.png b/latex/pic/059.png new file mode 100755 index 0000000..575d88e Binary files /dev/null and b/latex/pic/059.png differ diff --git a/latex/pic/060.png b/latex/pic/060.png new file mode 100755 index 0000000..8c7175c Binary files /dev/null and b/latex/pic/060.png differ diff --git a/latex/pic/061.png b/latex/pic/061.png new file mode 100755 index 0000000..043a795 Binary files /dev/null and b/latex/pic/061.png differ diff --git a/latex/pic/062-1.png b/latex/pic/062-1.png new file mode 100755 index 0000000..e8c8878 Binary files /dev/null and b/latex/pic/062-1.png differ diff --git a/latex/pic/062.png b/latex/pic/062.png new file mode 100755 index 0000000..6b6e28a Binary files /dev/null and b/latex/pic/062.png differ diff --git a/latex/pic/063.png b/latex/pic/063.png new file mode 100755 index 0000000..5ec756b Binary files /dev/null and b/latex/pic/063.png differ diff --git a/latex/pic/064.png b/latex/pic/064.png new file mode 100755 index 0000000..d6ccd73 Binary files /dev/null and b/latex/pic/064.png differ diff --git a/latex/pic/065.png b/latex/pic/065.png new file mode 100755 index 0000000..6cd0bc6 Binary files /dev/null and b/latex/pic/065.png differ diff --git a/latex/pic/066.png b/latex/pic/066.png new file mode 100755 index 0000000..9e49a4a Binary files /dev/null and b/latex/pic/066.png differ diff --git a/latex/pic/067.png b/latex/pic/067.png new file mode 100755 index 0000000..83e8cf0 Binary files /dev/null and b/latex/pic/067.png differ diff --git a/latex/pic/068.png b/latex/pic/068.png new file mode 100755 index 0000000..e2aa0e3 Binary files /dev/null and b/latex/pic/068.png differ diff --git a/latex/pic/069.png b/latex/pic/069.png new file mode 100755 index 0000000..65dbb83 Binary files /dev/null and b/latex/pic/069.png differ diff --git a/latex/pic/070.png b/latex/pic/070.png new file mode 100755 index 0000000..731bb34 Binary files /dev/null and b/latex/pic/070.png differ diff --git a/latex/pic/071.png b/latex/pic/071.png new file mode 100755 index 0000000..ee007c8 Binary files /dev/null and b/latex/pic/071.png differ diff --git a/latex/pic/072.png b/latex/pic/072.png new file mode 100755 index 0000000..d96382a Binary files /dev/null and b/latex/pic/072.png differ diff --git a/latex/pic/073.png b/latex/pic/073.png new file mode 100755 index 0000000..88e019b Binary files /dev/null and b/latex/pic/073.png differ diff --git a/latex/pic/074.png b/latex/pic/074.png new file mode 100755 index 0000000..8841914 Binary files /dev/null and b/latex/pic/074.png differ diff --git a/latex/pic/075.png b/latex/pic/075.png new file mode 100755 index 0000000..73a477c Binary files /dev/null and b/latex/pic/075.png differ diff --git a/latex/pic/076.png b/latex/pic/076.png new file mode 100755 index 0000000..3bc0bc7 Binary files /dev/null and b/latex/pic/076.png differ diff --git a/latex/pic/077.png b/latex/pic/077.png new file mode 100755 index 0000000..809e43c Binary files /dev/null and b/latex/pic/077.png differ diff --git a/latex/pic/078.png b/latex/pic/078.png new file mode 100755 index 0000000..0a9e704 Binary files /dev/null and b/latex/pic/078.png differ diff --git a/latex/pic/079.png b/latex/pic/079.png new file mode 100755 index 0000000..8a68318 Binary files /dev/null and b/latex/pic/079.png differ diff --git a/latex/pic/20150410/.directory b/latex/pic/20150410/.directory new file mode 100755 index 0000000..a26d486 --- /dev/null +++ b/latex/pic/20150410/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2015,4,13,14,1,36 +Version=3 diff --git a/latex/pic/20150410/001.png b/latex/pic/20150410/001.png new file mode 100755 index 0000000..5e62e10 Binary files /dev/null and b/latex/pic/20150410/001.png differ diff --git a/latex/pic/20150410/002-2.png b/latex/pic/20150410/002-2.png new file mode 100755 index 0000000..e52755b Binary files /dev/null and b/latex/pic/20150410/002-2.png differ diff --git a/latex/pic/20150410/002.png b/latex/pic/20150410/002.png new file mode 100755 index 0000000..6bde757 Binary files /dev/null and b/latex/pic/20150410/002.png differ diff --git a/latex/pic/20150410/003.png b/latex/pic/20150410/003.png new file mode 100755 index 0000000..0f70994 Binary files /dev/null and b/latex/pic/20150410/003.png differ diff --git a/latex/pic/20150410/004.png b/latex/pic/20150410/004.png new file mode 100755 index 0000000..551eb28 Binary files /dev/null and b/latex/pic/20150410/004.png differ diff --git a/latex/pic/20150410/005.png b/latex/pic/20150410/005.png new file mode 100755 index 0000000..c613b1c Binary files /dev/null and b/latex/pic/20150410/005.png differ diff --git a/latex/pic/20150410/006.png b/latex/pic/20150410/006.png new file mode 100755 index 0000000..44da221 Binary files /dev/null and b/latex/pic/20150410/006.png differ diff --git a/latex/pic/20150410/007.png b/latex/pic/20150410/007.png new file mode 100755 index 0000000..6648ec3 Binary files /dev/null and b/latex/pic/20150410/007.png differ diff --git a/latex/pic/20150410/008.png b/latex/pic/20150410/008.png new file mode 100755 index 0000000..e89015f Binary files /dev/null and b/latex/pic/20150410/008.png differ diff --git a/latex/pic/20150410/009.png b/latex/pic/20150410/009.png new file mode 100755 index 0000000..db8e265 Binary files /dev/null and b/latex/pic/20150410/009.png differ diff --git a/latex/pic/20150410/010.png b/latex/pic/20150410/010.png new file mode 100755 index 0000000..8266956 Binary files /dev/null and b/latex/pic/20150410/010.png differ diff --git a/latex/pic/20150410/011.png b/latex/pic/20150410/011.png new file mode 100755 index 0000000..aaa9814 Binary files /dev/null and b/latex/pic/20150410/011.png differ diff --git a/latex/pic/20150410/012.png b/latex/pic/20150410/012.png new file mode 100755 index 0000000..a4c7496 Binary files /dev/null and b/latex/pic/20150410/012.png differ diff --git a/latex/pic/20150410/013.png b/latex/pic/20150410/013.png new file mode 100755 index 0000000..4a3a049 Binary files /dev/null and b/latex/pic/20150410/013.png differ diff --git a/latex/pic/20150410/014.png b/latex/pic/20150410/014.png new file mode 100755 index 0000000..2f46a66 Binary files /dev/null and b/latex/pic/20150410/014.png differ diff --git a/latex/pic/20150410/015.png b/latex/pic/20150410/015.png new file mode 100755 index 0000000..ee12024 Binary files /dev/null and b/latex/pic/20150410/015.png differ diff --git a/latex/pic/20150410/016.png b/latex/pic/20150410/016.png new file mode 100755 index 0000000..610489b Binary files /dev/null and b/latex/pic/20150410/016.png differ diff --git a/latex/pic/20150410/017.png b/latex/pic/20150410/017.png new file mode 100755 index 0000000..a9cf711 Binary files /dev/null and b/latex/pic/20150410/017.png differ diff --git a/latex/pic/20150410/018.png b/latex/pic/20150410/018.png new file mode 100755 index 0000000..738b0e3 Binary files /dev/null and b/latex/pic/20150410/018.png differ diff --git a/latex/pic/20150410/019.png b/latex/pic/20150410/019.png new file mode 100755 index 0000000..30b5a27 Binary files /dev/null and b/latex/pic/20150410/019.png differ diff --git a/latex/pic/20150410/020.png b/latex/pic/20150410/020.png new file mode 100755 index 0000000..20e5d08 Binary files /dev/null and b/latex/pic/20150410/020.png differ diff --git a/latex/pic/aptitude.png b/latex/pic/aptitude.png new file mode 100755 index 0000000..6212f40 Binary files /dev/null and b/latex/pic/aptitude.png differ diff --git a/latex/pic/audit.odg b/latex/pic/audit.odg new file mode 100755 index 0000000..b045ea5 Binary files /dev/null and b/latex/pic/audit.odg differ diff --git a/latex/pic/audit.png b/latex/pic/audit.png new file mode 100755 index 0000000..26031c4 Binary files /dev/null and b/latex/pic/audit.png differ diff --git a/latex/pic/audit.svg b/latex/pic/audit.svg new file mode 100755 index 0000000..f3ae69b --- /dev/null +++ b/latex/pic/audit.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + audit.rules + + + + + + + + + auditctl + + + + + + + auditd.conf + + + + + + + + + auditd + + + + + + + audit + + + + + + + + + + + + + + + + kernel + + + + + + + + + app + + + + + + + + + audispd + + + + + + + audit.log + + + + + + + + + + + + + + + aureport + + + + + + + + + ausearch + + + + + + + + + + + + + + + + + + + + + autrace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/latex/pic/audit1.png b/latex/pic/audit1.png new file mode 100755 index 0000000..bead190 Binary files /dev/null and b/latex/pic/audit1.png differ diff --git a/latex/pic/audit2.png b/latex/pic/audit2.png new file mode 100755 index 0000000..603f7ce Binary files /dev/null and b/latex/pic/audit2.png differ diff --git a/latex/pic/backup1.png b/latex/pic/backup1.png new file mode 100755 index 0000000..3f23705 Binary files /dev/null and b/latex/pic/backup1.png differ diff --git a/latex/pic/backup2.png b/latex/pic/backup2.png new file mode 100755 index 0000000..290ee7f Binary files /dev/null and b/latex/pic/backup2.png differ diff --git a/latex/pic/backup3.png b/latex/pic/backup3.png new file mode 100755 index 0000000..5f756db Binary files /dev/null and b/latex/pic/backup3.png differ diff --git a/latex/pic/down1.png b/latex/pic/down1.png new file mode 100755 index 0000000..9faacf8 Binary files /dev/null and b/latex/pic/down1.png differ diff --git a/latex/pic/down2.png b/latex/pic/down2.png new file mode 100755 index 0000000..eb0c40e Binary files /dev/null and b/latex/pic/down2.png differ diff --git a/latex/pic/down3.png b/latex/pic/down3.png new file mode 100755 index 0000000..937c1a6 Binary files /dev/null and b/latex/pic/down3.png differ diff --git a/latex/pic/echo1.png b/latex/pic/echo1.png new file mode 100755 index 0000000..b25a5c6 Binary files /dev/null and b/latex/pic/echo1.png differ diff --git a/latex/pic/echo2.png b/latex/pic/echo2.png new file mode 100755 index 0000000..db13303 Binary files /dev/null and b/latex/pic/echo2.png differ diff --git a/latex/pic/eclipse.png b/latex/pic/eclipse.png new file mode 100755 index 0000000..dfe0921 Binary files /dev/null and b/latex/pic/eclipse.png differ diff --git a/latex/pic/emacs.png b/latex/pic/emacs.png new file mode 100755 index 0000000..1a3a1df Binary files /dev/null and b/latex/pic/emacs.png differ diff --git a/latex/pic/expert01.png b/latex/pic/expert01.png new file mode 100755 index 0000000..770140a Binary files /dev/null and b/latex/pic/expert01.png differ diff --git a/latex/pic/expert02.png b/latex/pic/expert02.png new file mode 100755 index 0000000..8fa9f36 Binary files /dev/null and b/latex/pic/expert02.png differ diff --git a/latex/pic/expert03.png b/latex/pic/expert03.png new file mode 100755 index 0000000..5f4aa5d Binary files /dev/null and b/latex/pic/expert03.png differ diff --git a/latex/pic/expert04.png b/latex/pic/expert04.png new file mode 100755 index 0000000..475b122 Binary files /dev/null and b/latex/pic/expert04.png differ diff --git a/latex/pic/expert05.png b/latex/pic/expert05.png new file mode 100755 index 0000000..8e4b45c Binary files /dev/null and b/latex/pic/expert05.png differ diff --git a/latex/pic/expert06.png b/latex/pic/expert06.png new file mode 100755 index 0000000..43c878c Binary files /dev/null and b/latex/pic/expert06.png differ diff --git a/latex/pic/expert07.png b/latex/pic/expert07.png new file mode 100755 index 0000000..2d59ddc Binary files /dev/null and b/latex/pic/expert07.png differ diff --git a/latex/pic/expert08.png b/latex/pic/expert08.png new file mode 100755 index 0000000..f1a95d5 Binary files /dev/null and b/latex/pic/expert08.png differ diff --git a/latex/pic/expert09.png b/latex/pic/expert09.png new file mode 100755 index 0000000..163aa47 Binary files /dev/null and b/latex/pic/expert09.png differ diff --git a/latex/pic/expert10.png b/latex/pic/expert10.png new file mode 100755 index 0000000..b26b66f Binary files /dev/null and b/latex/pic/expert10.png differ diff --git a/latex/pic/expert11.png b/latex/pic/expert11.png new file mode 100755 index 0000000..07d0fc5 Binary files /dev/null and b/latex/pic/expert11.png differ diff --git a/latex/pic/expert12.png b/latex/pic/expert12.png new file mode 100755 index 0000000..ac71ee7 Binary files /dev/null and b/latex/pic/expert12.png differ diff --git a/latex/pic/expert13.png b/latex/pic/expert13.png new file mode 100755 index 0000000..ace82bc Binary files /dev/null and b/latex/pic/expert13.png differ diff --git a/latex/pic/expert14.png b/latex/pic/expert14.png new file mode 100755 index 0000000..5406b46 Binary files /dev/null and b/latex/pic/expert14.png differ diff --git a/latex/pic/expert15.png b/latex/pic/expert15.png new file mode 100755 index 0000000..d3bbdaf Binary files /dev/null and b/latex/pic/expert15.png differ diff --git a/latex/pic/expert16.png b/latex/pic/expert16.png new file mode 100755 index 0000000..ffff6c1 Binary files /dev/null and b/latex/pic/expert16.png differ diff --git a/latex/pic/fingerprinter-bk.png b/latex/pic/fingerprinter-bk.png new file mode 100755 index 0000000..8414130 Binary files /dev/null and b/latex/pic/fingerprinter-bk.png differ diff --git a/latex/pic/fingerprinter.png b/latex/pic/fingerprinter.png new file mode 100755 index 0000000..7c3d286 Binary files /dev/null and b/latex/pic/fingerprinter.png differ diff --git a/latex/pic/fingerprinterbk.png b/latex/pic/fingerprinterbk.png new file mode 100755 index 0000000..0054cd7 Binary files /dev/null and b/latex/pic/fingerprinterbk.png differ diff --git a/latex/pic/firefox/.directory b/latex/pic/firefox/.directory new file mode 100755 index 0000000..d7c18a5 --- /dev/null +++ b/latex/pic/firefox/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,6,10,14,59,18 +Version=3 diff --git a/latex/pic/firefox/01.png b/latex/pic/firefox/01.png new file mode 100755 index 0000000..02844a9 Binary files /dev/null and b/latex/pic/firefox/01.png differ diff --git a/latex/pic/firefox/02.png b/latex/pic/firefox/02.png new file mode 100755 index 0000000..48a6f37 Binary files /dev/null and b/latex/pic/firefox/02.png differ diff --git a/latex/pic/firefox/03.png b/latex/pic/firefox/03.png new file mode 100755 index 0000000..2ccf411 Binary files /dev/null and b/latex/pic/firefox/03.png differ diff --git a/latex/pic/firefox/04.png b/latex/pic/firefox/04.png new file mode 100755 index 0000000..a5a901c Binary files /dev/null and b/latex/pic/firefox/04.png differ diff --git a/latex/pic/firefox/05.png b/latex/pic/firefox/05.png new file mode 100755 index 0000000..b33a610 Binary files /dev/null and b/latex/pic/firefox/05.png differ diff --git a/latex/pic/firefox/06.png b/latex/pic/firefox/06.png new file mode 100755 index 0000000..f0ec170 Binary files /dev/null and b/latex/pic/firefox/06.png differ diff --git a/latex/pic/firefox/07.png b/latex/pic/firefox/07.png new file mode 100755 index 0000000..08ce41a Binary files /dev/null and b/latex/pic/firefox/07.png differ diff --git a/latex/pic/firefox/08.png b/latex/pic/firefox/08.png new file mode 100755 index 0000000..06c0c12 Binary files /dev/null and b/latex/pic/firefox/08.png differ diff --git a/latex/pic/firefox/1.png b/latex/pic/firefox/1.png new file mode 100755 index 0000000..d7cd0af Binary files /dev/null and b/latex/pic/firefox/1.png differ diff --git a/latex/pic/firefox/bookmarks.png b/latex/pic/firefox/bookmarks.png new file mode 100755 index 0000000..3a180ce Binary files /dev/null and b/latex/pic/firefox/bookmarks.png differ diff --git a/latex/pic/firefox/engine.png b/latex/pic/firefox/engine.png new file mode 100755 index 0000000..62f93ae Binary files /dev/null and b/latex/pic/firefox/engine.png differ diff --git a/latex/pic/firefox/extensions.png b/latex/pic/firefox/extensions.png new file mode 100755 index 0000000..8a458a5 Binary files /dev/null and b/latex/pic/firefox/extensions.png differ diff --git a/latex/pic/firefox/key.png b/latex/pic/firefox/key.png new file mode 100755 index 0000000..1da687c Binary files /dev/null and b/latex/pic/firefox/key.png differ diff --git a/latex/pic/firefox/manage.png b/latex/pic/firefox/manage.png new file mode 100755 index 0000000..962aa69 Binary files /dev/null and b/latex/pic/firefox/manage.png differ diff --git a/latex/pic/firefox/subscribe1.png b/latex/pic/firefox/subscribe1.png new file mode 100755 index 0000000..77b0778 Binary files /dev/null and b/latex/pic/firefox/subscribe1.png differ diff --git a/latex/pic/firefox/subscribe2.png b/latex/pic/firefox/subscribe2.png new file mode 100755 index 0000000..c05d5c9 Binary files /dev/null and b/latex/pic/firefox/subscribe2.png differ diff --git a/latex/pic/gnome-system-monitor.png b/latex/pic/gnome-system-monitor.png new file mode 100755 index 0000000..42ff091 Binary files /dev/null and b/latex/pic/gnome-system-monitor.png differ diff --git a/latex/pic/gnome.png b/latex/pic/gnome.png new file mode 100755 index 0000000..a2cd1a7 Binary files /dev/null and b/latex/pic/gnome.png differ diff --git a/latex/pic/gnome1.png b/latex/pic/gnome1.png new file mode 100755 index 0000000..095092f Binary files /dev/null and b/latex/pic/gnome1.png differ diff --git a/latex/pic/gnome2.png b/latex/pic/gnome2.png new file mode 100755 index 0000000..b27465e Binary files /dev/null and b/latex/pic/gnome2.png differ diff --git a/latex/pic/gnome3.png b/latex/pic/gnome3.png new file mode 100755 index 0000000..22b795e Binary files /dev/null and b/latex/pic/gnome3.png differ diff --git a/latex/pic/gnome4.png b/latex/pic/gnome4.png new file mode 100755 index 0000000..88fffdf Binary files /dev/null and b/latex/pic/gnome4.png differ diff --git a/latex/pic/gnome5.png b/latex/pic/gnome5.png new file mode 100755 index 0000000..3d45da3 Binary files /dev/null and b/latex/pic/gnome5.png differ diff --git a/latex/pic/gparted01.png b/latex/pic/gparted01.png new file mode 100755 index 0000000..3265970 Binary files /dev/null and b/latex/pic/gparted01.png differ diff --git a/latex/pic/gparted02.png b/latex/pic/gparted02.png new file mode 100755 index 0000000..e93b4db Binary files /dev/null and b/latex/pic/gparted02.png differ diff --git a/latex/pic/gparted03.png b/latex/pic/gparted03.png new file mode 100755 index 0000000..bf695e8 Binary files /dev/null and b/latex/pic/gparted03.png differ diff --git a/latex/pic/gparted04.png b/latex/pic/gparted04.png new file mode 100755 index 0000000..123bc2f Binary files /dev/null and b/latex/pic/gparted04.png differ diff --git a/latex/pic/gparted05.png b/latex/pic/gparted05.png new file mode 100755 index 0000000..0002559 Binary files /dev/null and b/latex/pic/gparted05.png differ diff --git a/latex/pic/gparted06.png b/latex/pic/gparted06.png new file mode 100755 index 0000000..54e8376 Binary files /dev/null and b/latex/pic/gparted06.png differ diff --git a/latex/pic/gparted07.png b/latex/pic/gparted07.png new file mode 100755 index 0000000..2293a78 Binary files /dev/null and b/latex/pic/gparted07.png differ diff --git a/latex/pic/gparted08.png b/latex/pic/gparted08.png new file mode 100755 index 0000000..cce390c Binary files /dev/null and b/latex/pic/gparted08.png differ diff --git a/latex/pic/gparted09.png b/latex/pic/gparted09.png new file mode 100755 index 0000000..9448d2a Binary files /dev/null and b/latex/pic/gparted09.png differ diff --git a/latex/pic/gparted10.png b/latex/pic/gparted10.png new file mode 100755 index 0000000..16af662 Binary files /dev/null and b/latex/pic/gparted10.png differ diff --git a/latex/pic/gparted11.png b/latex/pic/gparted11.png new file mode 100755 index 0000000..d9e0a46 Binary files /dev/null and b/latex/pic/gparted11.png differ diff --git a/latex/pic/gparted12.png b/latex/pic/gparted12.png new file mode 100755 index 0000000..35342d2 Binary files /dev/null and b/latex/pic/gparted12.png differ diff --git a/latex/pic/gparted13.png b/latex/pic/gparted13.png new file mode 100755 index 0000000..182b09f Binary files /dev/null and b/latex/pic/gparted13.png differ diff --git a/latex/pic/gparted14.png b/latex/pic/gparted14.png new file mode 100755 index 0000000..c6c420d Binary files /dev/null and b/latex/pic/gparted14.png differ diff --git a/latex/pic/gparted15.png b/latex/pic/gparted15.png new file mode 100755 index 0000000..3352b41 Binary files /dev/null and b/latex/pic/gparted15.png differ diff --git a/latex/pic/gparted16.png b/latex/pic/gparted16.png new file mode 100755 index 0000000..f3aac8f Binary files /dev/null and b/latex/pic/gparted16.png differ diff --git a/latex/pic/gparted17.png b/latex/pic/gparted17.png new file mode 100755 index 0000000..ed23315 Binary files /dev/null and b/latex/pic/gparted17.png differ diff --git a/latex/pic/grub.png b/latex/pic/grub.png new file mode 100755 index 0000000..fadacc0 Binary files /dev/null and b/latex/pic/grub.png differ diff --git a/latex/pic/grub1.png b/latex/pic/grub1.png new file mode 100755 index 0000000..300e4cf Binary files /dev/null and b/latex/pic/grub1.png differ diff --git a/latex/pic/grub2.png b/latex/pic/grub2.png new file mode 100755 index 0000000..62b64d1 Binary files /dev/null and b/latex/pic/grub2.png differ diff --git a/latex/pic/grub3.png b/latex/pic/grub3.png new file mode 100755 index 0000000..e9efec0 Binary files /dev/null and b/latex/pic/grub3.png differ diff --git a/latex/pic/icon/.directory b/latex/pic/icon/.directory new file mode 100755 index 0000000..3cdd1de --- /dev/null +++ b/latex/pic/icon/.directory @@ -0,0 +1,3 @@ +[Dolphin] +ShowPreview=true +Timestamp=2010,5,18,17,24,13 diff --git a/latex/pic/icon/caution.png b/latex/pic/icon/caution.png new file mode 100755 index 0000000..264e93d Binary files /dev/null and b/latex/pic/icon/caution.png differ diff --git a/latex/pic/icon/hint.png b/latex/pic/icon/hint.png new file mode 100755 index 0000000..0791d36 Binary files /dev/null and b/latex/pic/icon/hint.png differ diff --git a/latex/pic/icon/note.png b/latex/pic/icon/note.png new file mode 100755 index 0000000..64e2f54 Binary files /dev/null and b/latex/pic/icon/note.png differ diff --git a/latex/pic/icon/star.png b/latex/pic/icon/star.png new file mode 100755 index 0000000..fe44558 Binary files /dev/null and b/latex/pic/icon/star.png differ diff --git a/latex/pic/icon/warning.png b/latex/pic/icon/warning.png new file mode 100755 index 0000000..c6d93b0 Binary files /dev/null and b/latex/pic/icon/warning.png differ diff --git a/latex/pic/install.png b/latex/pic/install.png new file mode 100755 index 0000000..f87297d Binary files /dev/null and b/latex/pic/install.png differ diff --git a/latex/pic/install01.png b/latex/pic/install01.png new file mode 100755 index 0000000..8648c28 Binary files /dev/null and b/latex/pic/install01.png differ diff --git a/latex/pic/install02.png b/latex/pic/install02.png new file mode 100755 index 0000000..30336ca Binary files /dev/null and b/latex/pic/install02.png differ diff --git a/latex/pic/kde.png b/latex/pic/kde.png new file mode 100755 index 0000000..942512b Binary files /dev/null and b/latex/pic/kde.png differ diff --git a/latex/pic/kdevelop.png b/latex/pic/kdevelop.png new file mode 100755 index 0000000..f58ddab Binary files /dev/null and b/latex/pic/kdevelop.png differ diff --git a/latex/pic/linx-logo.png b/latex/pic/linx-logo.png new file mode 100755 index 0000000..ade0460 Binary files /dev/null and b/latex/pic/linx-logo.png differ diff --git a/latex/pic/linx.png b/latex/pic/linx.png new file mode 100755 index 0000000..c9ba0b8 Binary files /dev/null and b/latex/pic/linx.png differ diff --git a/latex/pic/login-1-bbk.png b/latex/pic/login-1-bbk.png new file mode 100755 index 0000000..152f800 Binary files /dev/null and b/latex/pic/login-1-bbk.png differ diff --git a/latex/pic/login-1-bk.png b/latex/pic/login-1-bk.png new file mode 100755 index 0000000..16ee00e Binary files /dev/null and b/latex/pic/login-1-bk.png differ diff --git a/latex/pic/login-1.png b/latex/pic/login-1.png new file mode 100755 index 0000000..8384673 Binary files /dev/null and b/latex/pic/login-1.png differ diff --git a/latex/pic/login-2-bbk.png b/latex/pic/login-2-bbk.png new file mode 100755 index 0000000..ac0046c Binary files /dev/null and b/latex/pic/login-2-bbk.png differ diff --git a/latex/pic/login-2-bk.png b/latex/pic/login-2-bk.png new file mode 100755 index 0000000..a7a6c8f Binary files /dev/null and b/latex/pic/login-2-bk.png differ diff --git a/latex/pic/login-2.png b/latex/pic/login-2.png new file mode 100755 index 0000000..2a9bfc7 Binary files /dev/null and b/latex/pic/login-2.png differ diff --git a/latex/pic/login.png b/latex/pic/login.png new file mode 100755 index 0000000..79c618d Binary files /dev/null and b/latex/pic/login.png differ diff --git a/latex/pic/mac.odg b/latex/pic/mac.odg new file mode 100755 index 0000000..bde858e Binary files /dev/null and b/latex/pic/mac.odg differ diff --git a/latex/pic/mac1.png b/latex/pic/mac1.png new file mode 100755 index 0000000..8562f8d Binary files /dev/null and b/latex/pic/mac1.png differ diff --git a/latex/pic/mac2.png b/latex/pic/mac2.png new file mode 100755 index 0000000..70857fe Binary files /dev/null and b/latex/pic/mac2.png differ diff --git a/latex/pic/mac3.png b/latex/pic/mac3.png new file mode 100755 index 0000000..d88b162 Binary files /dev/null and b/latex/pic/mac3.png differ diff --git a/latex/pic/mac4.png b/latex/pic/mac4.png new file mode 100755 index 0000000..fcd401c Binary files /dev/null and b/latex/pic/mac4.png differ diff --git a/latex/pic/monitor.png b/latex/pic/monitor.png new file mode 100755 index 0000000..702c403 Binary files /dev/null and b/latex/pic/monitor.png differ diff --git a/latex/pic/n01.png b/latex/pic/n01.png new file mode 100755 index 0000000..d84885c Binary files /dev/null and b/latex/pic/n01.png differ diff --git a/latex/pic/n02.png b/latex/pic/n02.png new file mode 100755 index 0000000..acac13a Binary files /dev/null and b/latex/pic/n02.png differ diff --git a/latex/pic/n03.png b/latex/pic/n03.png new file mode 100755 index 0000000..d813adc Binary files /dev/null and b/latex/pic/n03.png differ diff --git a/latex/pic/n04.png b/latex/pic/n04.png new file mode 100755 index 0000000..c58554e Binary files /dev/null and b/latex/pic/n04.png differ diff --git a/latex/pic/n05.png b/latex/pic/n05.png new file mode 100755 index 0000000..9352025 Binary files /dev/null and b/latex/pic/n05.png differ diff --git a/latex/pic/n06.png b/latex/pic/n06.png new file mode 100755 index 0000000..4ce74a6 Binary files /dev/null and b/latex/pic/n06.png differ diff --git a/latex/pic/n07.png b/latex/pic/n07.png new file mode 100755 index 0000000..d155b43 Binary files /dev/null and b/latex/pic/n07.png differ diff --git a/latex/pic/n08.png b/latex/pic/n08.png new file mode 100755 index 0000000..43012a9 Binary files /dev/null and b/latex/pic/n08.png differ diff --git a/latex/pic/n09.png b/latex/pic/n09.png new file mode 100755 index 0000000..c0402d4 Binary files /dev/null and b/latex/pic/n09.png differ diff --git a/latex/pic/n10.png b/latex/pic/n10.png new file mode 100755 index 0000000..be165d7 Binary files /dev/null and b/latex/pic/n10.png differ diff --git a/latex/pic/n11.png b/latex/pic/n11.png new file mode 100755 index 0000000..445ee0d Binary files /dev/null and b/latex/pic/n11.png differ diff --git a/latex/pic/n12.png b/latex/pic/n12.png new file mode 100755 index 0000000..09ea967 Binary files /dev/null and b/latex/pic/n12.png differ diff --git a/latex/pic/n13.png b/latex/pic/n13.png new file mode 100755 index 0000000..74d2521 Binary files /dev/null and b/latex/pic/n13.png differ diff --git a/latex/pic/n14.png b/latex/pic/n14.png new file mode 100755 index 0000000..bd11748 Binary files /dev/null and b/latex/pic/n14.png differ diff --git a/latex/pic/n15.png b/latex/pic/n15.png new file mode 100755 index 0000000..777c76a Binary files /dev/null and b/latex/pic/n15.png differ diff --git a/latex/pic/n16.png b/latex/pic/n16.png new file mode 100755 index 0000000..930d7e6 Binary files /dev/null and b/latex/pic/n16.png differ diff --git a/latex/pic/n17.png b/latex/pic/n17.png new file mode 100755 index 0000000..b038963 Binary files /dev/null and b/latex/pic/n17.png differ diff --git a/latex/pic/n18.png b/latex/pic/n18.png new file mode 100755 index 0000000..1aefeae Binary files /dev/null and b/latex/pic/n18.png differ diff --git a/latex/pic/n19.png b/latex/pic/n19.png new file mode 100755 index 0000000..31dc622 Binary files /dev/null and b/latex/pic/n19.png differ diff --git a/latex/pic/n20.png b/latex/pic/n20.png new file mode 100755 index 0000000..4b3cabe Binary files /dev/null and b/latex/pic/n20.png differ diff --git a/latex/pic/n21.png b/latex/pic/n21.png new file mode 100755 index 0000000..920804f Binary files /dev/null and b/latex/pic/n21.png differ diff --git a/latex/pic/n22.png b/latex/pic/n22.png new file mode 100755 index 0000000..8e0c73c Binary files /dev/null and b/latex/pic/n22.png differ diff --git a/latex/pic/n23.png b/latex/pic/n23.png new file mode 100755 index 0000000..28b4024 Binary files /dev/null and b/latex/pic/n23.png differ diff --git a/latex/pic/n24.png b/latex/pic/n24.png new file mode 100755 index 0000000..18f3857 Binary files /dev/null and b/latex/pic/n24.png differ diff --git a/latex/pic/n25.png b/latex/pic/n25.png new file mode 100755 index 0000000..7ef3bd3 Binary files /dev/null and b/latex/pic/n25.png differ diff --git a/latex/pic/n26.png b/latex/pic/n26.png new file mode 100755 index 0000000..2f30677 Binary files /dev/null and b/latex/pic/n26.png differ diff --git a/latex/pic/n27.png b/latex/pic/n27.png new file mode 100755 index 0000000..fb5213b Binary files /dev/null and b/latex/pic/n27.png differ diff --git a/latex/pic/n28.png b/latex/pic/n28.png new file mode 100755 index 0000000..4b15562 Binary files /dev/null and b/latex/pic/n28.png differ diff --git a/latex/pic/n29.png b/latex/pic/n29.png new file mode 100755 index 0000000..b762cad Binary files /dev/null and b/latex/pic/n29.png differ diff --git a/latex/pic/n30.png b/latex/pic/n30.png new file mode 100755 index 0000000..b80ff62 Binary files /dev/null and b/latex/pic/n30.png differ diff --git a/latex/pic/n31.png b/latex/pic/n31.png new file mode 100755 index 0000000..88ff9e0 Binary files /dev/null and b/latex/pic/n31.png differ diff --git a/latex/pic/new/.directory b/latex/pic/new/.directory new file mode 100755 index 0000000..a1a4b91 --- /dev/null +++ b/latex/pic/new/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,1,22,11,26,11 +Version=3 diff --git a/latex/pic/new/auto001.png b/latex/pic/new/auto001.png new file mode 100755 index 0000000..2653d7e Binary files /dev/null and b/latex/pic/new/auto001.png differ diff --git a/latex/pic/new/auto002.png b/latex/pic/new/auto002.png new file mode 100755 index 0000000..9d35dc7 Binary files /dev/null and b/latex/pic/new/auto002.png differ diff --git a/latex/pic/new/auto003.png b/latex/pic/new/auto003.png new file mode 100755 index 0000000..7afc760 Binary files /dev/null and b/latex/pic/new/auto003.png differ diff --git a/latex/pic/new/auto004.png b/latex/pic/new/auto004.png new file mode 100755 index 0000000..d2e7e18 Binary files /dev/null and b/latex/pic/new/auto004.png differ diff --git a/latex/pic/new/auto005-1.png b/latex/pic/new/auto005-1.png new file mode 100755 index 0000000..626683f Binary files /dev/null and b/latex/pic/new/auto005-1.png differ diff --git a/latex/pic/new/auto005.png b/latex/pic/new/auto005.png new file mode 100755 index 0000000..e03e431 Binary files /dev/null and b/latex/pic/new/auto005.png differ diff --git a/latex/pic/new/auto006.png b/latex/pic/new/auto006.png new file mode 100755 index 0000000..900120d Binary files /dev/null and b/latex/pic/new/auto006.png differ diff --git a/latex/pic/new/auto007.png b/latex/pic/new/auto007.png new file mode 100755 index 0000000..700de9f Binary files /dev/null and b/latex/pic/new/auto007.png differ diff --git a/latex/pic/new/auto008.png b/latex/pic/new/auto008.png new file mode 100755 index 0000000..8f023e0 Binary files /dev/null and b/latex/pic/new/auto008.png differ diff --git a/latex/pic/new/auto009.png b/latex/pic/new/auto009.png new file mode 100755 index 0000000..75ae917 Binary files /dev/null and b/latex/pic/new/auto009.png differ diff --git a/latex/pic/new/auto010.png b/latex/pic/new/auto010.png new file mode 100755 index 0000000..9c11344 Binary files /dev/null and b/latex/pic/new/auto010.png differ diff --git a/latex/pic/new/auto011.png b/latex/pic/new/auto011.png new file mode 100755 index 0000000..e7f3727 Binary files /dev/null and b/latex/pic/new/auto011.png differ diff --git a/latex/pic/new/auto012.png b/latex/pic/new/auto012.png new file mode 100755 index 0000000..473afdf Binary files /dev/null and b/latex/pic/new/auto012.png differ diff --git a/latex/pic/new/auto013.png b/latex/pic/new/auto013.png new file mode 100755 index 0000000..51b3129 Binary files /dev/null and b/latex/pic/new/auto013.png differ diff --git a/latex/pic/new/auto014.png b/latex/pic/new/auto014.png new file mode 100755 index 0000000..1b444f7 Binary files /dev/null and b/latex/pic/new/auto014.png differ diff --git a/latex/pic/new/auto015.png b/latex/pic/new/auto015.png new file mode 100755 index 0000000..b1d435f Binary files /dev/null and b/latex/pic/new/auto015.png differ diff --git a/latex/pic/new/auto016.png b/latex/pic/new/auto016.png new file mode 100755 index 0000000..253beb2 Binary files /dev/null and b/latex/pic/new/auto016.png differ diff --git a/latex/pic/new/auto017.png b/latex/pic/new/auto017.png new file mode 100755 index 0000000..afba684 Binary files /dev/null and b/latex/pic/new/auto017.png differ diff --git a/latex/pic/new/auto018.png b/latex/pic/new/auto018.png new file mode 100755 index 0000000..62186cb Binary files /dev/null and b/latex/pic/new/auto018.png differ diff --git a/latex/pic/new/auto019.png b/latex/pic/new/auto019.png new file mode 100755 index 0000000..d773801 Binary files /dev/null and b/latex/pic/new/auto019.png differ diff --git a/latex/pic/new/auto02.png b/latex/pic/new/auto02.png new file mode 100755 index 0000000..88ae770 Binary files /dev/null and b/latex/pic/new/auto02.png differ diff --git a/latex/pic/new/auto020.png b/latex/pic/new/auto020.png new file mode 100755 index 0000000..974de9f Binary files /dev/null and b/latex/pic/new/auto020.png differ diff --git a/latex/pic/new/auto021.png b/latex/pic/new/auto021.png new file mode 100755 index 0000000..9ca4254 Binary files /dev/null and b/latex/pic/new/auto021.png differ diff --git a/latex/pic/new/auto022.png b/latex/pic/new/auto022.png new file mode 100755 index 0000000..0ef1bad Binary files /dev/null and b/latex/pic/new/auto022.png differ diff --git a/latex/pic/new/auto023.png b/latex/pic/new/auto023.png new file mode 100755 index 0000000..7d754c5 Binary files /dev/null and b/latex/pic/new/auto023.png differ diff --git a/latex/pic/new/auto024.png b/latex/pic/new/auto024.png new file mode 100755 index 0000000..eb5dd22 Binary files /dev/null and b/latex/pic/new/auto024.png differ diff --git a/latex/pic/new/auto025.png b/latex/pic/new/auto025.png new file mode 100755 index 0000000..4c38a9a Binary files /dev/null and b/latex/pic/new/auto025.png differ diff --git a/latex/pic/new/auto026.png b/latex/pic/new/auto026.png new file mode 100755 index 0000000..fc38ddd Binary files /dev/null and b/latex/pic/new/auto026.png differ diff --git a/latex/pic/new/auto027.png b/latex/pic/new/auto027.png new file mode 100755 index 0000000..e1a9cc4 Binary files /dev/null and b/latex/pic/new/auto027.png differ diff --git a/latex/pic/new/auto028.png b/latex/pic/new/auto028.png new file mode 100755 index 0000000..e46738f Binary files /dev/null and b/latex/pic/new/auto028.png differ diff --git a/latex/pic/new/auto029.png b/latex/pic/new/auto029.png new file mode 100755 index 0000000..406b573 Binary files /dev/null and b/latex/pic/new/auto029.png differ diff --git a/latex/pic/new/auto03.png b/latex/pic/new/auto03.png new file mode 100755 index 0000000..92cadac Binary files /dev/null and b/latex/pic/new/auto03.png differ diff --git a/latex/pic/new/auto030.png b/latex/pic/new/auto030.png new file mode 100755 index 0000000..9848eef Binary files /dev/null and b/latex/pic/new/auto030.png differ diff --git a/latex/pic/new/auto031.png b/latex/pic/new/auto031.png new file mode 100755 index 0000000..0b600ba Binary files /dev/null and b/latex/pic/new/auto031.png differ diff --git a/latex/pic/new/auto032.png b/latex/pic/new/auto032.png new file mode 100755 index 0000000..653e70e Binary files /dev/null and b/latex/pic/new/auto032.png differ diff --git a/latex/pic/new/auto033.png b/latex/pic/new/auto033.png new file mode 100755 index 0000000..c2f2f23 Binary files /dev/null and b/latex/pic/new/auto033.png differ diff --git a/latex/pic/new/auto034.png b/latex/pic/new/auto034.png new file mode 100755 index 0000000..b11d60f Binary files /dev/null and b/latex/pic/new/auto034.png differ diff --git a/latex/pic/new/auto035.png b/latex/pic/new/auto035.png new file mode 100755 index 0000000..bb5ef5f Binary files /dev/null and b/latex/pic/new/auto035.png differ diff --git a/latex/pic/new/auto036.png b/latex/pic/new/auto036.png new file mode 100755 index 0000000..5b63e73 Binary files /dev/null and b/latex/pic/new/auto036.png differ diff --git a/latex/pic/new/auto04.png b/latex/pic/new/auto04.png new file mode 100755 index 0000000..0ebb9ea Binary files /dev/null and b/latex/pic/new/auto04.png differ diff --git a/latex/pic/new/auto06.png b/latex/pic/new/auto06.png new file mode 100755 index 0000000..bdb9a04 Binary files /dev/null and b/latex/pic/new/auto06.png differ diff --git a/latex/pic/new/auto07.png b/latex/pic/new/auto07.png new file mode 100755 index 0000000..bffe4a2 Binary files /dev/null and b/latex/pic/new/auto07.png differ diff --git a/latex/pic/new/auto08.png b/latex/pic/new/auto08.png new file mode 100755 index 0000000..9ca4254 Binary files /dev/null and b/latex/pic/new/auto08.png differ diff --git a/latex/pic/new/auto16.png b/latex/pic/new/auto16.png new file mode 100755 index 0000000..388f640 Binary files /dev/null and b/latex/pic/new/auto16.png differ diff --git a/latex/pic/new/auto17.png b/latex/pic/new/auto17.png new file mode 100755 index 0000000..388f640 Binary files /dev/null and b/latex/pic/new/auto17.png differ diff --git a/latex/pic/new/auto18.png b/latex/pic/new/auto18.png new file mode 100755 index 0000000..3ec7789 Binary files /dev/null and b/latex/pic/new/auto18.png differ diff --git a/latex/pic/new/auto19.png b/latex/pic/new/auto19.png new file mode 100755 index 0000000..7f215db Binary files /dev/null and b/latex/pic/new/auto19.png differ diff --git a/latex/pic/new/auto20.png b/latex/pic/new/auto20.png new file mode 100755 index 0000000..69aed44 Binary files /dev/null and b/latex/pic/new/auto20.png differ diff --git a/latex/pic/new/auto21.png b/latex/pic/new/auto21.png new file mode 100755 index 0000000..54ee54d Binary files /dev/null and b/latex/pic/new/auto21.png differ diff --git a/latex/pic/new/auto22.png b/latex/pic/new/auto22.png new file mode 100755 index 0000000..fadacc0 Binary files /dev/null and b/latex/pic/new/auto22.png differ diff --git a/latex/pic/new/ch01.png b/latex/pic/new/ch01.png new file mode 100755 index 0000000..5da9e71 Binary files /dev/null and b/latex/pic/new/ch01.png differ diff --git a/latex/pic/new/ch02.png b/latex/pic/new/ch02.png new file mode 100755 index 0000000..c56d059 Binary files /dev/null and b/latex/pic/new/ch02.png differ diff --git a/latex/pic/new/ch03.png b/latex/pic/new/ch03.png new file mode 100755 index 0000000..634d830 Binary files /dev/null and b/latex/pic/new/ch03.png differ diff --git a/latex/pic/new/ch04.png b/latex/pic/new/ch04.png new file mode 100755 index 0000000..051234d Binary files /dev/null and b/latex/pic/new/ch04.png differ diff --git a/latex/pic/new/ch05.png b/latex/pic/new/ch05.png new file mode 100755 index 0000000..ceea3a8 Binary files /dev/null and b/latex/pic/new/ch05.png differ diff --git a/latex/pic/new/ch06.png b/latex/pic/new/ch06.png new file mode 100755 index 0000000..c008297 Binary files /dev/null and b/latex/pic/new/ch06.png differ diff --git a/latex/pic/new/ch07.png b/latex/pic/new/ch07.png new file mode 100755 index 0000000..51012e5 Binary files /dev/null and b/latex/pic/new/ch07.png differ diff --git a/latex/pic/new/ch08.png b/latex/pic/new/ch08.png new file mode 100755 index 0000000..a11ae0f Binary files /dev/null and b/latex/pic/new/ch08.png differ diff --git a/latex/pic/new/ch09.png b/latex/pic/new/ch09.png new file mode 100755 index 0000000..d545888 Binary files /dev/null and b/latex/pic/new/ch09.png differ diff --git a/latex/pic/new/ch10.png b/latex/pic/new/ch10.png new file mode 100755 index 0000000..e75d013 Binary files /dev/null and b/latex/pic/new/ch10.png differ diff --git a/latex/pic/new/ch11.png b/latex/pic/new/ch11.png new file mode 100755 index 0000000..1466386 Binary files /dev/null and b/latex/pic/new/ch11.png differ diff --git a/latex/pic/new/ch12.png b/latex/pic/new/ch12.png new file mode 100755 index 0000000..2779944 Binary files /dev/null and b/latex/pic/new/ch12.png differ diff --git a/latex/pic/new/ch13.png b/latex/pic/new/ch13.png new file mode 100755 index 0000000..539755e Binary files /dev/null and b/latex/pic/new/ch13.png differ diff --git a/latex/pic/new/ch14.png b/latex/pic/new/ch14.png new file mode 100755 index 0000000..fc1368e Binary files /dev/null and b/latex/pic/new/ch14.png differ diff --git a/latex/pic/new/ch15.png b/latex/pic/new/ch15.png new file mode 100755 index 0000000..482120c Binary files /dev/null and b/latex/pic/new/ch15.png differ diff --git a/latex/pic/new/ch16.png b/latex/pic/new/ch16.png new file mode 100755 index 0000000..cbc0820 Binary files /dev/null and b/latex/pic/new/ch16.png differ diff --git a/latex/pic/new/ch17.png b/latex/pic/new/ch17.png new file mode 100755 index 0000000..85efac2 Binary files /dev/null and b/latex/pic/new/ch17.png differ diff --git a/latex/pic/new/ch18.png b/latex/pic/new/ch18.png new file mode 100755 index 0000000..78e61d5 Binary files /dev/null and b/latex/pic/new/ch18.png differ diff --git a/latex/pic/new/ch19.png b/latex/pic/new/ch19.png new file mode 100755 index 0000000..3182acf Binary files /dev/null and b/latex/pic/new/ch19.png differ diff --git a/latex/pic/new/ch20.png b/latex/pic/new/ch20.png new file mode 100755 index 0000000..88840df Binary files /dev/null and b/latex/pic/new/ch20.png differ diff --git a/latex/pic/new/ch21.png b/latex/pic/new/ch21.png new file mode 100755 index 0000000..64080da Binary files /dev/null and b/latex/pic/new/ch21.png differ diff --git a/latex/pic/new/ch22.png b/latex/pic/new/ch22.png new file mode 100755 index 0000000..35c089f Binary files /dev/null and b/latex/pic/new/ch22.png differ diff --git a/latex/pic/new/ch23.png b/latex/pic/new/ch23.png new file mode 100755 index 0000000..1e09f79 Binary files /dev/null and b/latex/pic/new/ch23.png differ diff --git a/latex/pic/new/ch24.png b/latex/pic/new/ch24.png new file mode 100755 index 0000000..1844235 Binary files /dev/null and b/latex/pic/new/ch24.png differ diff --git a/latex/pic/new/ch25.png b/latex/pic/new/ch25.png new file mode 100755 index 0000000..c469dab Binary files /dev/null and b/latex/pic/new/ch25.png differ diff --git a/latex/pic/new/ch26.png b/latex/pic/new/ch26.png new file mode 100755 index 0000000..8feac03 Binary files /dev/null and b/latex/pic/new/ch26.png differ diff --git a/latex/pic/new/ch27.png b/latex/pic/new/ch27.png new file mode 100755 index 0000000..4700e80 Binary files /dev/null and b/latex/pic/new/ch27.png differ diff --git a/latex/pic/new/ch28.png b/latex/pic/new/ch28.png new file mode 100755 index 0000000..6f8a045 Binary files /dev/null and b/latex/pic/new/ch28.png differ diff --git a/latex/pic/new/ch29.png b/latex/pic/new/ch29.png new file mode 100755 index 0000000..0c8470f Binary files /dev/null and b/latex/pic/new/ch29.png differ diff --git a/latex/pic/new/ch30.png b/latex/pic/new/ch30.png new file mode 100755 index 0000000..209de33 Binary files /dev/null and b/latex/pic/new/ch30.png differ diff --git a/latex/pic/new/ch31.png b/latex/pic/new/ch31.png new file mode 100755 index 0000000..fe0d8cd Binary files /dev/null and b/latex/pic/new/ch31.png differ diff --git a/latex/pic/new/ch32.png b/latex/pic/new/ch32.png new file mode 100755 index 0000000..7db3a26 Binary files /dev/null and b/latex/pic/new/ch32.png differ diff --git a/latex/pic/new/ch33.png b/latex/pic/new/ch33.png new file mode 100755 index 0000000..8e3decf Binary files /dev/null and b/latex/pic/new/ch33.png differ diff --git a/latex/pic/new/ch34.png b/latex/pic/new/ch34.png new file mode 100755 index 0000000..48abdac Binary files /dev/null and b/latex/pic/new/ch34.png differ diff --git a/latex/pic/new/ch35.png b/latex/pic/new/ch35.png new file mode 100755 index 0000000..25e56fb Binary files /dev/null and b/latex/pic/new/ch35.png differ diff --git a/latex/pic/new/ch36.png b/latex/pic/new/ch36.png new file mode 100755 index 0000000..ca46c46 Binary files /dev/null and b/latex/pic/new/ch36.png differ diff --git a/latex/pic/new/ch37.png b/latex/pic/new/ch37.png new file mode 100755 index 0000000..dc488bc Binary files /dev/null and b/latex/pic/new/ch37.png differ diff --git a/latex/pic/new/ch38.png b/latex/pic/new/ch38.png new file mode 100755 index 0000000..c80a8d8 Binary files /dev/null and b/latex/pic/new/ch38.png differ diff --git a/latex/pic/new/ch39.png b/latex/pic/new/ch39.png new file mode 100755 index 0000000..ccd52a4 Binary files /dev/null and b/latex/pic/new/ch39.png differ diff --git a/latex/pic/new/ch40.png b/latex/pic/new/ch40.png new file mode 100755 index 0000000..d592bb9 Binary files /dev/null and b/latex/pic/new/ch40.png differ diff --git a/latex/pic/new/ch41.png b/latex/pic/new/ch41.png new file mode 100755 index 0000000..86f5905 Binary files /dev/null and b/latex/pic/new/ch41.png differ diff --git a/latex/pic/new/expert001.png b/latex/pic/new/expert001.png new file mode 100755 index 0000000..770140a Binary files /dev/null and b/latex/pic/new/expert001.png differ diff --git a/latex/pic/new/expert002.png b/latex/pic/new/expert002.png new file mode 100755 index 0000000..8fa9f36 Binary files /dev/null and b/latex/pic/new/expert002.png differ diff --git a/latex/pic/new/expert003.png b/latex/pic/new/expert003.png new file mode 100755 index 0000000..5f4aa5d Binary files /dev/null and b/latex/pic/new/expert003.png differ diff --git a/latex/pic/new/expert004.png b/latex/pic/new/expert004.png new file mode 100755 index 0000000..475b122 Binary files /dev/null and b/latex/pic/new/expert004.png differ diff --git a/latex/pic/new/expert005.png b/latex/pic/new/expert005.png new file mode 100755 index 0000000..8e4b45c Binary files /dev/null and b/latex/pic/new/expert005.png differ diff --git a/latex/pic/new/expert006.png b/latex/pic/new/expert006.png new file mode 100755 index 0000000..43c878c Binary files /dev/null and b/latex/pic/new/expert006.png differ diff --git a/latex/pic/new/expert007.png b/latex/pic/new/expert007.png new file mode 100755 index 0000000..b605a03 Binary files /dev/null and b/latex/pic/new/expert007.png differ diff --git a/latex/pic/new/expert008.png b/latex/pic/new/expert008.png new file mode 100755 index 0000000..f1a95d5 Binary files /dev/null and b/latex/pic/new/expert008.png differ diff --git a/latex/pic/new/expert009.png b/latex/pic/new/expert009.png new file mode 100755 index 0000000..163aa47 Binary files /dev/null and b/latex/pic/new/expert009.png differ diff --git a/latex/pic/new/expert010.png b/latex/pic/new/expert010.png new file mode 100755 index 0000000..b26b66f Binary files /dev/null and b/latex/pic/new/expert010.png differ diff --git a/latex/pic/new/expert011.png b/latex/pic/new/expert011.png new file mode 100755 index 0000000..07d0fc5 Binary files /dev/null and b/latex/pic/new/expert011.png differ diff --git a/latex/pic/new/expert012.png b/latex/pic/new/expert012.png new file mode 100755 index 0000000..ac71ee7 Binary files /dev/null and b/latex/pic/new/expert012.png differ diff --git a/latex/pic/new/expert013.png b/latex/pic/new/expert013.png new file mode 100755 index 0000000..ace82bc Binary files /dev/null and b/latex/pic/new/expert013.png differ diff --git a/latex/pic/new/expert014.png b/latex/pic/new/expert014.png new file mode 100755 index 0000000..5406b46 Binary files /dev/null and b/latex/pic/new/expert014.png differ diff --git a/latex/pic/new/install01.png b/latex/pic/new/install01.png new file mode 100755 index 0000000..8648c28 Binary files /dev/null and b/latex/pic/new/install01.png differ diff --git a/latex/pic/new/install02.png b/latex/pic/new/install02.png new file mode 100755 index 0000000..30336ca Binary files /dev/null and b/latex/pic/new/install02.png differ diff --git a/latex/pic/new/n001.png b/latex/pic/new/n001.png new file mode 100755 index 0000000..d84885c Binary files /dev/null and b/latex/pic/new/n001.png differ diff --git a/latex/pic/new/n002.png b/latex/pic/new/n002.png new file mode 100755 index 0000000..acac13a Binary files /dev/null and b/latex/pic/new/n002.png differ diff --git a/latex/pic/new/n003.png b/latex/pic/new/n003.png new file mode 100755 index 0000000..e8c8878 Binary files /dev/null and b/latex/pic/new/n003.png differ diff --git a/latex/pic/new/n004.png b/latex/pic/new/n004.png new file mode 100755 index 0000000..6b6e28a Binary files /dev/null and b/latex/pic/new/n004.png differ diff --git a/latex/pic/new/n005.png b/latex/pic/new/n005.png new file mode 100755 index 0000000..5ec756b Binary files /dev/null and b/latex/pic/new/n005.png differ diff --git a/latex/pic/new/n006.png b/latex/pic/new/n006.png new file mode 100755 index 0000000..d6ccd73 Binary files /dev/null and b/latex/pic/new/n006.png differ diff --git a/latex/pic/new/n007.png b/latex/pic/new/n007.png new file mode 100755 index 0000000..6cd0bc6 Binary files /dev/null and b/latex/pic/new/n007.png differ diff --git a/latex/pic/new/n008.png b/latex/pic/new/n008.png new file mode 100755 index 0000000..9e49a4a Binary files /dev/null and b/latex/pic/new/n008.png differ diff --git a/latex/pic/new/n009.png b/latex/pic/new/n009.png new file mode 100755 index 0000000..83e8cf0 Binary files /dev/null and b/latex/pic/new/n009.png differ diff --git a/latex/pic/new/n010.png b/latex/pic/new/n010.png new file mode 100755 index 0000000..e2aa0e3 Binary files /dev/null and b/latex/pic/new/n010.png differ diff --git a/latex/pic/new/n011.png b/latex/pic/new/n011.png new file mode 100755 index 0000000..731bb34 Binary files /dev/null and b/latex/pic/new/n011.png differ diff --git a/latex/pic/new/n012.png b/latex/pic/new/n012.png new file mode 100755 index 0000000..d813adc Binary files /dev/null and b/latex/pic/new/n012.png differ diff --git a/latex/pic/new/n013.png b/latex/pic/new/n013.png new file mode 100755 index 0000000..7ae18b2 Binary files /dev/null and b/latex/pic/new/n013.png differ diff --git a/latex/pic/new/n014-2.png b/latex/pic/new/n014-2.png new file mode 100755 index 0000000..d3c9831 Binary files /dev/null and b/latex/pic/new/n014-2.png differ diff --git a/latex/pic/new/n014.png b/latex/pic/new/n014.png new file mode 100755 index 0000000..c58554e Binary files /dev/null and b/latex/pic/new/n014.png differ diff --git a/latex/pic/new/n015.png b/latex/pic/new/n015.png new file mode 100755 index 0000000..9352025 Binary files /dev/null and b/latex/pic/new/n015.png differ diff --git a/latex/pic/new/n016.png b/latex/pic/new/n016.png new file mode 100755 index 0000000..4ce74a6 Binary files /dev/null and b/latex/pic/new/n016.png differ diff --git a/latex/pic/new/n017.png b/latex/pic/new/n017.png new file mode 100755 index 0000000..d155b43 Binary files /dev/null and b/latex/pic/new/n017.png differ diff --git a/latex/pic/new/n018.png b/latex/pic/new/n018.png new file mode 100755 index 0000000..43012a9 Binary files /dev/null and b/latex/pic/new/n018.png differ diff --git a/latex/pic/new/n019.png b/latex/pic/new/n019.png new file mode 100755 index 0000000..c0402d4 Binary files /dev/null and b/latex/pic/new/n019.png differ diff --git a/latex/pic/new/n020.png b/latex/pic/new/n020.png new file mode 100755 index 0000000..db4992e Binary files /dev/null and b/latex/pic/new/n020.png differ diff --git a/latex/pic/new/n021.png b/latex/pic/new/n021.png new file mode 100755 index 0000000..1aa37f6 Binary files /dev/null and b/latex/pic/new/n021.png differ diff --git a/latex/pic/new/n022.png b/latex/pic/new/n022.png new file mode 100755 index 0000000..d2ad7d0 Binary files /dev/null and b/latex/pic/new/n022.png differ diff --git a/latex/pic/new/n023.png b/latex/pic/new/n023.png new file mode 100755 index 0000000..b943ed7 Binary files /dev/null and b/latex/pic/new/n023.png differ diff --git a/latex/pic/new/n024.png b/latex/pic/new/n024.png new file mode 100755 index 0000000..b4b5e6b Binary files /dev/null and b/latex/pic/new/n024.png differ diff --git a/latex/pic/new/n025.png b/latex/pic/new/n025.png new file mode 100755 index 0000000..445ee0d Binary files /dev/null and b/latex/pic/new/n025.png differ diff --git a/latex/pic/new/n026.png b/latex/pic/new/n026.png new file mode 100755 index 0000000..09ea967 Binary files /dev/null and b/latex/pic/new/n026.png differ diff --git a/latex/pic/new/n027.png b/latex/pic/new/n027.png new file mode 100755 index 0000000..96c248b Binary files /dev/null and b/latex/pic/new/n027.png differ diff --git a/latex/pic/new/n028.png b/latex/pic/new/n028.png new file mode 100755 index 0000000..bd11748 Binary files /dev/null and b/latex/pic/new/n028.png differ diff --git a/latex/pic/new/n029.png b/latex/pic/new/n029.png new file mode 100755 index 0000000..777c76a Binary files /dev/null and b/latex/pic/new/n029.png differ diff --git a/latex/pic/new/n030.png b/latex/pic/new/n030.png new file mode 100755 index 0000000..261ee43 Binary files /dev/null and b/latex/pic/new/n030.png differ diff --git a/latex/pic/new/n031.png b/latex/pic/new/n031.png new file mode 100755 index 0000000..56874ed Binary files /dev/null and b/latex/pic/new/n031.png differ diff --git a/latex/pic/new/n032.png b/latex/pic/new/n032.png new file mode 100755 index 0000000..003fdda Binary files /dev/null and b/latex/pic/new/n032.png differ diff --git a/latex/pic/new/n033.png b/latex/pic/new/n033.png new file mode 100755 index 0000000..1031b2f Binary files /dev/null and b/latex/pic/new/n033.png differ diff --git a/latex/pic/new/n034.png b/latex/pic/new/n034.png new file mode 100755 index 0000000..8c6136c Binary files /dev/null and b/latex/pic/new/n034.png differ diff --git a/latex/pic/new/n035.png b/latex/pic/new/n035.png new file mode 100755 index 0000000..52c6abb Binary files /dev/null and b/latex/pic/new/n035.png differ diff --git a/latex/pic/new/n036.png b/latex/pic/new/n036.png new file mode 100755 index 0000000..cb50a2a Binary files /dev/null and b/latex/pic/new/n036.png differ diff --git a/latex/pic/new/n037.png b/latex/pic/new/n037.png new file mode 100755 index 0000000..24a9a2b Binary files /dev/null and b/latex/pic/new/n037.png differ diff --git a/latex/pic/new/n038.png b/latex/pic/new/n038.png new file mode 100755 index 0000000..e097c4e Binary files /dev/null and b/latex/pic/new/n038.png differ diff --git a/latex/pic/new/n039.png b/latex/pic/new/n039.png new file mode 100755 index 0000000..d18884e Binary files /dev/null and b/latex/pic/new/n039.png differ diff --git a/latex/pic/new/n040.png b/latex/pic/new/n040.png new file mode 100755 index 0000000..fa378f6 Binary files /dev/null and b/latex/pic/new/n040.png differ diff --git a/latex/pic/new/n041.png b/latex/pic/new/n041.png new file mode 100755 index 0000000..e7882e0 Binary files /dev/null and b/latex/pic/new/n041.png differ diff --git a/latex/pic/new/n042.png b/latex/pic/new/n042.png new file mode 100755 index 0000000..c88a98c Binary files /dev/null and b/latex/pic/new/n042.png differ diff --git a/latex/pic/new/n043.png b/latex/pic/new/n043.png new file mode 100755 index 0000000..40505fb Binary files /dev/null and b/latex/pic/new/n043.png differ diff --git a/latex/pic/new/n044-1.png b/latex/pic/new/n044-1.png new file mode 100755 index 0000000..6f4b6e0 Binary files /dev/null and b/latex/pic/new/n044-1.png differ diff --git a/latex/pic/new/n044-2.png b/latex/pic/new/n044-2.png new file mode 100755 index 0000000..146e4c8 Binary files /dev/null and b/latex/pic/new/n044-2.png differ diff --git a/latex/pic/new/n044.png b/latex/pic/new/n044.png new file mode 100755 index 0000000..1cdc7fc Binary files /dev/null and b/latex/pic/new/n044.png differ diff --git a/latex/pic/new/n045-1.png b/latex/pic/new/n045-1.png new file mode 100755 index 0000000..eec4823 Binary files /dev/null and b/latex/pic/new/n045-1.png differ diff --git a/latex/pic/new/n045.png b/latex/pic/new/n045.png new file mode 100755 index 0000000..7a103ca Binary files /dev/null and b/latex/pic/new/n045.png differ diff --git a/latex/pic/new/n046.png b/latex/pic/new/n046.png new file mode 100755 index 0000000..9bf0da4 Binary files /dev/null and b/latex/pic/new/n046.png differ diff --git a/latex/pic/new/n047.png b/latex/pic/new/n047.png new file mode 100755 index 0000000..172926d Binary files /dev/null and b/latex/pic/new/n047.png differ diff --git a/latex/pic/new/n048.png b/latex/pic/new/n048.png new file mode 100755 index 0000000..930d7e6 Binary files /dev/null and b/latex/pic/new/n048.png differ diff --git a/latex/pic/new/n049.png b/latex/pic/new/n049.png new file mode 100755 index 0000000..9f3d48c Binary files /dev/null and b/latex/pic/new/n049.png differ diff --git a/latex/pic/new/n050.png b/latex/pic/new/n050.png new file mode 100755 index 0000000..1aefeae Binary files /dev/null and b/latex/pic/new/n050.png differ diff --git a/latex/pic/new/n051-1.png b/latex/pic/new/n051-1.png new file mode 100755 index 0000000..159c71c Binary files /dev/null and b/latex/pic/new/n051-1.png differ diff --git a/latex/pic/new/n051-2.png b/latex/pic/new/n051-2.png new file mode 100755 index 0000000..f182dfe Binary files /dev/null and b/latex/pic/new/n051-2.png differ diff --git a/latex/pic/new/n051-3.png b/latex/pic/new/n051-3.png new file mode 100755 index 0000000..a508f1d Binary files /dev/null and b/latex/pic/new/n051-3.png differ diff --git a/latex/pic/new/n051.png b/latex/pic/new/n051.png new file mode 100755 index 0000000..9c5c53b Binary files /dev/null and b/latex/pic/new/n051.png differ diff --git a/latex/pic/new/n052.png b/latex/pic/new/n052.png new file mode 100755 index 0000000..31dc622 Binary files /dev/null and b/latex/pic/new/n052.png differ diff --git a/latex/pic/new/n053.png b/latex/pic/new/n053.png new file mode 100755 index 0000000..4b3cabe Binary files /dev/null and b/latex/pic/new/n053.png differ diff --git a/latex/pic/new/n054.png b/latex/pic/new/n054.png new file mode 100755 index 0000000..920804f Binary files /dev/null and b/latex/pic/new/n054.png differ diff --git a/latex/pic/new/n055.png b/latex/pic/new/n055.png new file mode 100755 index 0000000..8e0c73c Binary files /dev/null and b/latex/pic/new/n055.png differ diff --git a/latex/pic/new/n056.png b/latex/pic/new/n056.png new file mode 100755 index 0000000..28b4024 Binary files /dev/null and b/latex/pic/new/n056.png differ diff --git a/latex/pic/new/n057.png b/latex/pic/new/n057.png new file mode 100755 index 0000000..18f3857 Binary files /dev/null and b/latex/pic/new/n057.png differ diff --git a/latex/pic/new/n058.png b/latex/pic/new/n058.png new file mode 100755 index 0000000..7ef3bd3 Binary files /dev/null and b/latex/pic/new/n058.png differ diff --git a/latex/pic/new/n059.png b/latex/pic/new/n059.png new file mode 100755 index 0000000..2f30677 Binary files /dev/null and b/latex/pic/new/n059.png differ diff --git a/latex/pic/new/n060.png b/latex/pic/new/n060.png new file mode 100755 index 0000000..fb5213b Binary files /dev/null and b/latex/pic/new/n060.png differ diff --git a/latex/pic/new/n061.png b/latex/pic/new/n061.png new file mode 100755 index 0000000..0a9e704 Binary files /dev/null and b/latex/pic/new/n061.png differ diff --git a/latex/pic/new/n062.png b/latex/pic/new/n062.png new file mode 100755 index 0000000..4b15562 Binary files /dev/null and b/latex/pic/new/n062.png differ diff --git a/latex/pic/new/n063-1.png b/latex/pic/new/n063-1.png new file mode 100755 index 0000000..5b7a64a Binary files /dev/null and b/latex/pic/new/n063-1.png differ diff --git a/latex/pic/new/n063.png b/latex/pic/new/n063.png new file mode 100755 index 0000000..b762cad Binary files /dev/null and b/latex/pic/new/n063.png differ diff --git a/latex/pic/new/n064.png b/latex/pic/new/n064.png new file mode 100755 index 0000000..b80ff62 Binary files /dev/null and b/latex/pic/new/n064.png differ diff --git a/latex/pic/new/n065.png b/latex/pic/new/n065.png new file mode 100755 index 0000000..88ff9e0 Binary files /dev/null and b/latex/pic/new/n065.png differ diff --git a/latex/pic/new/n066.png b/latex/pic/new/n066.png new file mode 100755 index 0000000..8c7175c Binary files /dev/null and b/latex/pic/new/n066.png differ diff --git a/latex/pic/new/n067.png b/latex/pic/new/n067.png new file mode 100755 index 0000000..043a795 Binary files /dev/null and b/latex/pic/new/n067.png differ diff --git a/latex/pic/new/n068.png b/latex/pic/new/n068.png new file mode 100755 index 0000000..732b83f Binary files /dev/null and b/latex/pic/new/n068.png differ diff --git a/latex/pic/openoffice.org/.directory b/latex/pic/openoffice.org/.directory new file mode 100755 index 0000000..e9952b9 --- /dev/null +++ b/latex/pic/openoffice.org/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,5,22,14,38,3 +Version=3 diff --git a/latex/pic/openoffice.org/base.png b/latex/pic/openoffice.org/base.png new file mode 100755 index 0000000..df279d9 Binary files /dev/null and b/latex/pic/openoffice.org/base.png differ diff --git a/latex/pic/openoffice.org/calc.png b/latex/pic/openoffice.org/calc.png new file mode 100755 index 0000000..0ff7fa5 Binary files /dev/null and b/latex/pic/openoffice.org/calc.png differ diff --git a/latex/pic/openoffice.org/convert1.png b/latex/pic/openoffice.org/convert1.png new file mode 100755 index 0000000..b093cb1 Binary files /dev/null and b/latex/pic/openoffice.org/convert1.png differ diff --git a/latex/pic/openoffice.org/convert2.png b/latex/pic/openoffice.org/convert2.png new file mode 100755 index 0000000..abb5c65 Binary files /dev/null and b/latex/pic/openoffice.org/convert2.png differ diff --git a/latex/pic/openoffice.org/convert3.png b/latex/pic/openoffice.org/convert3.png new file mode 100755 index 0000000..6a76170 Binary files /dev/null and b/latex/pic/openoffice.org/convert3.png differ diff --git a/latex/pic/openoffice.org/draw.png b/latex/pic/openoffice.org/draw.png new file mode 100755 index 0000000..6a0cd88 Binary files /dev/null and b/latex/pic/openoffice.org/draw.png differ diff --git a/latex/pic/openoffice.org/guide.png b/latex/pic/openoffice.org/guide.png new file mode 100755 index 0000000..27b96dc Binary files /dev/null and b/latex/pic/openoffice.org/guide.png differ diff --git a/latex/pic/openoffice.org/impress.png b/latex/pic/openoffice.org/impress.png new file mode 100755 index 0000000..20f248b Binary files /dev/null and b/latex/pic/openoffice.org/impress.png differ diff --git a/latex/pic/openoffice.org/navigation.png b/latex/pic/openoffice.org/navigation.png new file mode 100755 index 0000000..972b30d Binary files /dev/null and b/latex/pic/openoffice.org/navigation.png differ diff --git a/latex/pic/openoffice.org/openoffice.png b/latex/pic/openoffice.org/openoffice.png new file mode 100755 index 0000000..5b4ffe9 Binary files /dev/null and b/latex/pic/openoffice.org/openoffice.png differ diff --git a/latex/pic/openoffice.org/style.png b/latex/pic/openoffice.org/style.png new file mode 100755 index 0000000..61b1a5e Binary files /dev/null and b/latex/pic/openoffice.org/style.png differ diff --git a/latex/pic/openoffice.org/writer.png b/latex/pic/openoffice.org/writer.png new file mode 100755 index 0000000..3f64ab8 Binary files /dev/null and b/latex/pic/openoffice.org/writer.png differ diff --git a/latex/pic/qtcreater.png b/latex/pic/qtcreater.png new file mode 100755 index 0000000..51589dd Binary files /dev/null and b/latex/pic/qtcreater.png differ diff --git a/latex/pic/remote01.png b/latex/pic/remote01.png new file mode 100755 index 0000000..bbfa71f Binary files /dev/null and b/latex/pic/remote01.png differ diff --git a/latex/pic/remote02.png b/latex/pic/remote02.png new file mode 100755 index 0000000..2937caf Binary files /dev/null and b/latex/pic/remote02.png differ diff --git a/latex/pic/remote03.png b/latex/pic/remote03.png new file mode 100755 index 0000000..e39f564 Binary files /dev/null and b/latex/pic/remote03.png differ diff --git a/latex/pic/remote04.png b/latex/pic/remote04.png new file mode 100755 index 0000000..c08bfda Binary files /dev/null and b/latex/pic/remote04.png differ diff --git a/latex/pic/remote05.png b/latex/pic/remote05.png new file mode 100755 index 0000000..99ca709 Binary files /dev/null and b/latex/pic/remote05.png differ diff --git a/latex/pic/remote06.png b/latex/pic/remote06.png new file mode 100755 index 0000000..d692f0f Binary files /dev/null and b/latex/pic/remote06.png differ diff --git a/latex/pic/scim.png b/latex/pic/scim.png new file mode 100755 index 0000000..8b4bf28 Binary files /dev/null and b/latex/pic/scim.png differ diff --git a/latex/pic/sec001.png b/latex/pic/sec001.png new file mode 100755 index 0000000..341a1d1 Binary files /dev/null and b/latex/pic/sec001.png differ diff --git a/latex/pic/sec002.png b/latex/pic/sec002.png new file mode 100755 index 0000000..54b7c9e Binary files /dev/null and b/latex/pic/sec002.png differ diff --git a/latex/pic/sec003.png b/latex/pic/sec003.png new file mode 100755 index 0000000..e9ca938 Binary files /dev/null and b/latex/pic/sec003.png differ diff --git a/latex/pic/sec004.png b/latex/pic/sec004.png new file mode 100755 index 0000000..8eead84 Binary files /dev/null and b/latex/pic/sec004.png differ diff --git a/latex/pic/sec005.png b/latex/pic/sec005.png new file mode 100755 index 0000000..acaff55 Binary files /dev/null and b/latex/pic/sec005.png differ diff --git a/latex/pic/sec006.png b/latex/pic/sec006.png new file mode 100755 index 0000000..8975f1d Binary files /dev/null and b/latex/pic/sec006.png differ diff --git a/latex/pic/sec007.png b/latex/pic/sec007.png new file mode 100755 index 0000000..4237528 Binary files /dev/null and b/latex/pic/sec007.png differ diff --git a/latex/pic/sec008.png b/latex/pic/sec008.png new file mode 100755 index 0000000..2066471 Binary files /dev/null and b/latex/pic/sec008.png differ diff --git a/latex/pic/sec009.png b/latex/pic/sec009.png new file mode 100755 index 0000000..950d4e4 Binary files /dev/null and b/latex/pic/sec009.png differ diff --git a/latex/pic/sec010.png b/latex/pic/sec010.png new file mode 100755 index 0000000..20fee4a Binary files /dev/null and b/latex/pic/sec010.png differ diff --git a/latex/pic/sec011.png b/latex/pic/sec011.png new file mode 100755 index 0000000..7cd2c1c Binary files /dev/null and b/latex/pic/sec011.png differ diff --git a/latex/pic/sec012.png b/latex/pic/sec012.png new file mode 100755 index 0000000..46d8804 Binary files /dev/null and b/latex/pic/sec012.png differ diff --git a/latex/pic/sec013.png b/latex/pic/sec013.png new file mode 100755 index 0000000..ab9f258 Binary files /dev/null and b/latex/pic/sec013.png differ diff --git a/latex/pic/sec014.png b/latex/pic/sec014.png new file mode 100755 index 0000000..b605a03 Binary files /dev/null and b/latex/pic/sec014.png differ diff --git a/latex/pic/sec015.png b/latex/pic/sec015.png new file mode 100755 index 0000000..bc28b57 Binary files /dev/null and b/latex/pic/sec015.png differ diff --git a/latex/pic/sec016.png b/latex/pic/sec016.png new file mode 100755 index 0000000..1644e69 Binary files /dev/null and b/latex/pic/sec016.png differ diff --git a/latex/pic/sec017.png b/latex/pic/sec017.png new file mode 100755 index 0000000..abedb59 Binary files /dev/null and b/latex/pic/sec017.png differ diff --git a/latex/pic/sec018.png b/latex/pic/sec018.png new file mode 100755 index 0000000..c16ac77 Binary files /dev/null and b/latex/pic/sec018.png differ diff --git a/latex/pic/sec019.png b/latex/pic/sec019.png new file mode 100755 index 0000000..bb6b3e5 Binary files /dev/null and b/latex/pic/sec019.png differ diff --git a/latex/pic/sec020.png b/latex/pic/sec020.png new file mode 100755 index 0000000..d16d09f Binary files /dev/null and b/latex/pic/sec020.png differ diff --git a/latex/pic/sec021.png b/latex/pic/sec021.png new file mode 100755 index 0000000..d3e8d4d Binary files /dev/null and b/latex/pic/sec021.png differ diff --git a/latex/pic/sec022.png b/latex/pic/sec022.png new file mode 100755 index 0000000..cb48461 Binary files /dev/null and b/latex/pic/sec022.png differ diff --git a/latex/pic/sec023.png b/latex/pic/sec023.png new file mode 100755 index 0000000..1a4eee8 Binary files /dev/null and b/latex/pic/sec023.png differ diff --git a/latex/pic/sec024.png b/latex/pic/sec024.png new file mode 100755 index 0000000..c4a6b84 Binary files /dev/null and b/latex/pic/sec024.png differ diff --git a/latex/pic/serialnumber.png b/latex/pic/serialnumber.png new file mode 100755 index 0000000..d30dc7e Binary files /dev/null and b/latex/pic/serialnumber.png differ diff --git a/latex/pic/startup.png b/latex/pic/startup.png new file mode 100755 index 0000000..d1d6915 Binary files /dev/null and b/latex/pic/startup.png differ diff --git a/latex/pic/thunderbird/.directory b/latex/pic/thunderbird/.directory new file mode 100755 index 0000000..cac6757 --- /dev/null +++ b/latex/pic/thunderbird/.directory @@ -0,0 +1,5 @@ +[Dolphin] +PreviewsShown=true +ShowPreview=true +Timestamp=2014,6,10,15,27,42 +Version=3 diff --git a/latex/pic/thunderbird/001.png b/latex/pic/thunderbird/001.png new file mode 100755 index 0000000..7650b47 Binary files /dev/null and b/latex/pic/thunderbird/001.png differ diff --git a/latex/pic/thunderbird/002.png b/latex/pic/thunderbird/002.png new file mode 100755 index 0000000..b802bd4 Binary files /dev/null and b/latex/pic/thunderbird/002.png differ diff --git a/latex/pic/thunderbird/003.png b/latex/pic/thunderbird/003.png new file mode 100755 index 0000000..79eab91 Binary files /dev/null and b/latex/pic/thunderbird/003.png differ diff --git a/latex/pic/thunderbird/004.png b/latex/pic/thunderbird/004.png new file mode 100755 index 0000000..9fd5df9 Binary files /dev/null and b/latex/pic/thunderbird/004.png differ diff --git a/latex/pic/thunderbird/005.png b/latex/pic/thunderbird/005.png new file mode 100755 index 0000000..b992b71 Binary files /dev/null and b/latex/pic/thunderbird/005.png differ diff --git a/latex/pic/thunderbird/006.png b/latex/pic/thunderbird/006.png new file mode 100755 index 0000000..12fc009 Binary files /dev/null and b/latex/pic/thunderbird/006.png differ diff --git a/latex/pic/thunderbird/007.png b/latex/pic/thunderbird/007.png new file mode 100755 index 0000000..9cf55b4 Binary files /dev/null and b/latex/pic/thunderbird/007.png differ diff --git a/latex/pic/thunderbird/008.png b/latex/pic/thunderbird/008.png new file mode 100755 index 0000000..2d9e06c Binary files /dev/null and b/latex/pic/thunderbird/008.png differ diff --git a/latex/pic/thunderbird/009.png b/latex/pic/thunderbird/009.png new file mode 100755 index 0000000..1563e43 Binary files /dev/null and b/latex/pic/thunderbird/009.png differ diff --git a/latex/pic/thunderbird/010.png b/latex/pic/thunderbird/010.png new file mode 100755 index 0000000..a994eba Binary files /dev/null and b/latex/pic/thunderbird/010.png differ diff --git a/latex/pic/thunderbird/011.png b/latex/pic/thunderbird/011.png new file mode 100755 index 0000000..6b10e8e Binary files /dev/null and b/latex/pic/thunderbird/011.png differ diff --git a/latex/pic/thunderbird/012.png b/latex/pic/thunderbird/012.png new file mode 100755 index 0000000..b11d83e Binary files /dev/null and b/latex/pic/thunderbird/012.png differ diff --git a/latex/pic/thunderbird/013.png b/latex/pic/thunderbird/013.png new file mode 100755 index 0000000..24deb8f Binary files /dev/null and b/latex/pic/thunderbird/013.png differ diff --git a/latex/pic/thunderbird/014.png b/latex/pic/thunderbird/014.png new file mode 100755 index 0000000..70a7b6b Binary files /dev/null and b/latex/pic/thunderbird/014.png differ diff --git a/latex/pic/thunderbird/015.png b/latex/pic/thunderbird/015.png new file mode 100755 index 0000000..e206db6 Binary files /dev/null and b/latex/pic/thunderbird/015.png differ diff --git a/latex/pic/thunderbird/016.png b/latex/pic/thunderbird/016.png new file mode 100755 index 0000000..4a24e8a Binary files /dev/null and b/latex/pic/thunderbird/016.png differ diff --git a/latex/pic/thunderbird/017.png b/latex/pic/thunderbird/017.png new file mode 100755 index 0000000..1d62f60 Binary files /dev/null and b/latex/pic/thunderbird/017.png differ diff --git a/latex/pic/thunderbird/018.png b/latex/pic/thunderbird/018.png new file mode 100755 index 0000000..722d8ae Binary files /dev/null and b/latex/pic/thunderbird/018.png differ diff --git a/latex/pic/thunderbird/019.png b/latex/pic/thunderbird/019.png new file mode 100755 index 0000000..adc7752 Binary files /dev/null and b/latex/pic/thunderbird/019.png differ diff --git a/latex/pic/thunderbird/020.png b/latex/pic/thunderbird/020.png new file mode 100755 index 0000000..6742ee7 Binary files /dev/null and b/latex/pic/thunderbird/020.png differ diff --git a/latex/pic/thunderbird/021.png b/latex/pic/thunderbird/021.png new file mode 100755 index 0000000..872675c Binary files /dev/null and b/latex/pic/thunderbird/021.png differ diff --git a/latex/pic/thunderbird/022.png b/latex/pic/thunderbird/022.png new file mode 100755 index 0000000..441754c Binary files /dev/null and b/latex/pic/thunderbird/022.png differ diff --git a/latex/pic/thunderbird/023.png b/latex/pic/thunderbird/023.png new file mode 100755 index 0000000..2a31cde Binary files /dev/null and b/latex/pic/thunderbird/023.png differ diff --git a/latex/pic/thunderbird/025.png b/latex/pic/thunderbird/025.png new file mode 100755 index 0000000..91cbe56 Binary files /dev/null and b/latex/pic/thunderbird/025.png differ diff --git a/latex/pic/thunderbird/026.png b/latex/pic/thunderbird/026.png new file mode 100755 index 0000000..d2d0ef5 Binary files /dev/null and b/latex/pic/thunderbird/026.png differ diff --git a/latex/pic/thunderbird/027.png b/latex/pic/thunderbird/027.png new file mode 100755 index 0000000..640a1b7 Binary files /dev/null and b/latex/pic/thunderbird/027.png differ diff --git a/latex/pic/thunderbird/028.png b/latex/pic/thunderbird/028.png new file mode 100755 index 0000000..c5edf69 Binary files /dev/null and b/latex/pic/thunderbird/028.png differ diff --git a/latex/pic/thunderbird/029.png b/latex/pic/thunderbird/029.png new file mode 100755 index 0000000..98c69b7 Binary files /dev/null and b/latex/pic/thunderbird/029.png differ diff --git a/latex/pic/thunderbird/030.png b/latex/pic/thunderbird/030.png new file mode 100755 index 0000000..f5f0a7e Binary files /dev/null and b/latex/pic/thunderbird/030.png differ diff --git a/latex/pic/thunderbird/031.png b/latex/pic/thunderbird/031.png new file mode 100755 index 0000000..20c1265 Binary files /dev/null and b/latex/pic/thunderbird/031.png differ diff --git a/latex/pic/thunderbird/032.png b/latex/pic/thunderbird/032.png new file mode 100755 index 0000000..bb64916 Binary files /dev/null and b/latex/pic/thunderbird/032.png differ diff --git a/latex/pic/thunderbird/新建文件夹/01.png b/latex/pic/thunderbird/新建文件夹/01.png new file mode 100755 index 0000000..d4a4c21 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/01.png differ diff --git a/latex/pic/thunderbird/新建文件夹/02.png b/latex/pic/thunderbird/新建文件夹/02.png new file mode 100755 index 0000000..044b315 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/02.png differ diff --git a/latex/pic/thunderbird/新建文件夹/03.png b/latex/pic/thunderbird/新建文件夹/03.png new file mode 100755 index 0000000..48b4538 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/03.png differ diff --git a/latex/pic/thunderbird/新建文件夹/04.png b/latex/pic/thunderbird/新建文件夹/04.png new file mode 100755 index 0000000..0e07cd9 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/04.png differ diff --git a/latex/pic/thunderbird/新建文件夹/05.png b/latex/pic/thunderbird/新建文件夹/05.png new file mode 100755 index 0000000..758cdb3 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/05.png differ diff --git a/latex/pic/thunderbird/新建文件夹/06.png b/latex/pic/thunderbird/新建文件夹/06.png new file mode 100755 index 0000000..64daf29 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/06.png differ diff --git a/latex/pic/thunderbird/新建文件夹/07.png b/latex/pic/thunderbird/新建文件夹/07.png new file mode 100755 index 0000000..d93b0a1 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/07.png differ diff --git a/latex/pic/thunderbird/新建文件夹/08.png b/latex/pic/thunderbird/新建文件夹/08.png new file mode 100755 index 0000000..0cf8928 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/08.png differ diff --git a/latex/pic/thunderbird/新建文件夹/09.png b/latex/pic/thunderbird/新建文件夹/09.png new file mode 100755 index 0000000..2162033 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/09.png differ diff --git a/latex/pic/thunderbird/新建文件夹/10.png b/latex/pic/thunderbird/新建文件夹/10.png new file mode 100755 index 0000000..3183072 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/10.png differ diff --git a/latex/pic/thunderbird/新建文件夹/11.png b/latex/pic/thunderbird/新建文件夹/11.png new file mode 100755 index 0000000..77ef942 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/11.png differ diff --git a/latex/pic/thunderbird/新建文件夹/address.png b/latex/pic/thunderbird/新建文件夹/address.png new file mode 100755 index 0000000..e629cd7 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/address.png differ diff --git a/latex/pic/thunderbird/新建文件夹/attach.png b/latex/pic/thunderbird/新建文件夹/attach.png new file mode 100755 index 0000000..ca22dfd Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/attach.png differ diff --git a/latex/pic/thunderbird/新建文件夹/compose.png b/latex/pic/thunderbird/新建文件夹/compose.png new file mode 100755 index 0000000..58bc014 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/compose.png differ diff --git a/latex/pic/thunderbird/新建文件夹/del.png b/latex/pic/thunderbird/新建文件夹/del.png new file mode 100755 index 0000000..46010db Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/del.png differ diff --git a/latex/pic/thunderbird/新建文件夹/foward.png b/latex/pic/thunderbird/新建文件夹/foward.png new file mode 100755 index 0000000..c8a7a81 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/foward.png differ diff --git a/latex/pic/thunderbird/新建文件夹/get-msge.png b/latex/pic/thunderbird/新建文件夹/get-msge.png new file mode 100755 index 0000000..12b4f3c Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/get-msge.png differ diff --git a/latex/pic/thunderbird/新建文件夹/reply-all.png b/latex/pic/thunderbird/新建文件夹/reply-all.png new file mode 100755 index 0000000..22aff30 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/reply-all.png differ diff --git a/latex/pic/thunderbird/新建文件夹/reply.png b/latex/pic/thunderbird/新建文件夹/reply.png new file mode 100755 index 0000000..0614364 Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/reply.png differ diff --git a/latex/pic/thunderbird/新建文件夹/save.png b/latex/pic/thunderbird/新建文件夹/save.png new file mode 100755 index 0000000..c54376d Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/save.png differ diff --git a/latex/pic/thunderbird/新建文件夹/send.png b/latex/pic/thunderbird/新建文件夹/send.png new file mode 100755 index 0000000..5ab587e Binary files /dev/null and b/latex/pic/thunderbird/新建文件夹/send.png differ diff --git a/latex/pic/tree.png b/latex/pic/tree.png new file mode 100755 index 0000000..bf1dd3e Binary files /dev/null and b/latex/pic/tree.png differ diff --git a/latex/pic/x.log b/latex/pic/x.log new file mode 100755 index 0000000..ae6bb44 --- /dev/null +++ b/latex/pic/x.log @@ -0,0 +1,33 @@ +This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for opensuse.org) (format=pdflatex 2014.5.9) 23 MAY 2014 11:00 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**6.0.60desktop.tex +(/usr/share/texmf/tex/latex/tools/x.tex +LaTeX2e <2011/06/27> +Babel <3.9f> and hyphenation patterns for 78 languages loaded. + +! . +l.34 \batchmode \errmessage{} + \csname @@end\endcsname \end +This error message was generated by an \errmessage +command, so I can't give any explicit help. +Pretend that you're Hercule Poirot: Examine all clues, +and deduce the truth by order and method. + + ) +Here is how much of TeX's memory you used: + 7 strings out of 493440 + 241 string characters out of 6147400 + 52012 words of memory out of 5000000 + 3557 multiletter control sequences out of 15000+600000 + 3640 words of font info for 14 fonts, out of 8000000 for 9000 + 831 hyphenation exceptions out of 8191 + 5i,0n,1p,97b,8s stack positions out of 5000i,500n,10000p,200000b,80000s + +No pages of output. +PDF statistics: + 0 PDF objects out of 1000 (max. 8388607) + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/latex/pic/xosview.png b/latex/pic/xosview.png new file mode 100755 index 0000000..2775660 Binary files /dev/null and b/latex/pic/xosview.png differ diff --git a/latex/pic/凝思标志20131030.png b/latex/pic/凝思标志20131030.png new file mode 100755 index 0000000..d78a4c8 Binary files /dev/null and b/latex/pic/凝思标志20131030.png differ diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..6247f7e --- /dev/null +++ b/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/source/_static/custom.css b/source/_static/custom.css new file mode 100644 index 0000000..eb5baff --- /dev/null +++ b/source/_static/custom.css @@ -0,0 +1,17 @@ +.rst-content kbd { + color: #212121; + background-color: #f2f2f2; + border: 1px solid #cbcbcb; + box-shadow: 0 2px 4px 0 rgb(0 0 0 / 20%), inset 0 0 0 2px #fff; +} +kbd { + padding: .2rem .4rem; + font-size: 87.5%; + color: #fff; + background-color: #212121; + border-radius: .2rem; +} +pre, code, kbd, samp { + font-family: "Source Code Pro",monospace; + font-size: 1em; +} diff --git a/source/_static/logo.png b/source/_static/logo.png new file mode 100755 index 0000000..d78a4c8 Binary files /dev/null and b/source/_static/logo.png differ diff --git a/source/conf.py b/source/conf.py new file mode 100644 index 0000000..ba0eb1e --- /dev/null +++ b/source/conf.py @@ -0,0 +1,194 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = '凝思安全操作系统V6.0技术说明书' +copyright = '2020, 北京凝思软件股份有限公司' +author = '北京凝思软件股份有限公司' + +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.graphviz', + 'sphinx.ext.githubpages', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + # 'sphinx.ext.imgmath', + # 'sphinx.ext.mathjax', + #'sphinxcontrib.bibtex', # https://sphinxcontrib-bibtex.readthedocs.io/en/latest/ + 'sphinxcontrib.blockdiag', + 'sphinxcontrib.mermaid', + #'sphinxcontrib.nwdiag', + #'sphinxcontrib.rackdiag', + #'sphinxcontrib.packdiag', + #'sphinxcontrib.seqdiag', + #'sphinxcontrib.actdiag', + # 'sphinx.ext.viewcode', + # 'sphinx.ext.githubpages', + 'sphinx.ext.napoleon', + #'numsec', # https://github.com/jterrace/sphinxtr/tree/master/extensions +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'zh_CN' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +latex_elements = { + 'releasename': '', + 'papersize': 'a4paper', + 'pointsize': '12pt', + 'figure_align': 'htbp', + + 'maketitle': r''' + \pagenumbering{Roman} %%% to avoid page 1 conflict with actual page 1 + \begin{titlepage} + \vspace*{40mm} %%% * is used to give space from top + + \begin{minipage}[c]{4cm} + \begin{center} + \includegraphics[scale=0.5]{./linx.png} + \end{center} + \end{minipage} + \hfill + \begin{minipage}[c]{14.7cm} + \fontsize{36pt}{\baselineskip}\selectfont 凝思安全操作系统 + \normalsize \\ + \rule[2mm]{10.1cm}{0.5mm} \\ + \bfseries\fontsize{28pt}{\baselineskip}\selectfont V6.0 {\hspace{2.8cm}} 技术说明书 + \end{minipage} + \hfill + \\ \vspace{12cm} + + \centering + %% \small \textit{北京凝思软件股份有限公司} + \Large \textbf{{北京凝思软件股份有限公司}} + \vfill + \small 创建时间 : \today + \end{titlepage} + ''', + + 'tableofcontents':r''' + \pagenumbering{roman} + \tableofcontents + \listoffigures + \listoftables + \clearpage + \pagenumbering{arabic} + ''', + + 'preamble':r''' + \usepackage{xeCJK} + \usepackage{indentfirst} + \setlength{\parindent}{2em} %%首行缩进 + \hypersetup{unicode=true} + \usepackage{CJKutf8} + + %%\today format + \usepackage{datetime} % 日期格式 + \renewcommand{\today}{\number\year 年 \number\month 月} + %% \renewcommand{\today}{\number\year 年 \number\month 月 \number\day 日} + + + %% keyboard sytle + \renewcommand{\sphinxkeyboard}[1]{\raisebox{0.2ex}[0pt]{\fbox{\rule[-0.2ex]{0cm}{1ex}\footnotesize #1}}} + \RequirePackage{tocbibind} %%% comment this to remove page number for following + \addto\captionsenglish{\renewcommand{\contentsname}{目录}} + \addto\captionsenglish{\renewcommand{\listfigurename}{插图}} + \addto\captionsenglish{\renewcommand{\listtablename}{表格}} + \titleformat{\chapter}[display] + {\bfseries\Huge} + {\filleft \Huge 第 \hspace{2 mm} \thechapter \hspace{4 mm} 章} + {4ex} + {\titlerule + \vspace{2ex}% + \filright} + [\vspace{2ex}% + \titlerule] + %\definecolor{VerbatimBorderColor}{rgb}{0.2,0.2,0.2} + \definecolor{VerbatimColor}{rgb}{0.95,0.95,0.95} + + \titleformat*{\section}{\Large\bfseries} + \titleformat*{\subsection}{\large\bfseries} + \titleformat*{\subsubsection}{\large\bfseries} + + \usepackage{sphinx} + \sphinxsetup{TitleColor={rgb}{0,0,0}} %%标题颜色黑色 + %\sphinxsetup{noteBorderColor={rgb}{0,0,0}} + \sphinxsetup{InnerLinkColor={rgb}{0,0,0}} + \sphinxsetup{OuterLinkColor={rgb}{0,0,0}} + %\sphinxsetup{warningBorderColor={rgb}{0,0,0}} + %\sphinxsetup{cautionBorderColor={rgb}{0,0,0}} + \makeatletter + \fancypagestyle{normal}{ + \fancyhf{} + %\fancyhead[L]{{\py@HeaderFamily\nouppercase{\rightmark}}} + %\fancyhead[R]{{\py@HeaderFamily\nouppercase{\leftmark}}} + \renewcommand{\chaptername}[1]{} + \fancyhead[RE,LO]{{\nouppercase{\large\leftmark}}} + \fancyhead[LE,RO]{{\nouppercase{\rightmark}}} + \fancyfoot[CO]{\includegraphics[scale=0.06]{./linx.png} 北京凝思软件股份有限公司} + \fancyfoot[LE,RO]{\thepage} + \renewcommand{\headrulewidth}{0.4pt} + \renewcommand{\footrulewidth}{0.4pt} + } + \makeatother + ''', +} + +latex_documents = [ + ('index', '凝思安全操作系统V6.0技术说明书.tex', '凝思安全操作系统V6.0技术说明书', + '北京凝思软件股份公司', 'manual', True), +] + +numfig=True +#numfig_format= +numfig_secnum_depth=1 diff --git a/source/index.rst b/source/index.rst new file mode 100644 index 0000000..1ff093f --- /dev/null +++ b/source/index.rst @@ -0,0 +1,29 @@ +凝思安全操作系统V6.0技术说明书 +=============================== + +.. toctree:: + :numbered: + :maxdepth: 4 + :caption: 目录 + + 产品概述.rst + 关于本书.rst + 登录和注销.rst + 系统基本使用.rst + 分区与文件系统.rst + 中文支持.rst + 系统管理.rst + 软件包管理.rst + 用户管理.rst + 网络管理.rst + 开发.rst + 常见问题解答.rst + 文件和目录.rst + +Indices and tables +================== + +:ref:`genindex` +:ref:`modindex` +:ref:`search` + diff --git a/source/pic/.directory b/source/pic/.directory new file mode 100755 index 0000000..3f4ff59 --- /dev/null +++ b/source/pic/.directory @@ -0,0 +1,5 @@ +[Dolphin] +PreviewsShown=true +ShowPreview=true +Timestamp=2013,3,21,10,2,21 +Version=2 diff --git a/source/pic/001.png b/source/pic/001.png new file mode 100755 index 0000000..1d12191 Binary files /dev/null and b/source/pic/001.png differ diff --git a/source/pic/002.png b/source/pic/002.png new file mode 100755 index 0000000..9b8f3bd Binary files /dev/null and b/source/pic/002.png differ diff --git a/source/pic/003.png b/source/pic/003.png new file mode 100755 index 0000000..11f3d81 Binary files /dev/null and b/source/pic/003.png differ diff --git a/source/pic/005.png b/source/pic/005.png new file mode 100755 index 0000000..64a4d48 Binary files /dev/null and b/source/pic/005.png differ diff --git a/source/pic/006.png b/source/pic/006.png new file mode 100755 index 0000000..7ae18b2 Binary files /dev/null and b/source/pic/006.png differ diff --git a/source/pic/007.png b/source/pic/007.png new file mode 100755 index 0000000..3d757bf Binary files /dev/null and b/source/pic/007.png differ diff --git a/source/pic/008.png b/source/pic/008.png new file mode 100755 index 0000000..ea9f1ec Binary files /dev/null and b/source/pic/008.png differ diff --git a/source/pic/009.png b/source/pic/009.png new file mode 100755 index 0000000..e37893a Binary files /dev/null and b/source/pic/009.png differ diff --git a/source/pic/010.png b/source/pic/010.png new file mode 100755 index 0000000..3d399bf Binary files /dev/null and b/source/pic/010.png differ diff --git a/source/pic/011.png b/source/pic/011.png new file mode 100755 index 0000000..9eb51b3 Binary files /dev/null and b/source/pic/011.png differ diff --git a/source/pic/012.png b/source/pic/012.png new file mode 100755 index 0000000..db4992e Binary files /dev/null and b/source/pic/012.png differ diff --git a/source/pic/013.png b/source/pic/013.png new file mode 100755 index 0000000..1aa37f6 Binary files /dev/null and b/source/pic/013.png differ diff --git a/source/pic/014.png b/source/pic/014.png new file mode 100755 index 0000000..d2ad7d0 Binary files /dev/null and b/source/pic/014.png differ diff --git a/source/pic/015.png b/source/pic/015.png new file mode 100755 index 0000000..b943ed7 Binary files /dev/null and b/source/pic/015.png differ diff --git a/source/pic/016.png b/source/pic/016.png new file mode 100755 index 0000000..401732e Binary files /dev/null and b/source/pic/016.png differ diff --git a/source/pic/017.png b/source/pic/017.png new file mode 100755 index 0000000..f3c115b Binary files /dev/null and b/source/pic/017.png differ diff --git a/source/pic/018.png b/source/pic/018.png new file mode 100755 index 0000000..9aa06ed Binary files /dev/null and b/source/pic/018.png differ diff --git a/source/pic/019.png b/source/pic/019.png new file mode 100755 index 0000000..c9e13db Binary files /dev/null and b/source/pic/019.png differ diff --git a/source/pic/020.png b/source/pic/020.png new file mode 100755 index 0000000..bb75c65 Binary files /dev/null and b/source/pic/020.png differ diff --git a/source/pic/021.png b/source/pic/021.png new file mode 100755 index 0000000..331b5df Binary files /dev/null and b/source/pic/021.png differ diff --git a/source/pic/022.png b/source/pic/022.png new file mode 100755 index 0000000..261ee43 Binary files /dev/null and b/source/pic/022.png differ diff --git a/source/pic/023.png b/source/pic/023.png new file mode 100755 index 0000000..56874ed Binary files /dev/null and b/source/pic/023.png differ diff --git a/source/pic/024.png b/source/pic/024.png new file mode 100755 index 0000000..003fdda Binary files /dev/null and b/source/pic/024.png differ diff --git a/source/pic/025.png b/source/pic/025.png new file mode 100755 index 0000000..1031b2f Binary files /dev/null and b/source/pic/025.png differ diff --git a/source/pic/026.png b/source/pic/026.png new file mode 100755 index 0000000..8c6136c Binary files /dev/null and b/source/pic/026.png differ diff --git a/source/pic/027.png b/source/pic/027.png new file mode 100755 index 0000000..52c6abb Binary files /dev/null and b/source/pic/027.png differ diff --git a/source/pic/028.png b/source/pic/028.png new file mode 100755 index 0000000..cb50a2a Binary files /dev/null and b/source/pic/028.png differ diff --git a/source/pic/029.png b/source/pic/029.png new file mode 100755 index 0000000..24a9a2b Binary files /dev/null and b/source/pic/029.png differ diff --git a/source/pic/030.png b/source/pic/030.png new file mode 100755 index 0000000..e097c4e Binary files /dev/null and b/source/pic/030.png differ diff --git a/source/pic/031.png b/source/pic/031.png new file mode 100755 index 0000000..d18884e Binary files /dev/null and b/source/pic/031.png differ diff --git a/source/pic/032.png b/source/pic/032.png new file mode 100755 index 0000000..6d277c8 Binary files /dev/null and b/source/pic/032.png differ diff --git a/source/pic/033.png b/source/pic/033.png new file mode 100755 index 0000000..e7882e0 Binary files /dev/null and b/source/pic/033.png differ diff --git a/source/pic/034.png b/source/pic/034.png new file mode 100755 index 0000000..02abe39 Binary files /dev/null and b/source/pic/034.png differ diff --git a/source/pic/035.png b/source/pic/035.png new file mode 100755 index 0000000..40505fb Binary files /dev/null and b/source/pic/035.png differ diff --git a/source/pic/036.png b/source/pic/036.png new file mode 100755 index 0000000..dc54348 Binary files /dev/null and b/source/pic/036.png differ diff --git a/source/pic/037.png b/source/pic/037.png new file mode 100755 index 0000000..7a103ca Binary files /dev/null and b/source/pic/037.png differ diff --git a/source/pic/038.png b/source/pic/038.png new file mode 100755 index 0000000..9bf0da4 Binary files /dev/null and b/source/pic/038.png differ diff --git a/source/pic/039.png b/source/pic/039.png new file mode 100755 index 0000000..901169e Binary files /dev/null and b/source/pic/039.png differ diff --git a/source/pic/040.png b/source/pic/040.png new file mode 100755 index 0000000..188e3b9 Binary files /dev/null and b/source/pic/040.png differ diff --git a/source/pic/041.png b/source/pic/041.png new file mode 100755 index 0000000..5c26a37 Binary files /dev/null and b/source/pic/041.png differ diff --git a/source/pic/042.png b/source/pic/042.png new file mode 100755 index 0000000..e70392a Binary files /dev/null and b/source/pic/042.png differ diff --git a/source/pic/043.png b/source/pic/043.png new file mode 100755 index 0000000..9c5c53b Binary files /dev/null and b/source/pic/043.png differ diff --git a/source/pic/044.png b/source/pic/044.png new file mode 100755 index 0000000..1cdb83e Binary files /dev/null and b/source/pic/044.png differ diff --git a/source/pic/045.png b/source/pic/045.png new file mode 100755 index 0000000..a439c5f Binary files /dev/null and b/source/pic/045.png differ diff --git a/source/pic/046.png b/source/pic/046.png new file mode 100755 index 0000000..64dcf5b Binary files /dev/null and b/source/pic/046.png differ diff --git a/source/pic/047.png b/source/pic/047.png new file mode 100755 index 0000000..2522d65 Binary files /dev/null and b/source/pic/047.png differ diff --git a/source/pic/048.png b/source/pic/048.png new file mode 100755 index 0000000..54ae0af Binary files /dev/null and b/source/pic/048.png differ diff --git a/source/pic/058.png b/source/pic/058.png new file mode 100755 index 0000000..85d0300 Binary files /dev/null and b/source/pic/058.png differ diff --git a/source/pic/059.png b/source/pic/059.png new file mode 100755 index 0000000..575d88e Binary files /dev/null and b/source/pic/059.png differ diff --git a/source/pic/060.png b/source/pic/060.png new file mode 100755 index 0000000..8c7175c Binary files /dev/null and b/source/pic/060.png differ diff --git a/source/pic/061.png b/source/pic/061.png new file mode 100755 index 0000000..043a795 Binary files /dev/null and b/source/pic/061.png differ diff --git a/source/pic/062-1.png b/source/pic/062-1.png new file mode 100755 index 0000000..e8c8878 Binary files /dev/null and b/source/pic/062-1.png differ diff --git a/source/pic/062.png b/source/pic/062.png new file mode 100755 index 0000000..6b6e28a Binary files /dev/null and b/source/pic/062.png differ diff --git a/source/pic/063.png b/source/pic/063.png new file mode 100755 index 0000000..5ec756b Binary files /dev/null and b/source/pic/063.png differ diff --git a/source/pic/064.png b/source/pic/064.png new file mode 100755 index 0000000..d6ccd73 Binary files /dev/null and b/source/pic/064.png differ diff --git a/source/pic/065.png b/source/pic/065.png new file mode 100755 index 0000000..6cd0bc6 Binary files /dev/null and b/source/pic/065.png differ diff --git a/source/pic/066.png b/source/pic/066.png new file mode 100755 index 0000000..9e49a4a Binary files /dev/null and b/source/pic/066.png differ diff --git a/source/pic/067.png b/source/pic/067.png new file mode 100755 index 0000000..83e8cf0 Binary files /dev/null and b/source/pic/067.png differ diff --git a/source/pic/068.png b/source/pic/068.png new file mode 100755 index 0000000..e2aa0e3 Binary files /dev/null and b/source/pic/068.png differ diff --git a/source/pic/069.png b/source/pic/069.png new file mode 100755 index 0000000..65dbb83 Binary files /dev/null and b/source/pic/069.png differ diff --git a/source/pic/070.png b/source/pic/070.png new file mode 100755 index 0000000..731bb34 Binary files /dev/null and b/source/pic/070.png differ diff --git a/source/pic/071.png b/source/pic/071.png new file mode 100755 index 0000000..ee007c8 Binary files /dev/null and b/source/pic/071.png differ diff --git a/source/pic/072.png b/source/pic/072.png new file mode 100755 index 0000000..d96382a Binary files /dev/null and b/source/pic/072.png differ diff --git a/source/pic/073.png b/source/pic/073.png new file mode 100755 index 0000000..88e019b Binary files /dev/null and b/source/pic/073.png differ diff --git a/source/pic/074.png b/source/pic/074.png new file mode 100755 index 0000000..8841914 Binary files /dev/null and b/source/pic/074.png differ diff --git a/source/pic/075.png b/source/pic/075.png new file mode 100755 index 0000000..73a477c Binary files /dev/null and b/source/pic/075.png differ diff --git a/source/pic/076.png b/source/pic/076.png new file mode 100755 index 0000000..3bc0bc7 Binary files /dev/null and b/source/pic/076.png differ diff --git a/source/pic/077.png b/source/pic/077.png new file mode 100755 index 0000000..809e43c Binary files /dev/null and b/source/pic/077.png differ diff --git a/source/pic/078.png b/source/pic/078.png new file mode 100755 index 0000000..0a9e704 Binary files /dev/null and b/source/pic/078.png differ diff --git a/source/pic/079.png b/source/pic/079.png new file mode 100755 index 0000000..8a68318 Binary files /dev/null and b/source/pic/079.png differ diff --git a/source/pic/20150410/.directory b/source/pic/20150410/.directory new file mode 100755 index 0000000..a26d486 --- /dev/null +++ b/source/pic/20150410/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2015,4,13,14,1,36 +Version=3 diff --git a/source/pic/20150410/001.png b/source/pic/20150410/001.png new file mode 100755 index 0000000..5e62e10 Binary files /dev/null and b/source/pic/20150410/001.png differ diff --git a/source/pic/20150410/002-2.png b/source/pic/20150410/002-2.png new file mode 100755 index 0000000..e52755b Binary files /dev/null and b/source/pic/20150410/002-2.png differ diff --git a/source/pic/20150410/002.png b/source/pic/20150410/002.png new file mode 100755 index 0000000..6bde757 Binary files /dev/null and b/source/pic/20150410/002.png differ diff --git a/source/pic/20150410/003.png b/source/pic/20150410/003.png new file mode 100755 index 0000000..0f70994 Binary files /dev/null and b/source/pic/20150410/003.png differ diff --git a/source/pic/20150410/004.png b/source/pic/20150410/004.png new file mode 100755 index 0000000..551eb28 Binary files /dev/null and b/source/pic/20150410/004.png differ diff --git a/source/pic/20150410/005.png b/source/pic/20150410/005.png new file mode 100755 index 0000000..c613b1c Binary files /dev/null and b/source/pic/20150410/005.png differ diff --git a/source/pic/20150410/006.png b/source/pic/20150410/006.png new file mode 100755 index 0000000..44da221 Binary files /dev/null and b/source/pic/20150410/006.png differ diff --git a/source/pic/20150410/007.png b/source/pic/20150410/007.png new file mode 100755 index 0000000..6648ec3 Binary files /dev/null and b/source/pic/20150410/007.png differ diff --git a/source/pic/20150410/008.png b/source/pic/20150410/008.png new file mode 100755 index 0000000..e89015f Binary files /dev/null and b/source/pic/20150410/008.png differ diff --git a/source/pic/20150410/009.png b/source/pic/20150410/009.png new file mode 100755 index 0000000..db8e265 Binary files /dev/null and b/source/pic/20150410/009.png differ diff --git a/source/pic/20150410/010.png b/source/pic/20150410/010.png new file mode 100755 index 0000000..8266956 Binary files /dev/null and b/source/pic/20150410/010.png differ diff --git a/source/pic/20150410/011.png b/source/pic/20150410/011.png new file mode 100755 index 0000000..aaa9814 Binary files /dev/null and b/source/pic/20150410/011.png differ diff --git a/source/pic/20150410/012.png b/source/pic/20150410/012.png new file mode 100755 index 0000000..a4c7496 Binary files /dev/null and b/source/pic/20150410/012.png differ diff --git a/source/pic/20150410/013.png b/source/pic/20150410/013.png new file mode 100755 index 0000000..4a3a049 Binary files /dev/null and b/source/pic/20150410/013.png differ diff --git a/source/pic/20150410/014.png b/source/pic/20150410/014.png new file mode 100755 index 0000000..2f46a66 Binary files /dev/null and b/source/pic/20150410/014.png differ diff --git a/source/pic/20150410/015.png b/source/pic/20150410/015.png new file mode 100755 index 0000000..ee12024 Binary files /dev/null and b/source/pic/20150410/015.png differ diff --git a/source/pic/20150410/016.png b/source/pic/20150410/016.png new file mode 100755 index 0000000..610489b Binary files /dev/null and b/source/pic/20150410/016.png differ diff --git a/source/pic/20150410/017.png b/source/pic/20150410/017.png new file mode 100755 index 0000000..a9cf711 Binary files /dev/null and b/source/pic/20150410/017.png differ diff --git a/source/pic/20150410/018.png b/source/pic/20150410/018.png new file mode 100755 index 0000000..738b0e3 Binary files /dev/null and b/source/pic/20150410/018.png differ diff --git a/source/pic/20150410/019.png b/source/pic/20150410/019.png new file mode 100755 index 0000000..30b5a27 Binary files /dev/null and b/source/pic/20150410/019.png differ diff --git a/source/pic/20150410/020.png b/source/pic/20150410/020.png new file mode 100755 index 0000000..20e5d08 Binary files /dev/null and b/source/pic/20150410/020.png differ diff --git a/source/pic/aptitude.png b/source/pic/aptitude.png new file mode 100755 index 0000000..6212f40 Binary files /dev/null and b/source/pic/aptitude.png differ diff --git a/source/pic/audit.odg b/source/pic/audit.odg new file mode 100755 index 0000000..b045ea5 Binary files /dev/null and b/source/pic/audit.odg differ diff --git a/source/pic/audit.png b/source/pic/audit.png new file mode 100755 index 0000000..26031c4 Binary files /dev/null and b/source/pic/audit.png differ diff --git a/source/pic/audit.svg b/source/pic/audit.svg new file mode 100755 index 0000000..f3ae69b --- /dev/null +++ b/source/pic/audit.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + audit.rules + + + + + + + + + auditctl + + + + + + + auditd.conf + + + + + + + + + auditd + + + + + + + audit + + + + + + + + + + + + + + + + kernel + + + + + + + + + app + + + + + + + + + audispd + + + + + + + audit.log + + + + + + + + + + + + + + + aureport + + + + + + + + + ausearch + + + + + + + + + + + + + + + + + + + + + autrace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/pic/audit1.png b/source/pic/audit1.png new file mode 100755 index 0000000..bead190 Binary files /dev/null and b/source/pic/audit1.png differ diff --git a/source/pic/audit2.png b/source/pic/audit2.png new file mode 100755 index 0000000..603f7ce Binary files /dev/null and b/source/pic/audit2.png differ diff --git a/source/pic/backup1.png b/source/pic/backup1.png new file mode 100755 index 0000000..3f23705 Binary files /dev/null and b/source/pic/backup1.png differ diff --git a/source/pic/backup2.png b/source/pic/backup2.png new file mode 100755 index 0000000..290ee7f Binary files /dev/null and b/source/pic/backup2.png differ diff --git a/source/pic/backup3.png b/source/pic/backup3.png new file mode 100755 index 0000000..5f756db Binary files /dev/null and b/source/pic/backup3.png differ diff --git a/source/pic/down1.png b/source/pic/down1.png new file mode 100755 index 0000000..9faacf8 Binary files /dev/null and b/source/pic/down1.png differ diff --git a/source/pic/down2.png b/source/pic/down2.png new file mode 100755 index 0000000..eb0c40e Binary files /dev/null and b/source/pic/down2.png differ diff --git a/source/pic/down3.png b/source/pic/down3.png new file mode 100755 index 0000000..937c1a6 Binary files /dev/null and b/source/pic/down3.png differ diff --git a/source/pic/echo1.png b/source/pic/echo1.png new file mode 100755 index 0000000..b25a5c6 Binary files /dev/null and b/source/pic/echo1.png differ diff --git a/source/pic/echo2.png b/source/pic/echo2.png new file mode 100755 index 0000000..db13303 Binary files /dev/null and b/source/pic/echo2.png differ diff --git a/source/pic/eclipse.png b/source/pic/eclipse.png new file mode 100755 index 0000000..dfe0921 Binary files /dev/null and b/source/pic/eclipse.png differ diff --git a/source/pic/emacs.png b/source/pic/emacs.png new file mode 100755 index 0000000..1a3a1df Binary files /dev/null and b/source/pic/emacs.png differ diff --git a/source/pic/expert01.png b/source/pic/expert01.png new file mode 100755 index 0000000..770140a Binary files /dev/null and b/source/pic/expert01.png differ diff --git a/source/pic/expert02.png b/source/pic/expert02.png new file mode 100755 index 0000000..8fa9f36 Binary files /dev/null and b/source/pic/expert02.png differ diff --git a/source/pic/expert03.png b/source/pic/expert03.png new file mode 100755 index 0000000..5f4aa5d Binary files /dev/null and b/source/pic/expert03.png differ diff --git a/source/pic/expert04.png b/source/pic/expert04.png new file mode 100755 index 0000000..475b122 Binary files /dev/null and b/source/pic/expert04.png differ diff --git a/source/pic/expert05.png b/source/pic/expert05.png new file mode 100755 index 0000000..8e4b45c Binary files /dev/null and b/source/pic/expert05.png differ diff --git a/source/pic/expert06.png b/source/pic/expert06.png new file mode 100755 index 0000000..43c878c Binary files /dev/null and b/source/pic/expert06.png differ diff --git a/source/pic/expert07.png b/source/pic/expert07.png new file mode 100755 index 0000000..2d59ddc Binary files /dev/null and b/source/pic/expert07.png differ diff --git a/source/pic/expert08.png b/source/pic/expert08.png new file mode 100755 index 0000000..f1a95d5 Binary files /dev/null and b/source/pic/expert08.png differ diff --git a/source/pic/expert09.png b/source/pic/expert09.png new file mode 100755 index 0000000..163aa47 Binary files /dev/null and b/source/pic/expert09.png differ diff --git a/source/pic/expert10.png b/source/pic/expert10.png new file mode 100755 index 0000000..b26b66f Binary files /dev/null and b/source/pic/expert10.png differ diff --git a/source/pic/expert11.png b/source/pic/expert11.png new file mode 100755 index 0000000..07d0fc5 Binary files /dev/null and b/source/pic/expert11.png differ diff --git a/source/pic/expert12.png b/source/pic/expert12.png new file mode 100755 index 0000000..ac71ee7 Binary files /dev/null and b/source/pic/expert12.png differ diff --git a/source/pic/expert13.png b/source/pic/expert13.png new file mode 100755 index 0000000..ace82bc Binary files /dev/null and b/source/pic/expert13.png differ diff --git a/source/pic/expert14.png b/source/pic/expert14.png new file mode 100755 index 0000000..5406b46 Binary files /dev/null and b/source/pic/expert14.png differ diff --git a/source/pic/expert15.png b/source/pic/expert15.png new file mode 100755 index 0000000..d3bbdaf Binary files /dev/null and b/source/pic/expert15.png differ diff --git a/source/pic/expert16.png b/source/pic/expert16.png new file mode 100755 index 0000000..ffff6c1 Binary files /dev/null and b/source/pic/expert16.png differ diff --git a/source/pic/fingerprinter-bk.png b/source/pic/fingerprinter-bk.png new file mode 100755 index 0000000..8414130 Binary files /dev/null and b/source/pic/fingerprinter-bk.png differ diff --git a/source/pic/fingerprinter.png b/source/pic/fingerprinter.png new file mode 100755 index 0000000..ea6aeb3 Binary files /dev/null and b/source/pic/fingerprinter.png differ diff --git a/source/pic/fingerprinterbk.png b/source/pic/fingerprinterbk.png new file mode 100755 index 0000000..0054cd7 Binary files /dev/null and b/source/pic/fingerprinterbk.png differ diff --git a/source/pic/firefox/.directory b/source/pic/firefox/.directory new file mode 100755 index 0000000..d7c18a5 --- /dev/null +++ b/source/pic/firefox/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,6,10,14,59,18 +Version=3 diff --git a/source/pic/firefox/01.png b/source/pic/firefox/01.png new file mode 100755 index 0000000..02844a9 Binary files /dev/null and b/source/pic/firefox/01.png differ diff --git a/source/pic/firefox/02.png b/source/pic/firefox/02.png new file mode 100755 index 0000000..48a6f37 Binary files /dev/null and b/source/pic/firefox/02.png differ diff --git a/source/pic/firefox/03.png b/source/pic/firefox/03.png new file mode 100755 index 0000000..2ccf411 Binary files /dev/null and b/source/pic/firefox/03.png differ diff --git a/source/pic/firefox/04.png b/source/pic/firefox/04.png new file mode 100755 index 0000000..a5a901c Binary files /dev/null and b/source/pic/firefox/04.png differ diff --git a/source/pic/firefox/05.png b/source/pic/firefox/05.png new file mode 100755 index 0000000..b33a610 Binary files /dev/null and b/source/pic/firefox/05.png differ diff --git a/source/pic/firefox/06.png b/source/pic/firefox/06.png new file mode 100755 index 0000000..f0ec170 Binary files /dev/null and b/source/pic/firefox/06.png differ diff --git a/source/pic/firefox/07.png b/source/pic/firefox/07.png new file mode 100755 index 0000000..08ce41a Binary files /dev/null and b/source/pic/firefox/07.png differ diff --git a/source/pic/firefox/08.png b/source/pic/firefox/08.png new file mode 100755 index 0000000..06c0c12 Binary files /dev/null and b/source/pic/firefox/08.png differ diff --git a/source/pic/firefox/1.png b/source/pic/firefox/1.png new file mode 100755 index 0000000..d7cd0af Binary files /dev/null and b/source/pic/firefox/1.png differ diff --git a/source/pic/firefox/bookmarks.png b/source/pic/firefox/bookmarks.png new file mode 100755 index 0000000..3a180ce Binary files /dev/null and b/source/pic/firefox/bookmarks.png differ diff --git a/source/pic/firefox/engine.png b/source/pic/firefox/engine.png new file mode 100755 index 0000000..62f93ae Binary files /dev/null and b/source/pic/firefox/engine.png differ diff --git a/source/pic/firefox/extensions.png b/source/pic/firefox/extensions.png new file mode 100755 index 0000000..8a458a5 Binary files /dev/null and b/source/pic/firefox/extensions.png differ diff --git a/source/pic/firefox/key.png b/source/pic/firefox/key.png new file mode 100755 index 0000000..1da687c Binary files /dev/null and b/source/pic/firefox/key.png differ diff --git a/source/pic/firefox/manage.png b/source/pic/firefox/manage.png new file mode 100755 index 0000000..962aa69 Binary files /dev/null and b/source/pic/firefox/manage.png differ diff --git a/source/pic/firefox/subscribe1.png b/source/pic/firefox/subscribe1.png new file mode 100755 index 0000000..77b0778 Binary files /dev/null and b/source/pic/firefox/subscribe1.png differ diff --git a/source/pic/firefox/subscribe2.png b/source/pic/firefox/subscribe2.png new file mode 100755 index 0000000..c05d5c9 Binary files /dev/null and b/source/pic/firefox/subscribe2.png differ diff --git a/source/pic/gnome-system-monitor.png b/source/pic/gnome-system-monitor.png new file mode 100755 index 0000000..42ff091 Binary files /dev/null and b/source/pic/gnome-system-monitor.png differ diff --git a/source/pic/gnome.png b/source/pic/gnome.png new file mode 100644 index 0000000..42636ae Binary files /dev/null and b/source/pic/gnome.png differ diff --git a/source/pic/gnome1.png b/source/pic/gnome1.png new file mode 100755 index 0000000..095092f Binary files /dev/null and b/source/pic/gnome1.png differ diff --git a/source/pic/gnome2.png b/source/pic/gnome2.png new file mode 100755 index 0000000..b27465e Binary files /dev/null and b/source/pic/gnome2.png differ diff --git a/source/pic/gnome3.png b/source/pic/gnome3.png new file mode 100644 index 0000000..78cfcf0 Binary files /dev/null and b/source/pic/gnome3.png differ diff --git a/source/pic/gnome4.png b/source/pic/gnome4.png new file mode 100755 index 0000000..88fffdf Binary files /dev/null and b/source/pic/gnome4.png differ diff --git a/source/pic/gnome5.png b/source/pic/gnome5.png new file mode 100755 index 0000000..3d45da3 Binary files /dev/null and b/source/pic/gnome5.png differ diff --git a/source/pic/gparted01.png b/source/pic/gparted01.png new file mode 100755 index 0000000..3265970 Binary files /dev/null and b/source/pic/gparted01.png differ diff --git a/source/pic/gparted02.png b/source/pic/gparted02.png new file mode 100755 index 0000000..e93b4db Binary files /dev/null and b/source/pic/gparted02.png differ diff --git a/source/pic/gparted03.png b/source/pic/gparted03.png new file mode 100755 index 0000000..bf695e8 Binary files /dev/null and b/source/pic/gparted03.png differ diff --git a/source/pic/gparted04.png b/source/pic/gparted04.png new file mode 100755 index 0000000..123bc2f Binary files /dev/null and b/source/pic/gparted04.png differ diff --git a/source/pic/gparted05.png b/source/pic/gparted05.png new file mode 100755 index 0000000..0002559 Binary files /dev/null and b/source/pic/gparted05.png differ diff --git a/source/pic/gparted06.png b/source/pic/gparted06.png new file mode 100755 index 0000000..54e8376 Binary files /dev/null and b/source/pic/gparted06.png differ diff --git a/source/pic/gparted07.png b/source/pic/gparted07.png new file mode 100755 index 0000000..2293a78 Binary files /dev/null and b/source/pic/gparted07.png differ diff --git a/source/pic/gparted08.png b/source/pic/gparted08.png new file mode 100755 index 0000000..cce390c Binary files /dev/null and b/source/pic/gparted08.png differ diff --git a/source/pic/gparted09.png b/source/pic/gparted09.png new file mode 100755 index 0000000..9448d2a Binary files /dev/null and b/source/pic/gparted09.png differ diff --git a/source/pic/gparted10.png b/source/pic/gparted10.png new file mode 100755 index 0000000..16af662 Binary files /dev/null and b/source/pic/gparted10.png differ diff --git a/source/pic/gparted11.png b/source/pic/gparted11.png new file mode 100755 index 0000000..d9e0a46 Binary files /dev/null and b/source/pic/gparted11.png differ diff --git a/source/pic/gparted12.png b/source/pic/gparted12.png new file mode 100755 index 0000000..35342d2 Binary files /dev/null and b/source/pic/gparted12.png differ diff --git a/source/pic/gparted13.png b/source/pic/gparted13.png new file mode 100755 index 0000000..182b09f Binary files /dev/null and b/source/pic/gparted13.png differ diff --git a/source/pic/gparted14.png b/source/pic/gparted14.png new file mode 100755 index 0000000..c6c420d Binary files /dev/null and b/source/pic/gparted14.png differ diff --git a/source/pic/gparted15.png b/source/pic/gparted15.png new file mode 100755 index 0000000..3352b41 Binary files /dev/null and b/source/pic/gparted15.png differ diff --git a/source/pic/gparted16.png b/source/pic/gparted16.png new file mode 100755 index 0000000..f3aac8f Binary files /dev/null and b/source/pic/gparted16.png differ diff --git a/source/pic/gparted17.png b/source/pic/gparted17.png new file mode 100755 index 0000000..ed23315 Binary files /dev/null and b/source/pic/gparted17.png differ diff --git a/source/pic/grub.png b/source/pic/grub.png new file mode 100644 index 0000000..660af60 Binary files /dev/null and b/source/pic/grub.png differ diff --git a/source/pic/grub1.png b/source/pic/grub1.png new file mode 100755 index 0000000..300e4cf Binary files /dev/null and b/source/pic/grub1.png differ diff --git a/source/pic/grub2.png b/source/pic/grub2.png new file mode 100755 index 0000000..62b64d1 Binary files /dev/null and b/source/pic/grub2.png differ diff --git a/source/pic/grub3.png b/source/pic/grub3.png new file mode 100644 index 0000000..5b74221 Binary files /dev/null and b/source/pic/grub3.png differ diff --git a/source/pic/icon/.directory b/source/pic/icon/.directory new file mode 100755 index 0000000..3cdd1de --- /dev/null +++ b/source/pic/icon/.directory @@ -0,0 +1,3 @@ +[Dolphin] +ShowPreview=true +Timestamp=2010,5,18,17,24,13 diff --git a/source/pic/icon/caution.png b/source/pic/icon/caution.png new file mode 100755 index 0000000..264e93d Binary files /dev/null and b/source/pic/icon/caution.png differ diff --git a/source/pic/icon/hint.png b/source/pic/icon/hint.png new file mode 100755 index 0000000..0791d36 Binary files /dev/null and b/source/pic/icon/hint.png differ diff --git a/source/pic/icon/note.png b/source/pic/icon/note.png new file mode 100755 index 0000000..64e2f54 Binary files /dev/null and b/source/pic/icon/note.png differ diff --git a/source/pic/icon/star.png b/source/pic/icon/star.png new file mode 100755 index 0000000..fe44558 Binary files /dev/null and b/source/pic/icon/star.png differ diff --git a/source/pic/icon/warning.png b/source/pic/icon/warning.png new file mode 100755 index 0000000..c6d93b0 Binary files /dev/null and b/source/pic/icon/warning.png differ diff --git a/source/pic/install.png b/source/pic/install.png new file mode 100755 index 0000000..f87297d Binary files /dev/null and b/source/pic/install.png differ diff --git a/source/pic/install01.png b/source/pic/install01.png new file mode 100755 index 0000000..8648c28 Binary files /dev/null and b/source/pic/install01.png differ diff --git a/source/pic/install02.png b/source/pic/install02.png new file mode 100755 index 0000000..30336ca Binary files /dev/null and b/source/pic/install02.png differ diff --git a/source/pic/kde.png b/source/pic/kde.png new file mode 100755 index 0000000..942512b Binary files /dev/null and b/source/pic/kde.png differ diff --git a/source/pic/kdevelop.png b/source/pic/kdevelop.png new file mode 100755 index 0000000..f58ddab Binary files /dev/null and b/source/pic/kdevelop.png differ diff --git a/source/pic/linx-logo.png b/source/pic/linx-logo.png new file mode 100755 index 0000000..ade0460 Binary files /dev/null and b/source/pic/linx-logo.png differ diff --git a/source/pic/linx.png b/source/pic/linx.png new file mode 100755 index 0000000..c9ba0b8 Binary files /dev/null and b/source/pic/linx.png differ diff --git a/source/pic/login-1-bbk.png b/source/pic/login-1-bbk.png new file mode 100755 index 0000000..152f800 Binary files /dev/null and b/source/pic/login-1-bbk.png differ diff --git a/source/pic/login-1-bk.png b/source/pic/login-1-bk.png new file mode 100755 index 0000000..16ee00e Binary files /dev/null and b/source/pic/login-1-bk.png differ diff --git a/source/pic/login-1.png b/source/pic/login-1.png new file mode 100755 index 0000000..b2af74f Binary files /dev/null and b/source/pic/login-1.png differ diff --git a/source/pic/login-2-bbk.png b/source/pic/login-2-bbk.png new file mode 100755 index 0000000..ac0046c Binary files /dev/null and b/source/pic/login-2-bbk.png differ diff --git a/source/pic/login-2-bk.png b/source/pic/login-2-bk.png new file mode 100755 index 0000000..a7a6c8f Binary files /dev/null and b/source/pic/login-2-bk.png differ diff --git a/source/pic/login-2.png b/source/pic/login-2.png new file mode 100755 index 0000000..6e4fc2a Binary files /dev/null and b/source/pic/login-2.png differ diff --git a/source/pic/login.png b/source/pic/login.png new file mode 100755 index 0000000..79c618d Binary files /dev/null and b/source/pic/login.png differ diff --git a/source/pic/logo.png b/source/pic/logo.png new file mode 100755 index 0000000..d78a4c8 Binary files /dev/null and b/source/pic/logo.png differ diff --git a/source/pic/mac.odg b/source/pic/mac.odg new file mode 100755 index 0000000..bde858e Binary files /dev/null and b/source/pic/mac.odg differ diff --git a/source/pic/mac1.png b/source/pic/mac1.png new file mode 100755 index 0000000..8562f8d Binary files /dev/null and b/source/pic/mac1.png differ diff --git a/source/pic/mac2.png b/source/pic/mac2.png new file mode 100755 index 0000000..70857fe Binary files /dev/null and b/source/pic/mac2.png differ diff --git a/source/pic/mac3.png b/source/pic/mac3.png new file mode 100755 index 0000000..d88b162 Binary files /dev/null and b/source/pic/mac3.png differ diff --git a/source/pic/mac4.png b/source/pic/mac4.png new file mode 100755 index 0000000..fcd401c Binary files /dev/null and b/source/pic/mac4.png differ diff --git a/source/pic/monitor.png b/source/pic/monitor.png new file mode 100755 index 0000000..702c403 Binary files /dev/null and b/source/pic/monitor.png differ diff --git a/source/pic/n01.png b/source/pic/n01.png new file mode 100755 index 0000000..d84885c Binary files /dev/null and b/source/pic/n01.png differ diff --git a/source/pic/n02.png b/source/pic/n02.png new file mode 100755 index 0000000..acac13a Binary files /dev/null and b/source/pic/n02.png differ diff --git a/source/pic/n03.png b/source/pic/n03.png new file mode 100755 index 0000000..d813adc Binary files /dev/null and b/source/pic/n03.png differ diff --git a/source/pic/n04.png b/source/pic/n04.png new file mode 100755 index 0000000..c58554e Binary files /dev/null and b/source/pic/n04.png differ diff --git a/source/pic/n05.png b/source/pic/n05.png new file mode 100755 index 0000000..9352025 Binary files /dev/null and b/source/pic/n05.png differ diff --git a/source/pic/n06.png b/source/pic/n06.png new file mode 100755 index 0000000..4ce74a6 Binary files /dev/null and b/source/pic/n06.png differ diff --git a/source/pic/n07.png b/source/pic/n07.png new file mode 100755 index 0000000..d155b43 Binary files /dev/null and b/source/pic/n07.png differ diff --git a/source/pic/n08.png b/source/pic/n08.png new file mode 100755 index 0000000..43012a9 Binary files /dev/null and b/source/pic/n08.png differ diff --git a/source/pic/n09.png b/source/pic/n09.png new file mode 100755 index 0000000..c0402d4 Binary files /dev/null and b/source/pic/n09.png differ diff --git a/source/pic/n10.png b/source/pic/n10.png new file mode 100755 index 0000000..be165d7 Binary files /dev/null and b/source/pic/n10.png differ diff --git a/source/pic/n11.png b/source/pic/n11.png new file mode 100755 index 0000000..445ee0d Binary files /dev/null and b/source/pic/n11.png differ diff --git a/source/pic/n12.png b/source/pic/n12.png new file mode 100755 index 0000000..09ea967 Binary files /dev/null and b/source/pic/n12.png differ diff --git a/source/pic/n13.png b/source/pic/n13.png new file mode 100755 index 0000000..74d2521 Binary files /dev/null and b/source/pic/n13.png differ diff --git a/source/pic/n14.png b/source/pic/n14.png new file mode 100755 index 0000000..bd11748 Binary files /dev/null and b/source/pic/n14.png differ diff --git a/source/pic/n15.png b/source/pic/n15.png new file mode 100755 index 0000000..777c76a Binary files /dev/null and b/source/pic/n15.png differ diff --git a/source/pic/n16.png b/source/pic/n16.png new file mode 100755 index 0000000..930d7e6 Binary files /dev/null and b/source/pic/n16.png differ diff --git a/source/pic/n17.png b/source/pic/n17.png new file mode 100755 index 0000000..b038963 Binary files /dev/null and b/source/pic/n17.png differ diff --git a/source/pic/n18.png b/source/pic/n18.png new file mode 100755 index 0000000..1aefeae Binary files /dev/null and b/source/pic/n18.png differ diff --git a/source/pic/n19.png b/source/pic/n19.png new file mode 100755 index 0000000..31dc622 Binary files /dev/null and b/source/pic/n19.png differ diff --git a/source/pic/n20.png b/source/pic/n20.png new file mode 100755 index 0000000..4b3cabe Binary files /dev/null and b/source/pic/n20.png differ diff --git a/source/pic/n21.png b/source/pic/n21.png new file mode 100755 index 0000000..920804f Binary files /dev/null and b/source/pic/n21.png differ diff --git a/source/pic/n22.png b/source/pic/n22.png new file mode 100755 index 0000000..8e0c73c Binary files /dev/null and b/source/pic/n22.png differ diff --git a/source/pic/n23.png b/source/pic/n23.png new file mode 100755 index 0000000..28b4024 Binary files /dev/null and b/source/pic/n23.png differ diff --git a/source/pic/n24.png b/source/pic/n24.png new file mode 100755 index 0000000..18f3857 Binary files /dev/null and b/source/pic/n24.png differ diff --git a/source/pic/n25.png b/source/pic/n25.png new file mode 100755 index 0000000..7ef3bd3 Binary files /dev/null and b/source/pic/n25.png differ diff --git a/source/pic/n26.png b/source/pic/n26.png new file mode 100755 index 0000000..2f30677 Binary files /dev/null and b/source/pic/n26.png differ diff --git a/source/pic/n27.png b/source/pic/n27.png new file mode 100755 index 0000000..fb5213b Binary files /dev/null and b/source/pic/n27.png differ diff --git a/source/pic/n28.png b/source/pic/n28.png new file mode 100755 index 0000000..4b15562 Binary files /dev/null and b/source/pic/n28.png differ diff --git a/source/pic/n29.png b/source/pic/n29.png new file mode 100755 index 0000000..b762cad Binary files /dev/null and b/source/pic/n29.png differ diff --git a/source/pic/n30.png b/source/pic/n30.png new file mode 100755 index 0000000..b80ff62 Binary files /dev/null and b/source/pic/n30.png differ diff --git a/source/pic/n31.png b/source/pic/n31.png new file mode 100755 index 0000000..88ff9e0 Binary files /dev/null and b/source/pic/n31.png differ diff --git a/source/pic/new/.directory b/source/pic/new/.directory new file mode 100755 index 0000000..a1a4b91 --- /dev/null +++ b/source/pic/new/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,1,22,11,26,11 +Version=3 diff --git a/source/pic/new/auto001.png b/source/pic/new/auto001.png new file mode 100755 index 0000000..2653d7e Binary files /dev/null and b/source/pic/new/auto001.png differ diff --git a/source/pic/new/auto002.png b/source/pic/new/auto002.png new file mode 100755 index 0000000..9d35dc7 Binary files /dev/null and b/source/pic/new/auto002.png differ diff --git a/source/pic/new/auto003.png b/source/pic/new/auto003.png new file mode 100755 index 0000000..7afc760 Binary files /dev/null and b/source/pic/new/auto003.png differ diff --git a/source/pic/new/auto004.png b/source/pic/new/auto004.png new file mode 100755 index 0000000..d2e7e18 Binary files /dev/null and b/source/pic/new/auto004.png differ diff --git a/source/pic/new/auto005-1.png b/source/pic/new/auto005-1.png new file mode 100755 index 0000000..626683f Binary files /dev/null and b/source/pic/new/auto005-1.png differ diff --git a/source/pic/new/auto005.png b/source/pic/new/auto005.png new file mode 100755 index 0000000..e03e431 Binary files /dev/null and b/source/pic/new/auto005.png differ diff --git a/source/pic/new/auto006.png b/source/pic/new/auto006.png new file mode 100755 index 0000000..900120d Binary files /dev/null and b/source/pic/new/auto006.png differ diff --git a/source/pic/new/auto007.png b/source/pic/new/auto007.png new file mode 100755 index 0000000..700de9f Binary files /dev/null and b/source/pic/new/auto007.png differ diff --git a/source/pic/new/auto008.png b/source/pic/new/auto008.png new file mode 100755 index 0000000..8f023e0 Binary files /dev/null and b/source/pic/new/auto008.png differ diff --git a/source/pic/new/auto009.png b/source/pic/new/auto009.png new file mode 100755 index 0000000..75ae917 Binary files /dev/null and b/source/pic/new/auto009.png differ diff --git a/source/pic/new/auto010.png b/source/pic/new/auto010.png new file mode 100755 index 0000000..9c11344 Binary files /dev/null and b/source/pic/new/auto010.png differ diff --git a/source/pic/new/auto011.png b/source/pic/new/auto011.png new file mode 100755 index 0000000..e7f3727 Binary files /dev/null and b/source/pic/new/auto011.png differ diff --git a/source/pic/new/auto012.png b/source/pic/new/auto012.png new file mode 100755 index 0000000..473afdf Binary files /dev/null and b/source/pic/new/auto012.png differ diff --git a/source/pic/new/auto013.png b/source/pic/new/auto013.png new file mode 100755 index 0000000..51b3129 Binary files /dev/null and b/source/pic/new/auto013.png differ diff --git a/source/pic/new/auto014.png b/source/pic/new/auto014.png new file mode 100755 index 0000000..1b444f7 Binary files /dev/null and b/source/pic/new/auto014.png differ diff --git a/source/pic/new/auto015.png b/source/pic/new/auto015.png new file mode 100755 index 0000000..b1d435f Binary files /dev/null and b/source/pic/new/auto015.png differ diff --git a/source/pic/new/auto016.png b/source/pic/new/auto016.png new file mode 100755 index 0000000..253beb2 Binary files /dev/null and b/source/pic/new/auto016.png differ diff --git a/source/pic/new/auto017.png b/source/pic/new/auto017.png new file mode 100755 index 0000000..afba684 Binary files /dev/null and b/source/pic/new/auto017.png differ diff --git a/source/pic/new/auto018.png b/source/pic/new/auto018.png new file mode 100755 index 0000000..62186cb Binary files /dev/null and b/source/pic/new/auto018.png differ diff --git a/source/pic/new/auto019.png b/source/pic/new/auto019.png new file mode 100755 index 0000000..d773801 Binary files /dev/null and b/source/pic/new/auto019.png differ diff --git a/source/pic/new/auto02.png b/source/pic/new/auto02.png new file mode 100755 index 0000000..88ae770 Binary files /dev/null and b/source/pic/new/auto02.png differ diff --git a/source/pic/new/auto020.png b/source/pic/new/auto020.png new file mode 100755 index 0000000..974de9f Binary files /dev/null and b/source/pic/new/auto020.png differ diff --git a/source/pic/new/auto021.png b/source/pic/new/auto021.png new file mode 100755 index 0000000..9ca4254 Binary files /dev/null and b/source/pic/new/auto021.png differ diff --git a/source/pic/new/auto022.png b/source/pic/new/auto022.png new file mode 100755 index 0000000..0ef1bad Binary files /dev/null and b/source/pic/new/auto022.png differ diff --git a/source/pic/new/auto023.png b/source/pic/new/auto023.png new file mode 100755 index 0000000..7d754c5 Binary files /dev/null and b/source/pic/new/auto023.png differ diff --git a/source/pic/new/auto024.png b/source/pic/new/auto024.png new file mode 100755 index 0000000..eb5dd22 Binary files /dev/null and b/source/pic/new/auto024.png differ diff --git a/source/pic/new/auto025.png b/source/pic/new/auto025.png new file mode 100755 index 0000000..4c38a9a Binary files /dev/null and b/source/pic/new/auto025.png differ diff --git a/source/pic/new/auto026.png b/source/pic/new/auto026.png new file mode 100755 index 0000000..fc38ddd Binary files /dev/null and b/source/pic/new/auto026.png differ diff --git a/source/pic/new/auto027.png b/source/pic/new/auto027.png new file mode 100755 index 0000000..e1a9cc4 Binary files /dev/null and b/source/pic/new/auto027.png differ diff --git a/source/pic/new/auto028.png b/source/pic/new/auto028.png new file mode 100755 index 0000000..e46738f Binary files /dev/null and b/source/pic/new/auto028.png differ diff --git a/source/pic/new/auto029.png b/source/pic/new/auto029.png new file mode 100755 index 0000000..406b573 Binary files /dev/null and b/source/pic/new/auto029.png differ diff --git a/source/pic/new/auto03.png b/source/pic/new/auto03.png new file mode 100755 index 0000000..92cadac Binary files /dev/null and b/source/pic/new/auto03.png differ diff --git a/source/pic/new/auto030.png b/source/pic/new/auto030.png new file mode 100755 index 0000000..9848eef Binary files /dev/null and b/source/pic/new/auto030.png differ diff --git a/source/pic/new/auto031.png b/source/pic/new/auto031.png new file mode 100755 index 0000000..0b600ba Binary files /dev/null and b/source/pic/new/auto031.png differ diff --git a/source/pic/new/auto032.png b/source/pic/new/auto032.png new file mode 100755 index 0000000..653e70e Binary files /dev/null and b/source/pic/new/auto032.png differ diff --git a/source/pic/new/auto033.png b/source/pic/new/auto033.png new file mode 100755 index 0000000..c2f2f23 Binary files /dev/null and b/source/pic/new/auto033.png differ diff --git a/source/pic/new/auto034.png b/source/pic/new/auto034.png new file mode 100755 index 0000000..b11d60f Binary files /dev/null and b/source/pic/new/auto034.png differ diff --git a/source/pic/new/auto035.png b/source/pic/new/auto035.png new file mode 100755 index 0000000..bb5ef5f Binary files /dev/null and b/source/pic/new/auto035.png differ diff --git a/source/pic/new/auto036.png b/source/pic/new/auto036.png new file mode 100755 index 0000000..5b63e73 Binary files /dev/null and b/source/pic/new/auto036.png differ diff --git a/source/pic/new/auto04.png b/source/pic/new/auto04.png new file mode 100755 index 0000000..0ebb9ea Binary files /dev/null and b/source/pic/new/auto04.png differ diff --git a/source/pic/new/auto06.png b/source/pic/new/auto06.png new file mode 100755 index 0000000..bdb9a04 Binary files /dev/null and b/source/pic/new/auto06.png differ diff --git a/source/pic/new/auto07.png b/source/pic/new/auto07.png new file mode 100755 index 0000000..bffe4a2 Binary files /dev/null and b/source/pic/new/auto07.png differ diff --git a/source/pic/new/auto08.png b/source/pic/new/auto08.png new file mode 100755 index 0000000..9ca4254 Binary files /dev/null and b/source/pic/new/auto08.png differ diff --git a/source/pic/new/auto16.png b/source/pic/new/auto16.png new file mode 100755 index 0000000..388f640 Binary files /dev/null and b/source/pic/new/auto16.png differ diff --git a/source/pic/new/auto17.png b/source/pic/new/auto17.png new file mode 100755 index 0000000..388f640 Binary files /dev/null and b/source/pic/new/auto17.png differ diff --git a/source/pic/new/auto18.png b/source/pic/new/auto18.png new file mode 100755 index 0000000..3ec7789 Binary files /dev/null and b/source/pic/new/auto18.png differ diff --git a/source/pic/new/auto19.png b/source/pic/new/auto19.png new file mode 100755 index 0000000..7f215db Binary files /dev/null and b/source/pic/new/auto19.png differ diff --git a/source/pic/new/auto20.png b/source/pic/new/auto20.png new file mode 100755 index 0000000..69aed44 Binary files /dev/null and b/source/pic/new/auto20.png differ diff --git a/source/pic/new/auto21.png b/source/pic/new/auto21.png new file mode 100755 index 0000000..54ee54d Binary files /dev/null and b/source/pic/new/auto21.png differ diff --git a/source/pic/new/auto22.png b/source/pic/new/auto22.png new file mode 100755 index 0000000..fadacc0 Binary files /dev/null and b/source/pic/new/auto22.png differ diff --git a/source/pic/new/ch01.png b/source/pic/new/ch01.png new file mode 100755 index 0000000..5da9e71 Binary files /dev/null and b/source/pic/new/ch01.png differ diff --git a/source/pic/new/ch02.png b/source/pic/new/ch02.png new file mode 100755 index 0000000..c56d059 Binary files /dev/null and b/source/pic/new/ch02.png differ diff --git a/source/pic/new/ch03.png b/source/pic/new/ch03.png new file mode 100755 index 0000000..634d830 Binary files /dev/null and b/source/pic/new/ch03.png differ diff --git a/source/pic/new/ch04.png b/source/pic/new/ch04.png new file mode 100755 index 0000000..051234d Binary files /dev/null and b/source/pic/new/ch04.png differ diff --git a/source/pic/new/ch05.png b/source/pic/new/ch05.png new file mode 100755 index 0000000..ceea3a8 Binary files /dev/null and b/source/pic/new/ch05.png differ diff --git a/source/pic/new/ch06.png b/source/pic/new/ch06.png new file mode 100755 index 0000000..c008297 Binary files /dev/null and b/source/pic/new/ch06.png differ diff --git a/source/pic/new/ch07.png b/source/pic/new/ch07.png new file mode 100755 index 0000000..51012e5 Binary files /dev/null and b/source/pic/new/ch07.png differ diff --git a/source/pic/new/ch08.png b/source/pic/new/ch08.png new file mode 100755 index 0000000..a11ae0f Binary files /dev/null and b/source/pic/new/ch08.png differ diff --git a/source/pic/new/ch09.png b/source/pic/new/ch09.png new file mode 100755 index 0000000..d545888 Binary files /dev/null and b/source/pic/new/ch09.png differ diff --git a/source/pic/new/ch10.png b/source/pic/new/ch10.png new file mode 100755 index 0000000..e75d013 Binary files /dev/null and b/source/pic/new/ch10.png differ diff --git a/source/pic/new/ch11.png b/source/pic/new/ch11.png new file mode 100755 index 0000000..1466386 Binary files /dev/null and b/source/pic/new/ch11.png differ diff --git a/source/pic/new/ch12.png b/source/pic/new/ch12.png new file mode 100755 index 0000000..2779944 Binary files /dev/null and b/source/pic/new/ch12.png differ diff --git a/source/pic/new/ch13.png b/source/pic/new/ch13.png new file mode 100755 index 0000000..539755e Binary files /dev/null and b/source/pic/new/ch13.png differ diff --git a/source/pic/new/ch14.png b/source/pic/new/ch14.png new file mode 100755 index 0000000..fc1368e Binary files /dev/null and b/source/pic/new/ch14.png differ diff --git a/source/pic/new/ch15.png b/source/pic/new/ch15.png new file mode 100755 index 0000000..482120c Binary files /dev/null and b/source/pic/new/ch15.png differ diff --git a/source/pic/new/ch16.png b/source/pic/new/ch16.png new file mode 100755 index 0000000..cbc0820 Binary files /dev/null and b/source/pic/new/ch16.png differ diff --git a/source/pic/new/ch17.png b/source/pic/new/ch17.png new file mode 100755 index 0000000..85efac2 Binary files /dev/null and b/source/pic/new/ch17.png differ diff --git a/source/pic/new/ch18.png b/source/pic/new/ch18.png new file mode 100755 index 0000000..78e61d5 Binary files /dev/null and b/source/pic/new/ch18.png differ diff --git a/source/pic/new/ch19.png b/source/pic/new/ch19.png new file mode 100755 index 0000000..3182acf Binary files /dev/null and b/source/pic/new/ch19.png differ diff --git a/source/pic/new/ch20.png b/source/pic/new/ch20.png new file mode 100755 index 0000000..88840df Binary files /dev/null and b/source/pic/new/ch20.png differ diff --git a/source/pic/new/ch21.png b/source/pic/new/ch21.png new file mode 100755 index 0000000..64080da Binary files /dev/null and b/source/pic/new/ch21.png differ diff --git a/source/pic/new/ch22.png b/source/pic/new/ch22.png new file mode 100755 index 0000000..35c089f Binary files /dev/null and b/source/pic/new/ch22.png differ diff --git a/source/pic/new/ch23.png b/source/pic/new/ch23.png new file mode 100755 index 0000000..1e09f79 Binary files /dev/null and b/source/pic/new/ch23.png differ diff --git a/source/pic/new/ch24.png b/source/pic/new/ch24.png new file mode 100755 index 0000000..1844235 Binary files /dev/null and b/source/pic/new/ch24.png differ diff --git a/source/pic/new/ch25.png b/source/pic/new/ch25.png new file mode 100755 index 0000000..c469dab Binary files /dev/null and b/source/pic/new/ch25.png differ diff --git a/source/pic/new/ch26.png b/source/pic/new/ch26.png new file mode 100755 index 0000000..8feac03 Binary files /dev/null and b/source/pic/new/ch26.png differ diff --git a/source/pic/new/ch27.png b/source/pic/new/ch27.png new file mode 100755 index 0000000..4700e80 Binary files /dev/null and b/source/pic/new/ch27.png differ diff --git a/source/pic/new/ch28.png b/source/pic/new/ch28.png new file mode 100755 index 0000000..6f8a045 Binary files /dev/null and b/source/pic/new/ch28.png differ diff --git a/source/pic/new/ch29.png b/source/pic/new/ch29.png new file mode 100755 index 0000000..0c8470f Binary files /dev/null and b/source/pic/new/ch29.png differ diff --git a/source/pic/new/ch30.png b/source/pic/new/ch30.png new file mode 100755 index 0000000..209de33 Binary files /dev/null and b/source/pic/new/ch30.png differ diff --git a/source/pic/new/ch31.png b/source/pic/new/ch31.png new file mode 100755 index 0000000..fe0d8cd Binary files /dev/null and b/source/pic/new/ch31.png differ diff --git a/source/pic/new/ch32.png b/source/pic/new/ch32.png new file mode 100755 index 0000000..7db3a26 Binary files /dev/null and b/source/pic/new/ch32.png differ diff --git a/source/pic/new/ch33.png b/source/pic/new/ch33.png new file mode 100755 index 0000000..8e3decf Binary files /dev/null and b/source/pic/new/ch33.png differ diff --git a/source/pic/new/ch34.png b/source/pic/new/ch34.png new file mode 100755 index 0000000..48abdac Binary files /dev/null and b/source/pic/new/ch34.png differ diff --git a/source/pic/new/ch35.png b/source/pic/new/ch35.png new file mode 100755 index 0000000..25e56fb Binary files /dev/null and b/source/pic/new/ch35.png differ diff --git a/source/pic/new/ch36.png b/source/pic/new/ch36.png new file mode 100755 index 0000000..ca46c46 Binary files /dev/null and b/source/pic/new/ch36.png differ diff --git a/source/pic/new/ch37.png b/source/pic/new/ch37.png new file mode 100755 index 0000000..dc488bc Binary files /dev/null and b/source/pic/new/ch37.png differ diff --git a/source/pic/new/ch38.png b/source/pic/new/ch38.png new file mode 100755 index 0000000..c80a8d8 Binary files /dev/null and b/source/pic/new/ch38.png differ diff --git a/source/pic/new/ch39.png b/source/pic/new/ch39.png new file mode 100755 index 0000000..ccd52a4 Binary files /dev/null and b/source/pic/new/ch39.png differ diff --git a/source/pic/new/ch40.png b/source/pic/new/ch40.png new file mode 100755 index 0000000..d592bb9 Binary files /dev/null and b/source/pic/new/ch40.png differ diff --git a/source/pic/new/ch41.png b/source/pic/new/ch41.png new file mode 100755 index 0000000..86f5905 Binary files /dev/null and b/source/pic/new/ch41.png differ diff --git a/source/pic/new/expert001.png b/source/pic/new/expert001.png new file mode 100755 index 0000000..770140a Binary files /dev/null and b/source/pic/new/expert001.png differ diff --git a/source/pic/new/expert002.png b/source/pic/new/expert002.png new file mode 100755 index 0000000..8fa9f36 Binary files /dev/null and b/source/pic/new/expert002.png differ diff --git a/source/pic/new/expert003.png b/source/pic/new/expert003.png new file mode 100755 index 0000000..5f4aa5d Binary files /dev/null and b/source/pic/new/expert003.png differ diff --git a/source/pic/new/expert004.png b/source/pic/new/expert004.png new file mode 100755 index 0000000..475b122 Binary files /dev/null and b/source/pic/new/expert004.png differ diff --git a/source/pic/new/expert005.png b/source/pic/new/expert005.png new file mode 100755 index 0000000..8e4b45c Binary files /dev/null and b/source/pic/new/expert005.png differ diff --git a/source/pic/new/expert006.png b/source/pic/new/expert006.png new file mode 100755 index 0000000..43c878c Binary files /dev/null and b/source/pic/new/expert006.png differ diff --git a/source/pic/new/expert007.png b/source/pic/new/expert007.png new file mode 100755 index 0000000..b605a03 Binary files /dev/null and b/source/pic/new/expert007.png differ diff --git a/source/pic/new/expert008.png b/source/pic/new/expert008.png new file mode 100755 index 0000000..f1a95d5 Binary files /dev/null and b/source/pic/new/expert008.png differ diff --git a/source/pic/new/expert009.png b/source/pic/new/expert009.png new file mode 100755 index 0000000..163aa47 Binary files /dev/null and b/source/pic/new/expert009.png differ diff --git a/source/pic/new/expert010.png b/source/pic/new/expert010.png new file mode 100755 index 0000000..b26b66f Binary files /dev/null and b/source/pic/new/expert010.png differ diff --git a/source/pic/new/expert011.png b/source/pic/new/expert011.png new file mode 100755 index 0000000..07d0fc5 Binary files /dev/null and b/source/pic/new/expert011.png differ diff --git a/source/pic/new/expert012.png b/source/pic/new/expert012.png new file mode 100755 index 0000000..ac71ee7 Binary files /dev/null and b/source/pic/new/expert012.png differ diff --git a/source/pic/new/expert013.png b/source/pic/new/expert013.png new file mode 100755 index 0000000..ace82bc Binary files /dev/null and b/source/pic/new/expert013.png differ diff --git a/source/pic/new/expert014.png b/source/pic/new/expert014.png new file mode 100755 index 0000000..5406b46 Binary files /dev/null and b/source/pic/new/expert014.png differ diff --git a/source/pic/new/install01.png b/source/pic/new/install01.png new file mode 100755 index 0000000..8648c28 Binary files /dev/null and b/source/pic/new/install01.png differ diff --git a/source/pic/new/install02.png b/source/pic/new/install02.png new file mode 100755 index 0000000..30336ca Binary files /dev/null and b/source/pic/new/install02.png differ diff --git a/source/pic/new/n001.png b/source/pic/new/n001.png new file mode 100755 index 0000000..d84885c Binary files /dev/null and b/source/pic/new/n001.png differ diff --git a/source/pic/new/n002.png b/source/pic/new/n002.png new file mode 100755 index 0000000..acac13a Binary files /dev/null and b/source/pic/new/n002.png differ diff --git a/source/pic/new/n003.png b/source/pic/new/n003.png new file mode 100755 index 0000000..e8c8878 Binary files /dev/null and b/source/pic/new/n003.png differ diff --git a/source/pic/new/n004.png b/source/pic/new/n004.png new file mode 100755 index 0000000..6b6e28a Binary files /dev/null and b/source/pic/new/n004.png differ diff --git a/source/pic/new/n005.png b/source/pic/new/n005.png new file mode 100755 index 0000000..5ec756b Binary files /dev/null and b/source/pic/new/n005.png differ diff --git a/source/pic/new/n006.png b/source/pic/new/n006.png new file mode 100755 index 0000000..d6ccd73 Binary files /dev/null and b/source/pic/new/n006.png differ diff --git a/source/pic/new/n007.png b/source/pic/new/n007.png new file mode 100755 index 0000000..6cd0bc6 Binary files /dev/null and b/source/pic/new/n007.png differ diff --git a/source/pic/new/n008.png b/source/pic/new/n008.png new file mode 100755 index 0000000..9e49a4a Binary files /dev/null and b/source/pic/new/n008.png differ diff --git a/source/pic/new/n009.png b/source/pic/new/n009.png new file mode 100755 index 0000000..83e8cf0 Binary files /dev/null and b/source/pic/new/n009.png differ diff --git a/source/pic/new/n010.png b/source/pic/new/n010.png new file mode 100755 index 0000000..e2aa0e3 Binary files /dev/null and b/source/pic/new/n010.png differ diff --git a/source/pic/new/n011.png b/source/pic/new/n011.png new file mode 100755 index 0000000..731bb34 Binary files /dev/null and b/source/pic/new/n011.png differ diff --git a/source/pic/new/n012.png b/source/pic/new/n012.png new file mode 100755 index 0000000..d813adc Binary files /dev/null and b/source/pic/new/n012.png differ diff --git a/source/pic/new/n013.png b/source/pic/new/n013.png new file mode 100755 index 0000000..7ae18b2 Binary files /dev/null and b/source/pic/new/n013.png differ diff --git a/source/pic/new/n014-2.png b/source/pic/new/n014-2.png new file mode 100755 index 0000000..d3c9831 Binary files /dev/null and b/source/pic/new/n014-2.png differ diff --git a/source/pic/new/n014.png b/source/pic/new/n014.png new file mode 100755 index 0000000..c58554e Binary files /dev/null and b/source/pic/new/n014.png differ diff --git a/source/pic/new/n015.png b/source/pic/new/n015.png new file mode 100755 index 0000000..9352025 Binary files /dev/null and b/source/pic/new/n015.png differ diff --git a/source/pic/new/n016.png b/source/pic/new/n016.png new file mode 100755 index 0000000..4ce74a6 Binary files /dev/null and b/source/pic/new/n016.png differ diff --git a/source/pic/new/n017.png b/source/pic/new/n017.png new file mode 100755 index 0000000..d155b43 Binary files /dev/null and b/source/pic/new/n017.png differ diff --git a/source/pic/new/n018.png b/source/pic/new/n018.png new file mode 100755 index 0000000..43012a9 Binary files /dev/null and b/source/pic/new/n018.png differ diff --git a/source/pic/new/n019.png b/source/pic/new/n019.png new file mode 100755 index 0000000..c0402d4 Binary files /dev/null and b/source/pic/new/n019.png differ diff --git a/source/pic/new/n020.png b/source/pic/new/n020.png new file mode 100755 index 0000000..db4992e Binary files /dev/null and b/source/pic/new/n020.png differ diff --git a/source/pic/new/n021.png b/source/pic/new/n021.png new file mode 100755 index 0000000..1aa37f6 Binary files /dev/null and b/source/pic/new/n021.png differ diff --git a/source/pic/new/n022.png b/source/pic/new/n022.png new file mode 100755 index 0000000..d2ad7d0 Binary files /dev/null and b/source/pic/new/n022.png differ diff --git a/source/pic/new/n023.png b/source/pic/new/n023.png new file mode 100755 index 0000000..b943ed7 Binary files /dev/null and b/source/pic/new/n023.png differ diff --git a/source/pic/new/n024.png b/source/pic/new/n024.png new file mode 100755 index 0000000..b4b5e6b Binary files /dev/null and b/source/pic/new/n024.png differ diff --git a/source/pic/new/n025.png b/source/pic/new/n025.png new file mode 100755 index 0000000..445ee0d Binary files /dev/null and b/source/pic/new/n025.png differ diff --git a/source/pic/new/n026.png b/source/pic/new/n026.png new file mode 100755 index 0000000..09ea967 Binary files /dev/null and b/source/pic/new/n026.png differ diff --git a/source/pic/new/n027.png b/source/pic/new/n027.png new file mode 100755 index 0000000..96c248b Binary files /dev/null and b/source/pic/new/n027.png differ diff --git a/source/pic/new/n028.png b/source/pic/new/n028.png new file mode 100755 index 0000000..bd11748 Binary files /dev/null and b/source/pic/new/n028.png differ diff --git a/source/pic/new/n029.png b/source/pic/new/n029.png new file mode 100755 index 0000000..777c76a Binary files /dev/null and b/source/pic/new/n029.png differ diff --git a/source/pic/new/n030.png b/source/pic/new/n030.png new file mode 100755 index 0000000..261ee43 Binary files /dev/null and b/source/pic/new/n030.png differ diff --git a/source/pic/new/n031.png b/source/pic/new/n031.png new file mode 100755 index 0000000..56874ed Binary files /dev/null and b/source/pic/new/n031.png differ diff --git a/source/pic/new/n032.png b/source/pic/new/n032.png new file mode 100755 index 0000000..003fdda Binary files /dev/null and b/source/pic/new/n032.png differ diff --git a/source/pic/new/n033.png b/source/pic/new/n033.png new file mode 100755 index 0000000..1031b2f Binary files /dev/null and b/source/pic/new/n033.png differ diff --git a/source/pic/new/n034.png b/source/pic/new/n034.png new file mode 100755 index 0000000..8c6136c Binary files /dev/null and b/source/pic/new/n034.png differ diff --git a/source/pic/new/n035.png b/source/pic/new/n035.png new file mode 100755 index 0000000..52c6abb Binary files /dev/null and b/source/pic/new/n035.png differ diff --git a/source/pic/new/n036.png b/source/pic/new/n036.png new file mode 100755 index 0000000..cb50a2a Binary files /dev/null and b/source/pic/new/n036.png differ diff --git a/source/pic/new/n037.png b/source/pic/new/n037.png new file mode 100755 index 0000000..24a9a2b Binary files /dev/null and b/source/pic/new/n037.png differ diff --git a/source/pic/new/n038.png b/source/pic/new/n038.png new file mode 100755 index 0000000..e097c4e Binary files /dev/null and b/source/pic/new/n038.png differ diff --git a/source/pic/new/n039.png b/source/pic/new/n039.png new file mode 100755 index 0000000..d18884e Binary files /dev/null and b/source/pic/new/n039.png differ diff --git a/source/pic/new/n040.png b/source/pic/new/n040.png new file mode 100755 index 0000000..fa378f6 Binary files /dev/null and b/source/pic/new/n040.png differ diff --git a/source/pic/new/n041.png b/source/pic/new/n041.png new file mode 100755 index 0000000..e7882e0 Binary files /dev/null and b/source/pic/new/n041.png differ diff --git a/source/pic/new/n042.png b/source/pic/new/n042.png new file mode 100755 index 0000000..c88a98c Binary files /dev/null and b/source/pic/new/n042.png differ diff --git a/source/pic/new/n043.png b/source/pic/new/n043.png new file mode 100755 index 0000000..40505fb Binary files /dev/null and b/source/pic/new/n043.png differ diff --git a/source/pic/new/n044-1.png b/source/pic/new/n044-1.png new file mode 100755 index 0000000..6f4b6e0 Binary files /dev/null and b/source/pic/new/n044-1.png differ diff --git a/source/pic/new/n044-2.png b/source/pic/new/n044-2.png new file mode 100755 index 0000000..146e4c8 Binary files /dev/null and b/source/pic/new/n044-2.png differ diff --git a/source/pic/new/n044.png b/source/pic/new/n044.png new file mode 100755 index 0000000..1cdc7fc Binary files /dev/null and b/source/pic/new/n044.png differ diff --git a/source/pic/new/n045-1.png b/source/pic/new/n045-1.png new file mode 100755 index 0000000..eec4823 Binary files /dev/null and b/source/pic/new/n045-1.png differ diff --git a/source/pic/new/n045.png b/source/pic/new/n045.png new file mode 100755 index 0000000..7a103ca Binary files /dev/null and b/source/pic/new/n045.png differ diff --git a/source/pic/new/n046.png b/source/pic/new/n046.png new file mode 100755 index 0000000..9bf0da4 Binary files /dev/null and b/source/pic/new/n046.png differ diff --git a/source/pic/new/n047.png b/source/pic/new/n047.png new file mode 100755 index 0000000..172926d Binary files /dev/null and b/source/pic/new/n047.png differ diff --git a/source/pic/new/n048.png b/source/pic/new/n048.png new file mode 100755 index 0000000..930d7e6 Binary files /dev/null and b/source/pic/new/n048.png differ diff --git a/source/pic/new/n049.png b/source/pic/new/n049.png new file mode 100755 index 0000000..9f3d48c Binary files /dev/null and b/source/pic/new/n049.png differ diff --git a/source/pic/new/n050.png b/source/pic/new/n050.png new file mode 100755 index 0000000..1aefeae Binary files /dev/null and b/source/pic/new/n050.png differ diff --git a/source/pic/new/n051-1.png b/source/pic/new/n051-1.png new file mode 100755 index 0000000..159c71c Binary files /dev/null and b/source/pic/new/n051-1.png differ diff --git a/source/pic/new/n051-2.png b/source/pic/new/n051-2.png new file mode 100755 index 0000000..f182dfe Binary files /dev/null and b/source/pic/new/n051-2.png differ diff --git a/source/pic/new/n051-3.png b/source/pic/new/n051-3.png new file mode 100755 index 0000000..a508f1d Binary files /dev/null and b/source/pic/new/n051-3.png differ diff --git a/source/pic/new/n051.png b/source/pic/new/n051.png new file mode 100755 index 0000000..9c5c53b Binary files /dev/null and b/source/pic/new/n051.png differ diff --git a/source/pic/new/n052.png b/source/pic/new/n052.png new file mode 100755 index 0000000..31dc622 Binary files /dev/null and b/source/pic/new/n052.png differ diff --git a/source/pic/new/n053.png b/source/pic/new/n053.png new file mode 100755 index 0000000..4b3cabe Binary files /dev/null and b/source/pic/new/n053.png differ diff --git a/source/pic/new/n054.png b/source/pic/new/n054.png new file mode 100755 index 0000000..920804f Binary files /dev/null and b/source/pic/new/n054.png differ diff --git a/source/pic/new/n055.png b/source/pic/new/n055.png new file mode 100755 index 0000000..8e0c73c Binary files /dev/null and b/source/pic/new/n055.png differ diff --git a/source/pic/new/n056.png b/source/pic/new/n056.png new file mode 100755 index 0000000..28b4024 Binary files /dev/null and b/source/pic/new/n056.png differ diff --git a/source/pic/new/n057.png b/source/pic/new/n057.png new file mode 100755 index 0000000..18f3857 Binary files /dev/null and b/source/pic/new/n057.png differ diff --git a/source/pic/new/n058.png b/source/pic/new/n058.png new file mode 100755 index 0000000..7ef3bd3 Binary files /dev/null and b/source/pic/new/n058.png differ diff --git a/source/pic/new/n059.png b/source/pic/new/n059.png new file mode 100755 index 0000000..2f30677 Binary files /dev/null and b/source/pic/new/n059.png differ diff --git a/source/pic/new/n060.png b/source/pic/new/n060.png new file mode 100755 index 0000000..fb5213b Binary files /dev/null and b/source/pic/new/n060.png differ diff --git a/source/pic/new/n061.png b/source/pic/new/n061.png new file mode 100755 index 0000000..0a9e704 Binary files /dev/null and b/source/pic/new/n061.png differ diff --git a/source/pic/new/n062.png b/source/pic/new/n062.png new file mode 100755 index 0000000..4b15562 Binary files /dev/null and b/source/pic/new/n062.png differ diff --git a/source/pic/new/n063-1.png b/source/pic/new/n063-1.png new file mode 100755 index 0000000..5b7a64a Binary files /dev/null and b/source/pic/new/n063-1.png differ diff --git a/source/pic/new/n063.png b/source/pic/new/n063.png new file mode 100755 index 0000000..b762cad Binary files /dev/null and b/source/pic/new/n063.png differ diff --git a/source/pic/new/n064.png b/source/pic/new/n064.png new file mode 100755 index 0000000..b80ff62 Binary files /dev/null and b/source/pic/new/n064.png differ diff --git a/source/pic/new/n065.png b/source/pic/new/n065.png new file mode 100755 index 0000000..88ff9e0 Binary files /dev/null and b/source/pic/new/n065.png differ diff --git a/source/pic/new/n066.png b/source/pic/new/n066.png new file mode 100755 index 0000000..8c7175c Binary files /dev/null and b/source/pic/new/n066.png differ diff --git a/source/pic/new/n067.png b/source/pic/new/n067.png new file mode 100755 index 0000000..043a795 Binary files /dev/null and b/source/pic/new/n067.png differ diff --git a/source/pic/new/n068.png b/source/pic/new/n068.png new file mode 100755 index 0000000..732b83f Binary files /dev/null and b/source/pic/new/n068.png differ diff --git a/source/pic/openoffice.org/.directory b/source/pic/openoffice.org/.directory new file mode 100755 index 0000000..e9952b9 --- /dev/null +++ b/source/pic/openoffice.org/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,5,22,14,38,3 +Version=3 diff --git a/source/pic/openoffice.org/base.png b/source/pic/openoffice.org/base.png new file mode 100755 index 0000000..df279d9 Binary files /dev/null and b/source/pic/openoffice.org/base.png differ diff --git a/source/pic/openoffice.org/calc.png b/source/pic/openoffice.org/calc.png new file mode 100755 index 0000000..0ff7fa5 Binary files /dev/null and b/source/pic/openoffice.org/calc.png differ diff --git a/source/pic/openoffice.org/convert1.png b/source/pic/openoffice.org/convert1.png new file mode 100755 index 0000000..b093cb1 Binary files /dev/null and b/source/pic/openoffice.org/convert1.png differ diff --git a/source/pic/openoffice.org/convert2.png b/source/pic/openoffice.org/convert2.png new file mode 100755 index 0000000..abb5c65 Binary files /dev/null and b/source/pic/openoffice.org/convert2.png differ diff --git a/source/pic/openoffice.org/convert3.png b/source/pic/openoffice.org/convert3.png new file mode 100755 index 0000000..6a76170 Binary files /dev/null and b/source/pic/openoffice.org/convert3.png differ diff --git a/source/pic/openoffice.org/draw.png b/source/pic/openoffice.org/draw.png new file mode 100755 index 0000000..6a0cd88 Binary files /dev/null and b/source/pic/openoffice.org/draw.png differ diff --git a/source/pic/openoffice.org/guide.png b/source/pic/openoffice.org/guide.png new file mode 100755 index 0000000..27b96dc Binary files /dev/null and b/source/pic/openoffice.org/guide.png differ diff --git a/source/pic/openoffice.org/impress.png b/source/pic/openoffice.org/impress.png new file mode 100755 index 0000000..20f248b Binary files /dev/null and b/source/pic/openoffice.org/impress.png differ diff --git a/source/pic/openoffice.org/navigation.png b/source/pic/openoffice.org/navigation.png new file mode 100755 index 0000000..972b30d Binary files /dev/null and b/source/pic/openoffice.org/navigation.png differ diff --git a/source/pic/openoffice.org/openoffice.png b/source/pic/openoffice.org/openoffice.png new file mode 100755 index 0000000..5b4ffe9 Binary files /dev/null and b/source/pic/openoffice.org/openoffice.png differ diff --git a/source/pic/openoffice.org/style.png b/source/pic/openoffice.org/style.png new file mode 100755 index 0000000..61b1a5e Binary files /dev/null and b/source/pic/openoffice.org/style.png differ diff --git a/source/pic/openoffice.org/writer.png b/source/pic/openoffice.org/writer.png new file mode 100755 index 0000000..3f64ab8 Binary files /dev/null and b/source/pic/openoffice.org/writer.png differ diff --git a/source/pic/qtcreater.png b/source/pic/qtcreater.png new file mode 100755 index 0000000..51589dd Binary files /dev/null and b/source/pic/qtcreater.png differ diff --git a/source/pic/remote01.png b/source/pic/remote01.png new file mode 100755 index 0000000..bbfa71f Binary files /dev/null and b/source/pic/remote01.png differ diff --git a/source/pic/remote02.png b/source/pic/remote02.png new file mode 100755 index 0000000..2937caf Binary files /dev/null and b/source/pic/remote02.png differ diff --git a/source/pic/remote03.png b/source/pic/remote03.png new file mode 100755 index 0000000..e39f564 Binary files /dev/null and b/source/pic/remote03.png differ diff --git a/source/pic/remote04.png b/source/pic/remote04.png new file mode 100755 index 0000000..c08bfda Binary files /dev/null and b/source/pic/remote04.png differ diff --git a/source/pic/remote05.png b/source/pic/remote05.png new file mode 100755 index 0000000..99ca709 Binary files /dev/null and b/source/pic/remote05.png differ diff --git a/source/pic/remote06.png b/source/pic/remote06.png new file mode 100644 index 0000000..b5caf0a Binary files /dev/null and b/source/pic/remote06.png differ diff --git a/source/pic/scim.png b/source/pic/scim.png new file mode 100644 index 0000000..9a134b8 Binary files /dev/null and b/source/pic/scim.png differ diff --git a/source/pic/sec001.png b/source/pic/sec001.png new file mode 100755 index 0000000..341a1d1 Binary files /dev/null and b/source/pic/sec001.png differ diff --git a/source/pic/sec002.png b/source/pic/sec002.png new file mode 100755 index 0000000..54b7c9e Binary files /dev/null and b/source/pic/sec002.png differ diff --git a/source/pic/sec003.png b/source/pic/sec003.png new file mode 100755 index 0000000..e9ca938 Binary files /dev/null and b/source/pic/sec003.png differ diff --git a/source/pic/sec004.png b/source/pic/sec004.png new file mode 100755 index 0000000..8eead84 Binary files /dev/null and b/source/pic/sec004.png differ diff --git a/source/pic/sec005.png b/source/pic/sec005.png new file mode 100755 index 0000000..acaff55 Binary files /dev/null and b/source/pic/sec005.png differ diff --git a/source/pic/sec006.png b/source/pic/sec006.png new file mode 100755 index 0000000..8975f1d Binary files /dev/null and b/source/pic/sec006.png differ diff --git a/source/pic/sec007.png b/source/pic/sec007.png new file mode 100755 index 0000000..4237528 Binary files /dev/null and b/source/pic/sec007.png differ diff --git a/source/pic/sec008.png b/source/pic/sec008.png new file mode 100755 index 0000000..2066471 Binary files /dev/null and b/source/pic/sec008.png differ diff --git a/source/pic/sec009.png b/source/pic/sec009.png new file mode 100755 index 0000000..950d4e4 Binary files /dev/null and b/source/pic/sec009.png differ diff --git a/source/pic/sec010.png b/source/pic/sec010.png new file mode 100755 index 0000000..20fee4a Binary files /dev/null and b/source/pic/sec010.png differ diff --git a/source/pic/sec011.png b/source/pic/sec011.png new file mode 100755 index 0000000..7cd2c1c Binary files /dev/null and b/source/pic/sec011.png differ diff --git a/source/pic/sec012.png b/source/pic/sec012.png new file mode 100755 index 0000000..46d8804 Binary files /dev/null and b/source/pic/sec012.png differ diff --git a/source/pic/sec013.png b/source/pic/sec013.png new file mode 100755 index 0000000..ab9f258 Binary files /dev/null and b/source/pic/sec013.png differ diff --git a/source/pic/sec014.png b/source/pic/sec014.png new file mode 100755 index 0000000..b605a03 Binary files /dev/null and b/source/pic/sec014.png differ diff --git a/source/pic/sec015.png b/source/pic/sec015.png new file mode 100755 index 0000000..bc28b57 Binary files /dev/null and b/source/pic/sec015.png differ diff --git a/source/pic/sec016.png b/source/pic/sec016.png new file mode 100755 index 0000000..1644e69 Binary files /dev/null and b/source/pic/sec016.png differ diff --git a/source/pic/sec017.png b/source/pic/sec017.png new file mode 100755 index 0000000..abedb59 Binary files /dev/null and b/source/pic/sec017.png differ diff --git a/source/pic/sec018.png b/source/pic/sec018.png new file mode 100755 index 0000000..c16ac77 Binary files /dev/null and b/source/pic/sec018.png differ diff --git a/source/pic/sec019.png b/source/pic/sec019.png new file mode 100755 index 0000000..bb6b3e5 Binary files /dev/null and b/source/pic/sec019.png differ diff --git a/source/pic/sec020.png b/source/pic/sec020.png new file mode 100755 index 0000000..d16d09f Binary files /dev/null and b/source/pic/sec020.png differ diff --git a/source/pic/sec021.png b/source/pic/sec021.png new file mode 100755 index 0000000..d3e8d4d Binary files /dev/null and b/source/pic/sec021.png differ diff --git a/source/pic/sec022.png b/source/pic/sec022.png new file mode 100755 index 0000000..cb48461 Binary files /dev/null and b/source/pic/sec022.png differ diff --git a/source/pic/sec023.png b/source/pic/sec023.png new file mode 100755 index 0000000..1a4eee8 Binary files /dev/null and b/source/pic/sec023.png differ diff --git a/source/pic/sec024.png b/source/pic/sec024.png new file mode 100755 index 0000000..c4a6b84 Binary files /dev/null and b/source/pic/sec024.png differ diff --git a/source/pic/serialnumber.png b/source/pic/serialnumber.png new file mode 100755 index 0000000..d30dc7e Binary files /dev/null and b/source/pic/serialnumber.png differ diff --git a/source/pic/startup.png b/source/pic/startup.png new file mode 100755 index 0000000..d1d6915 Binary files /dev/null and b/source/pic/startup.png differ diff --git a/source/pic/thunderbird/.directory b/source/pic/thunderbird/.directory new file mode 100755 index 0000000..cac6757 --- /dev/null +++ b/source/pic/thunderbird/.directory @@ -0,0 +1,5 @@ +[Dolphin] +PreviewsShown=true +ShowPreview=true +Timestamp=2014,6,10,15,27,42 +Version=3 diff --git a/source/pic/thunderbird/001.png b/source/pic/thunderbird/001.png new file mode 100755 index 0000000..7650b47 Binary files /dev/null and b/source/pic/thunderbird/001.png differ diff --git a/source/pic/thunderbird/002.png b/source/pic/thunderbird/002.png new file mode 100755 index 0000000..b802bd4 Binary files /dev/null and b/source/pic/thunderbird/002.png differ diff --git a/source/pic/thunderbird/003.png b/source/pic/thunderbird/003.png new file mode 100755 index 0000000..79eab91 Binary files /dev/null and b/source/pic/thunderbird/003.png differ diff --git a/source/pic/thunderbird/004.png b/source/pic/thunderbird/004.png new file mode 100755 index 0000000..9fd5df9 Binary files /dev/null and b/source/pic/thunderbird/004.png differ diff --git a/source/pic/thunderbird/005.png b/source/pic/thunderbird/005.png new file mode 100755 index 0000000..b992b71 Binary files /dev/null and b/source/pic/thunderbird/005.png differ diff --git a/source/pic/thunderbird/006.png b/source/pic/thunderbird/006.png new file mode 100755 index 0000000..12fc009 Binary files /dev/null and b/source/pic/thunderbird/006.png differ diff --git a/source/pic/thunderbird/007.png b/source/pic/thunderbird/007.png new file mode 100755 index 0000000..9cf55b4 Binary files /dev/null and b/source/pic/thunderbird/007.png differ diff --git a/source/pic/thunderbird/008.png b/source/pic/thunderbird/008.png new file mode 100755 index 0000000..2d9e06c Binary files /dev/null and b/source/pic/thunderbird/008.png differ diff --git a/source/pic/thunderbird/009.png b/source/pic/thunderbird/009.png new file mode 100755 index 0000000..1563e43 Binary files /dev/null and b/source/pic/thunderbird/009.png differ diff --git a/source/pic/thunderbird/010.png b/source/pic/thunderbird/010.png new file mode 100755 index 0000000..a994eba Binary files /dev/null and b/source/pic/thunderbird/010.png differ diff --git a/source/pic/thunderbird/011.png b/source/pic/thunderbird/011.png new file mode 100755 index 0000000..6b10e8e Binary files /dev/null and b/source/pic/thunderbird/011.png differ diff --git a/source/pic/thunderbird/012.png b/source/pic/thunderbird/012.png new file mode 100755 index 0000000..b11d83e Binary files /dev/null and b/source/pic/thunderbird/012.png differ diff --git a/source/pic/thunderbird/013.png b/source/pic/thunderbird/013.png new file mode 100755 index 0000000..24deb8f Binary files /dev/null and b/source/pic/thunderbird/013.png differ diff --git a/source/pic/thunderbird/014.png b/source/pic/thunderbird/014.png new file mode 100755 index 0000000..70a7b6b Binary files /dev/null and b/source/pic/thunderbird/014.png differ diff --git a/source/pic/thunderbird/015.png b/source/pic/thunderbird/015.png new file mode 100755 index 0000000..e206db6 Binary files /dev/null and b/source/pic/thunderbird/015.png differ diff --git a/source/pic/thunderbird/016.png b/source/pic/thunderbird/016.png new file mode 100755 index 0000000..4a24e8a Binary files /dev/null and b/source/pic/thunderbird/016.png differ diff --git a/source/pic/thunderbird/017.png b/source/pic/thunderbird/017.png new file mode 100755 index 0000000..1d62f60 Binary files /dev/null and b/source/pic/thunderbird/017.png differ diff --git a/source/pic/thunderbird/018.png b/source/pic/thunderbird/018.png new file mode 100755 index 0000000..722d8ae Binary files /dev/null and b/source/pic/thunderbird/018.png differ diff --git a/source/pic/thunderbird/019.png b/source/pic/thunderbird/019.png new file mode 100755 index 0000000..adc7752 Binary files /dev/null and b/source/pic/thunderbird/019.png differ diff --git a/source/pic/thunderbird/020.png b/source/pic/thunderbird/020.png new file mode 100755 index 0000000..6742ee7 Binary files /dev/null and b/source/pic/thunderbird/020.png differ diff --git a/source/pic/thunderbird/021.png b/source/pic/thunderbird/021.png new file mode 100755 index 0000000..872675c Binary files /dev/null and b/source/pic/thunderbird/021.png differ diff --git a/source/pic/thunderbird/022.png b/source/pic/thunderbird/022.png new file mode 100755 index 0000000..441754c Binary files /dev/null and b/source/pic/thunderbird/022.png differ diff --git a/source/pic/thunderbird/023.png b/source/pic/thunderbird/023.png new file mode 100755 index 0000000..2a31cde Binary files /dev/null and b/source/pic/thunderbird/023.png differ diff --git a/source/pic/thunderbird/025.png b/source/pic/thunderbird/025.png new file mode 100755 index 0000000..91cbe56 Binary files /dev/null and b/source/pic/thunderbird/025.png differ diff --git a/source/pic/thunderbird/026.png b/source/pic/thunderbird/026.png new file mode 100755 index 0000000..d2d0ef5 Binary files /dev/null and b/source/pic/thunderbird/026.png differ diff --git a/source/pic/thunderbird/027.png b/source/pic/thunderbird/027.png new file mode 100755 index 0000000..640a1b7 Binary files /dev/null and b/source/pic/thunderbird/027.png differ diff --git a/source/pic/thunderbird/028.png b/source/pic/thunderbird/028.png new file mode 100755 index 0000000..c5edf69 Binary files /dev/null and b/source/pic/thunderbird/028.png differ diff --git a/source/pic/thunderbird/029.png b/source/pic/thunderbird/029.png new file mode 100755 index 0000000..98c69b7 Binary files /dev/null and b/source/pic/thunderbird/029.png differ diff --git a/source/pic/thunderbird/030.png b/source/pic/thunderbird/030.png new file mode 100755 index 0000000..f5f0a7e Binary files /dev/null and b/source/pic/thunderbird/030.png differ diff --git a/source/pic/thunderbird/031.png b/source/pic/thunderbird/031.png new file mode 100755 index 0000000..20c1265 Binary files /dev/null and b/source/pic/thunderbird/031.png differ diff --git a/source/pic/thunderbird/032.png b/source/pic/thunderbird/032.png new file mode 100755 index 0000000..bb64916 Binary files /dev/null and b/source/pic/thunderbird/032.png differ diff --git a/source/pic/thunderbird/新建文件夹/01.png b/source/pic/thunderbird/新建文件夹/01.png new file mode 100755 index 0000000..d4a4c21 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/01.png differ diff --git a/source/pic/thunderbird/新建文件夹/02.png b/source/pic/thunderbird/新建文件夹/02.png new file mode 100755 index 0000000..044b315 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/02.png differ diff --git a/source/pic/thunderbird/新建文件夹/03.png b/source/pic/thunderbird/新建文件夹/03.png new file mode 100755 index 0000000..48b4538 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/03.png differ diff --git a/source/pic/thunderbird/新建文件夹/04.png b/source/pic/thunderbird/新建文件夹/04.png new file mode 100755 index 0000000..0e07cd9 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/04.png differ diff --git a/source/pic/thunderbird/新建文件夹/05.png b/source/pic/thunderbird/新建文件夹/05.png new file mode 100755 index 0000000..758cdb3 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/05.png differ diff --git a/source/pic/thunderbird/新建文件夹/06.png b/source/pic/thunderbird/新建文件夹/06.png new file mode 100755 index 0000000..64daf29 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/06.png differ diff --git a/source/pic/thunderbird/新建文件夹/07.png b/source/pic/thunderbird/新建文件夹/07.png new file mode 100755 index 0000000..d93b0a1 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/07.png differ diff --git a/source/pic/thunderbird/新建文件夹/08.png b/source/pic/thunderbird/新建文件夹/08.png new file mode 100755 index 0000000..0cf8928 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/08.png differ diff --git a/source/pic/thunderbird/新建文件夹/09.png b/source/pic/thunderbird/新建文件夹/09.png new file mode 100755 index 0000000..2162033 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/09.png differ diff --git a/source/pic/thunderbird/新建文件夹/10.png b/source/pic/thunderbird/新建文件夹/10.png new file mode 100755 index 0000000..3183072 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/10.png differ diff --git a/source/pic/thunderbird/新建文件夹/11.png b/source/pic/thunderbird/新建文件夹/11.png new file mode 100755 index 0000000..77ef942 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/11.png differ diff --git a/source/pic/thunderbird/新建文件夹/address.png b/source/pic/thunderbird/新建文件夹/address.png new file mode 100755 index 0000000..e629cd7 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/address.png differ diff --git a/source/pic/thunderbird/新建文件夹/attach.png b/source/pic/thunderbird/新建文件夹/attach.png new file mode 100755 index 0000000..ca22dfd Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/attach.png differ diff --git a/source/pic/thunderbird/新建文件夹/compose.png b/source/pic/thunderbird/新建文件夹/compose.png new file mode 100755 index 0000000..58bc014 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/compose.png differ diff --git a/source/pic/thunderbird/新建文件夹/del.png b/source/pic/thunderbird/新建文件夹/del.png new file mode 100755 index 0000000..46010db Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/del.png differ diff --git a/source/pic/thunderbird/新建文件夹/foward.png b/source/pic/thunderbird/新建文件夹/foward.png new file mode 100755 index 0000000..c8a7a81 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/foward.png differ diff --git a/source/pic/thunderbird/新建文件夹/get-msge.png b/source/pic/thunderbird/新建文件夹/get-msge.png new file mode 100755 index 0000000..12b4f3c Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/get-msge.png differ diff --git a/source/pic/thunderbird/新建文件夹/reply-all.png b/source/pic/thunderbird/新建文件夹/reply-all.png new file mode 100755 index 0000000..22aff30 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/reply-all.png differ diff --git a/source/pic/thunderbird/新建文件夹/reply.png b/source/pic/thunderbird/新建文件夹/reply.png new file mode 100755 index 0000000..0614364 Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/reply.png differ diff --git a/source/pic/thunderbird/新建文件夹/save.png b/source/pic/thunderbird/新建文件夹/save.png new file mode 100755 index 0000000..c54376d Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/save.png differ diff --git a/source/pic/thunderbird/新建文件夹/send.png b/source/pic/thunderbird/新建文件夹/send.png new file mode 100755 index 0000000..5ab587e Binary files /dev/null and b/source/pic/thunderbird/新建文件夹/send.png differ diff --git a/source/pic/tree.png b/source/pic/tree.png new file mode 100755 index 0000000..bf1dd3e Binary files /dev/null and b/source/pic/tree.png differ diff --git a/source/pic/x.log b/source/pic/x.log new file mode 100755 index 0000000..ae6bb44 --- /dev/null +++ b/source/pic/x.log @@ -0,0 +1,33 @@ +This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for opensuse.org) (format=pdflatex 2014.5.9) 23 MAY 2014 11:00 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**6.0.60desktop.tex +(/usr/share/texmf/tex/latex/tools/x.tex +LaTeX2e <2011/06/27> +Babel <3.9f> and hyphenation patterns for 78 languages loaded. + +! . +l.34 \batchmode \errmessage{} + \csname @@end\endcsname \end +This error message was generated by an \errmessage +command, so I can't give any explicit help. +Pretend that you're Hercule Poirot: Examine all clues, +and deduce the truth by order and method. + + ) +Here is how much of TeX's memory you used: + 7 strings out of 493440 + 241 string characters out of 6147400 + 52012 words of memory out of 5000000 + 3557 multiletter control sequences out of 15000+600000 + 3640 words of font info for 14 fonts, out of 8000000 for 9000 + 831 hyphenation exceptions out of 8191 + 5i,0n,1p,97b,8s stack positions out of 5000i,500n,10000p,200000b,80000s + +No pages of output. +PDF statistics: + 0 PDF objects out of 1000 (max. 8388607) + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/source/pic/xosview.png b/source/pic/xosview.png new file mode 100755 index 0000000..2775660 Binary files /dev/null and b/source/pic/xosview.png differ diff --git a/source/中文支持.rst b/source/中文支持.rst new file mode 100644 index 0000000..52aef8d --- /dev/null +++ b/source/中文支持.rst @@ -0,0 +1,174 @@ +中文支持 +======== + +多语言环境支持 +-------------- + +凝思安全操作系统 V6.0 支持良好的多语言环境,程序运行时可以方便的无缝切换其输出的语言,以方便不同情况的需要。系统默认支持中文、英文两种语言环境,他们的切换可以通过环境变量LANG来指定。 + +示例:默认条件下系统的命令以中文方式返回响应结果: + + + +.. figure:: ./pic/echo1.png + :width: 100% + :alt: 中文响应信息 + + 中文响应信息 + +如果需要查看英文的提示信息可以使用如下命令: + + +.. figure:: ./pic/echo2.png + :width: 100% + :alt: 英文响应信息 + + 英文响应信息 + +字符编码与中文字体 +------------------ + +凝思安全操作系统 V6.0 提供国标2级字库及通用的中文字体,提供对简体中文的显示、输入和打印。 + +凝思安全操作系统支持的字符编码有: + +- C + +- POSIX + +- zh_CN + +- zh_CN.gb18030 + +- zh_CN.gb2312 + +- zh_CN.gbk + +- zh_CN.utf8 + +可以通过使用命令 ``locale -a /usr/share/i18n/SUPPORTED`` 查看。 + +凝思安全操作系统支持的中文字体有: + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-c-0-gb18030.2000-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-c-0-gb2312.1980-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-c-0-gbk-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-m-0-gb18030.2000-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-m-0-gb2312.1980-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-m-0-gbk-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-p-0-gb18030.2000-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-p-0-gb2312.1980-0 + +- -arphic-ar pl ukai cn-book-r-normal–0-0-0-0-p-0-gbk-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-c-0-gb18030.2000-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-c-0-gb2312.1980-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-c-0-gbk-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-m-0-gb18030.2000-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-m-0-gb2312.1980-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-m-0-gbk-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-p-0-gb18030.2000-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-p-0-gb2312.1980-0 + +- -arphic-ar pl uming cn-light-r-normal–0-0-0-0-p-0-gbk-0 + +- -cc-song-medium-r-normal-jiantizi-0-0-75-75-c-0-gb2312.1980-0 + +- -cc-song-medium-r-normal-jiantizi-40-400-75-75-c-400-gb2312.1980-0 + +- -cc-song-medium-r-normal-jiantizi-48-480-75-75-c-480-gb2312.1980-0 + +- -guobiao-song-medium-r-normal–0-0-72-72-c-0-gb2312.80&gb8565.88-0 + +- -guobiao-song-medium-r-normal–16-160-72-72-c-160-gb2312.80&gb8565.88-0 + +- -guobiao-song-medium-r-normal–16-160-72-72-c-160-gb2312.80-0 + +- -guobiao-song-medium-r-normal–16-160-72-72-c-160-gb8565.88-0 + +- -isas-fangsong ti-medium-r-normal–0-0-72-72-c-0-gb2312.1980-0 + +- -isas-fangsong ti-medium-r-normal–16-160-72-72-c-160-gb2312.1980-0 + +- -isas-song ti-medium-r-normal–0-0-72-72-c-0-gb2312.1980-0 + +- -isas-song ti-medium-r-normal–16-160-72-72-c-160-gb2312.1980-0 + +- -isas-song ti-medium-r-normal–24-240-72-72-c-240-gb2312.1980-0 + +- -wenquanyi-wenquanyi bitmap + song-bold-r-normal–0-0-100-100-p-0-gb18030.2000-0 + +- -wenquanyi-wenquanyi bitmap + song-bold-r-normal–0-0-100-100-p-0-gb2312.1980-0 + +- -wenquanyi-wenquanyi bitmap song-bold-r-normal–0-0-100-100-p-0-gbk-0 + +- -wenquanyi-wenquanyi bitmap + song-bold-r-normal–0-0-75-75-p-0-gb18030.2000-0 + +- -wenquanyi-wenquanyi bitmap + song-bold-r-normal–0-0-75-75-p-0-gb2312.1980-0 + +- -wenquanyi-wenquanyi bitmap song-bold-r-normal–0-0-75-75-p-0-gbk-0 + +- -wenquanyi-wenquanyi bitmap + song-medium-r-normal–0-0-100-100-p-0-gb18030.2000-0 + +- -wenquanyi-wenquanyi bitmap + song-medium-r-normal–0-0-100-100-p-0-gb2312.1980-0 + +- -wenquanyi-wenquanyi bitmap + song-medium-r-normal–0-0-100-100-p-0-gbk-0 + +- -wenquanyi-wenquanyi bitmap + song-medium-r-normal–0-0-75-75-p-0-gb18030.2000-0 + +- -wenquanyi-wenquanyi bitmap + song-medium-r-normal–0-0-75-75-p-0-gb2312.1980-0 + +- -wenquanyi-wenquanyi bitmap song-medium-r-normal–0-0-75-75-p-0-gbk-0 + +- hanzigb16fs + +- hanzigb16st + +- hanzigb24st + +可以通过使用命令  ``xlsfonts |grep gb`` 查看。 + +.. raw:: latex + + \newpage + +输入法 +------ + +凝思安全操作系统提供用户体验良好的通用输入法平台SCIM,同时支持智能拼音中文输入法和五笔输入法。 + +默认情况下英文输入,如果需要输入中文可以按组合键 :kbd:`Ctrl` + :kbd:`Space` 切换到中文输入。 + +默认情况下中文输入使用的是智能拼音输入方法,如果需要切换到五笔输入法,可以点击输入法平台上的“智能拼音”,查看并选择五笔输入法。如 :numref:`figscim` 所示。 + +.. _figscim: + +.. figure:: ./pic/scim.png + :width: 100% + :alt: 输入法 + + 输入法 + diff --git a/source/产品概述.rst b/source/产品概述.rst new file mode 100644 index 0000000..d15f851 --- /dev/null +++ b/source/产品概述.rst @@ -0,0 +1,129 @@ +.. raw:: latex + + \chapter*{产品概述}\addcontentsline{toc}{chapter}{产品概述} + \markboth{产品概述}{产品概述} + + +.. only:: html + + 产品概述 + ========= + +凝思安全操作系统是北京凝思自主研发、拥有完全自主知识产权、具备等保四级要求、并且达到军 B 级安全级别的操作系统,是国内首家达到安全服务器保护轮廓 EAL3 级别的安全产品。 + +北京凝思经过多年的研究,开发出的凝思安全操作系统具有以下主要特点: + +- 高可用性 + + 凝思安全操作系统发布前进行了长时间的压力测试,能够保证在高内存和 CPU 负载环境下稳定运行,为各类应用提供稳定的运行平台。 + + 为进一步提高操作系统稳定性,凝思安全操作系统还提供多种冗余容错机制,降低部件故障引起的整机失效。这些机制包括: + + - 磁盘冗余技术 + + 提供软 RAID 技术,通过磁盘冗余降低磁盘故障引起的系统风险。支持在线重建,减少系统恢复时间,提高系统稳定性。 + + - 网卡冗余技术 + + 提供网卡的负载均衡和冗余备份,当两块网卡自身及其链路正常时,可提供网卡负载均衡功能,提高网络传输效率;当一块网卡或其链路发生故障时,另一网卡仍可继续提供服务,提高网络的整体可靠性。 + + - 磁盘阵列卡冗余技术 + + 支持磁盘阵列卡的主备机制,当主卡或其通信链路发生故障时,凝思安全操作系统将自动切换至备份卡进行设备访问,保证磁盘阵列数据的连续性。 + + - 软件固化技术 + + 支持关键操作系统数据以只读形式存储于电子盘中,防止恶意或偶然操作破坏系统数据。支持无硬盘工作模式,系统运行在基于电子盘的环境中,进一步提高系统稳定性。 + + - 双机热备和服务热切换机制 + + 支持分布式双机数据热备份和服务热切换机制,当主服务器当机时服务将自动漂移至辅服务器,由于数据实现实时同步,在服务器单点故障时,服务仍不会终止,系统的整体稳定性得以充分保障。 + +- 高兼容性 + + 凝思安全操作系统适用于从大型计算到桌面办公等各种环境,支持各类通用和专业应用,具有良好的软硬件兼容性。 + + 凝思安全操作系统的 API 接口和实用工具完全遵循 POSIX 标准,并支持 LSB 和 FHS 等 Linux 相关标准,能够二进制兼容各类为 Linux 系统开发的应用软件,并可在二进制保持与其它 Linux 发行版的兼容。支持基于 Java 的跨平台软件,可实现基于多款中间件软件的 Web 应用系统。支持 32 位和 64 位应用程序,使用户在 32 位系统上开发的软件可直接运行于 64 系统,缩短用户应用系统的研发周期。 + + 凝思安全操作系统提供丰富的驱动程序,支持各类主流磁盘驱动器、网卡驱动器和显示控制器等硬件设备。兼容国内外各大主流厂商的多款服务器和桌面计算机。北京凝思还可协助第三方硬件厂商完成驱动程序的研发和移植,实现加密卡等专用硬件设备支持。 + +- 高效性 + + 凝思安全操作系统可针对服务器、工作站、专用设备和桌面环境进行特别优化,获得比通用操作系统更高的运行效率。 + + 在特定项目的应用环境中,凝思可以还可针对应用系统的特性对操作系统做进一步的优化,使系统的运行效率最大化。各个操作系统内核组件的定制和优化,可充分发挥硬件平台的性能,对应用程序提供最佳支持,构建稳定、高效的计算环境。定制的内容包括: + + - 定制和剪裁最小应用软件运行环境,保证系统组件的可控性,提高系统的运行效率和可用性。 + + - 定制进程调度策略,减少调度开销,提高操作系统和应用程序的响应速度和运行效率。 + + - 定制文件系统类型和存储模式,提供可靠和有效的文件系统支持,使应用程序能够快速访问文件数据。 + + - 定制驱动程序,实现用户程序对设备数据的快速访问,降低设备访问的系统资源开销,提高应用系统的数据处理能力。 + +- 易维护性 + + 凝思安全操作系统的配置、使用和维护方法与传统 UNIX 和 Linux 保持一致,提供丰富的管理和维护软件,既可通过命令行工具完成系统配置和维护,又可通过图形界面完成相关操作,简化用户操作步骤,减少管理员的维护工作量。支持键盘/显示器、串口和网络等多种接入方式,便于管理员的本地和远程 + 管理。基于网络的远程管理支持加密通道的远程登录,可使用命令行方式管理远程系统;同时支持远程图形化管理和远程桌面重定向,为管理员和用户提供图形界面的系统维护和操作。服务自启动功能使系统无须人工干预即可自动进入服务提供状态,减少系统故障恢复时间,提高系统可获得性。丰富的审计日志使管理员能够准确分析并定位各类系统故障,为快速排除问题,恢复系统正常运行提供支持。凝思安全操作系统还提供状态显示、声音报警、邮件和短信通知等多种报警机制,使管理员能够及时掌握系统的运行状态,第一时间获取系统紧急故障和安全性信息。 + +.. raw:: latex + + \vspace{1cm} + +目前,以凝思安全操作系统为核心的安全服务器系统平台已广泛应用在国家部委、军队系统及电信、电力等行业关键部门,并获得了用户的一致好评。 + +.. raw:: latex + + \vspace{1cm} + +凝思安全操作系统 V6.0 基于凝思安全操作系统 V4.x,并在以下方面对系统进行了改进和完善: + +- 硬件兼容性 + + 凝思安全操作系统 V6.0 分为32位和64位,支持 x86_64、i386、PPC、IA、 MIPS、龙芯、spaic 的 CPU,IDE、RAID、USB 和 SCSI 控制器,HBA 控制器, nVIDIA、ATI 显卡,能在主流厂商的服务器、PC、公共机及笔记本上正常运行。 + + 经测试,凝思安全操作系统 V6.0 能在下列服务器上稳定运行:曙光专用并行机、曙光专用并行机-Z、曙光专用并行机-Y、曙光专用并行机-Z2、曙光专用并行机-H、曙光 A830r-fx、曙光 A620r-F、联想 R525G3 机架服务器、联想 R680G7 机架服务器、联想 E710R 刀片服务器、浪潮 NF5220 机架服务器、浪潮 NF5280M2 机架服务器、华为 E6000 刀片服务器、华为 RH2285V1R1 机架服务器、华为 RH2488 机架服务器。 + +- 软件兼容性 + + 凝思安全操作系统 V6.0 上可运行多种应用软件。 + + 经测试,达梦数据库 V6.0.60、金仓数据库 V6.1.3、神州通用数据库 V7.0、IBM + DB2 数据库 V9.7、Oracle 10g 数据库、Oracle + 11g 数据库、中创 Inforsuite 中间件 V8.2.0、 OpenLDAP V2.4.26、曙光、哈工大、计算所、启明星晨和北航等单位的前端和后端软件都能够在凝思安全操作系统 V6.0 上稳定运行。 + +- 软件包管理机制 + + 凝思安全操作系统 V6.0 采用 deb 包管理方式,能够更好地处理软件依赖关系,便于本地管理以及远程升级软件包。 + +- 网络部署 + + 网络部署模块采用客户端/服务器的网络模式,利用 DHCP/BOOTP 协议从服务器端获得客户端计算机系统的 IP 地址,然后客户端再利用 TFTP 协议从服务器端下载引导程序。这个引导程序为 Network + Bootstrap + Program(NBP),引导程序加载凝思安全操作系统 V6.0 的安装程序,执行安装程序。安装程序到已经搭建好的凝思安全操作系统 V6.0 的安装源中取得各个需要的组件,安装到硬盘,实现通过网络进行部署。支持全自动网络安装,提高大规模部署的工作效率,降低安装出错几率。 + +- 能量控制 + + 在能量控制研究方面,经过仔细分析计算机中 cpu、硬盘、显卡等硬件的耗电情况,根据实际应用要求,最终确定以控制 cpu 频率、内核节电配置和用内存盘缓存硬盘读写的方案实现能耗的降低。通过方案的实施,达到了相对原有系统能耗降低0.5%的目标。 + +- 速率优化 + + 在速率优化方面,分别针对 AMD 和 Intel 的体系结构进行了研究。主要在内核中针对不同体系结构的选项进行筛选,在编译系统的过程中,为不同的体系结构配置了不同的编译选项。 + +- 凝思安全机制 + + 凝思安全操作系统 V6.0 的安全机制继承了原 4.2 系统安全的优点,并不断创新和完善,主要有以下改进: + + - 强制访问控制(Mandatory Access Control,简称 MAC) + + 在 4.2 系统实现的强制访问控制功能中,强制访问控制策略中的规则是固定的,数据流动需同时满足 BLP 策略和 BIBA 策略。规则固定,主体和客体标签的含义也是固定的,分别代表 BLP 级别(category)、BLP 类别(class)以及 BIBA 的完整性级别(integrity)。而 6.0 系统中实现的强制访问控制的规则是可以配置的,标签的含义也是可以配置的,并且可以配置为完全覆盖 4.2 系统的强制访问控制机制。另外,与 4.2 不同的是,6.0 的标签是全系统的,每个主体或客体都带有标签。 + + - 强制行为控制(Mandatory Behavior Control,简称 MBC) + + MBC 是 4.2 系统中 MEC(Mandatory Execution + Control,强制运行控制)的增强。MEC 是对进程执行系统调用 execve 进行控制,控制结果为允许或者拒绝。MBC 在 MEC 的基础上将控制的行为从执行扩展到读、写和执行。 + + - 强制能力控制(Mandatory Capability Control,简称 MCC) + + MCC 包括两方面,一个是限制 setuid-root 文件执行时引入的能力,另一个是建立分权管理员机制。这两方面的目的和 4.2 系统的目的是一致的,但是我们采用了完全不一样的实现方式,并且特权管理员由原来固定的4个扩展为可自定义配置。 + diff --git a/source/关于本书.rst b/source/关于本书.rst new file mode 100644 index 0000000..9fab9b4 --- /dev/null +++ b/source/关于本书.rst @@ -0,0 +1,200 @@ +.. raw:: latex + + \chapter*{关于本书}\addcontentsline{toc}{chapter}{关于本书} + \markboth{关于本书}{文档约定} + +.. only:: html + + 关于本书 + ========== + +.. raw:: latex + + \section*{文档约定}\addcontentsline{toc}{section}{文档约定} + \markboth{关于本书}{文档约定} + +.. raw:: html + +

文档约定

+ + +本手册中会有某些字词使用了不一样的字体、样式,规律如下: + +- ``command`` + + 命令,表示您可以在命令行中键入单词或短语,然后按 :kbd:`Enter` 键来启用命令。 + + 例如:使用 ``cat testfile`` 命令来查看当前目录中一个叫 ``testfile`` 的文件。 + +- ``file name`` + + 文件名、目录名、路径,表示系统中存在着一个叫这个名称的文件或目录。 + + 例如: + + - 您的主目录中的 ``.bashrc`` 文件包括您自用的\ **bash shell**\ 定义和别名。 + + - ``/etc/fstab`` 文件包括关于不用系统设备和文件系统的信息。 + +- ``parameter value`` + + 参数及其设定值。 + + 例如: + + ``ServerType standalone`` + + ``ServerType`` 定义服务器的启动方式,缺省值为独立方式 ``standalone`` 。 + +- ``script`` + + 脚本。 + + 例如: + + :: + + + Options FollowSymLinks + AllowOverride None + + + + +- :kbd:`key` + + 键盘上的按键。 + + 例如:要使用 :kbd:`Tab` 键补全,键入一个字符然后按 :kbd:`Tab` 键,您的终端上就会显示目录中起首为那个字符的文件列表。 + + +除此之外,我们还使用几种不同的方式来强调某些信息。按照信息对您的系统的重要程度,它们被标为注意、提示、重要、小心或警告。例如: + + + +.. attention:: + + 切记,凝思安全操作系统区分大小写。换一句话说,rose~不是~ROSE~或~Rose。 + + + +.. hint:: + + 目录 /usr/share/doc 包括了关于您的系统上安装的软件包的附加信息。 + + +.. important:: + + 如果您修改了DHCP配置文件,这些改变在您重启DHCP守护进程之后才会生效。 + + + +.. caution:: + + 管理员帐号是用来执行系统管理任务的,执行日常任务请使用一个常规的用户帐号。 + + + +.. warning:: + + 删除分区操作没有确认过程,会直接将已有分区删除。如果您想撤销该删除操作,只能不将分区结果写入磁盘而直接退出分区界面,然后再重新进入分区界面,但之前的所有分区操作都将丢失。慎用! + + + + +.. raw:: latex + + \section*{术语简介}\addcontentsline{toc}{section}{术语简介} + \markboth{关于本书}{术语简介} + +.. raw:: html + +

术语简介

+ +您会在凝思安全操作系统的文档中经常看到以下这些术语: + +- shell + + 登录 Linux 系统时,系统会为登录用户启动一个程序。通过这个程序,可以和 Linux 进行交互。这个程序就是通常所说的 Linux + shell,它的作用就是执行通过键盘输入的命令。 + +- 命令(Command) + + 给计算机的命令,多数使用键盘或鼠标输入。 + +- 命令行(Command line) + + 在 shell 提示中键入命令的地方。 + +- shell 提示(shell prompt) + + 用户和操作系统的命令行界面。shell 解释用户输入的命令,并把它们传递给操作系统。 + + shell 运行的时候会在屏幕上显示一个提示符,这表示它在等待用户的命令。当输入了命令并按下 :kbd:`Enter` 键,shell 就开始解释命令并且执行这个命令。如果输入了一个并不存在的命令,shell 也会提示您,并且重新显示提示符,等待输入下一个命令。 + +- 手册页(Man page)和信息页(Info page) + + 手册(Man 是 manual 的简写)页和信息页提供了关于命令或文件的详细信息(手册页比信息页提供的解释要简略)。例如,要阅读 ``su`` 命令的手册页,在 shell 提示下输入 ``man su`` (或输入 ``info su`` 来阅读信息页)。要关闭手册页或信息页,按 :kbd:`q` 。 + +- 根(root) + + 根是在安装中创建的超级用户账号,除非您设置了强制访问控制,否则它对您的系统有完全的访问权。在一般 UNIX/Linux 系统中,您必须登录为根用户来完成某些系统管理任务,如改变管理口令和运行系统配置工具。用户帐号的创建目的是使您不必使用根帐号来完成普通的用户任务,从而减少永久性损坏您的操作系统安装或应用程序的机会。 + +- 终端 + + 终端是一种字符型设备,它有多种类型,通常使用 tty 来简称各种类型的终端设备。tty 一词源于 Teletypes,或者 teletypewriters,原来指的是电传打字机,是通过串行线用打印机键盘通过阅读和发送信息的东西,后来这东西被键盘与显示器取代,所以现在叫终端比较合适。 + +- 控制台 + + 控制台是与操作系统交互的设备,系统将一些信息直接输出到控制台上。 + + 在 Linux 系统中,计算机显示器通常被称为控制台终端(Console)。它仿真了类型为 Linux 的一种终端,并且有一些设备特殊文件与之相关联:tty0、tty1、tty2 等。当您在控制台上登录时,使用的是 tty1。使用 :kbd:`Alt` - :kbd:`F1` ~ :kbd:`F6` 组合键时,我们就可以切换到 tty2、tty3 等上面去。tty1 ~ tty6 等称为虚拟终端,而 tty0 则是当前所使用虚拟终端的一个别名,系统所产生的信息会发送到该终端上(这时也叫控制台终端)。因此不管当前正在使用哪个虚拟终端,系统信息都会发送到控制台终端上。您可以登录到不同的虚拟终端上去,因而可以让系统同时有几个不同的会话存在。 + +- 图形化用户界面(Graphical User Interface,GUI) + + 互动窗口、图标、菜单、以及允许用户使用鼠标和键盘来引发启动程序和打开文件等行动的统称。 + +- 图形化桌面(Graphical Desktop) + + GUI 中的最可见部分。桌面是您的“用户主目录”和“从这里开始”启动器图标的位置。您可以给桌面配置特殊的背景、颜色和图片来为它添加一点儿个人色彩。 + +- 图标(Icon) + + 代表应用程序、文件夹、快捷方式或系统资源(如软盘驱动器)的小图像。启动器(Launcher)图标通常指启动应用程序的快捷方式。 + +- 面板(Panel) + + 桌面工具栏。通常横贯桌面底部。面板上包含“主菜单”按钮和启动常用程序的快捷方式图标。您可以定制面板来满足您的个人需要。 + +- X 或 X 窗口系统(X Window System) + + 这两个术语代表图形化用户界面环境。如果您“在 X 内”或“在运行 X ”,这意味着您的工作环境是 GUI 而非控制台。 + +- 互联网 + + 互联网(internet,普通名词),泛指网络集合,是由各种不同类型和规模的计算机网络组成的计算机网络。组成互联网的计算机网络,可以是局域网(LAN)、城域网(MAN)或者广域网(WAN)等,其基本组成单元是网络,可以将互联网称为“联接网络的网络”。 + +- 因特网 + + 因特网(Internet,专用名词) + ,特指由 TCP/IP 协议构建的互联网(internet)。因特网是互联网的一种。 + +- 万维网 + + 万维网(World Wide + Web,简称“Web”、“WWW”、“W3”)是一个由许多互相链接的超文本文档组成的系统,通过 Internet 访问。在这个系统中,每个有用的事物,称为一样“资源”;并且由一个全域“统一资源标识符”(URI)标识;这些资源通过超文本传输协议(Hypertext + Transfer Protocol)传送给使用者,而后者通过点击链接来获得资源。 + + 万维网常被当成因特网的同义词,这是一种误解,万维网是靠着因特网运行的一项服务。 + +.. raw:: latex + + \section*{如何使用本书}\addcontentsline{toc}{section}{如何使用本书} + \markboth{关于本书}{如何使用本书} + +.. raw:: html + +

如何使用本书

+ +本书旨在指导用户使用凝思安全操作系统 V6.0,系统安装请阅读《凝思安全操作系统 V6.0 安装手册》。 + diff --git a/source/分区与文件系统.rst b/source/分区与文件系统.rst new file mode 100644 index 0000000..bac929a --- /dev/null +++ b/source/分区与文件系统.rst @@ -0,0 +1,607 @@ +分区与文件系统 +============== + +磁盘分区 +-------- + +凝思安全操作系统同时支持命令行和图形界面的磁盘分区方式。 + +命令行分区工具——parted +~~~~~~~~~~~~~~~~~~~~~~ + +parted是一个用于对磁盘分区及其文件系统进行建立、修改、调整、检查、复制等操作的工具,同时支持交互模式和非交互模式。与fdisk比较,它支持给容量大于2TB的磁盘进行分区,功能更加丰富。 + +本节主要介绍分区表的建立,分区的查看、添加、删除等常见操作,将以非交互式命令模式举例说明。更多详细功能和用法请参考parted相关资料。 + +parted基本用法 +^^^^^^^^^^^^^^ + +命令格式: + +:: + + parted [options] [device [command [options...]...]] + parted [选项]... [设备 [命令 [参数]...]...] + +将带有“参数”的命令应用于“设备”。如果没有给出“命令”,则以交互模式运行。 + +创建分区表 +^^^^^^^^^^ + +磁盘分区前,需要在磁盘上建立分区表,如果磁盘上已经创建好了分区表并且不需要改变分区表类型可以跳过该步骤。 + +parted支持的分区表类型有:bsd、dvh、gpt、loop、mac、msdos、pc98、sun。 + + +.. warning:: + + 建立分区表,磁盘上原来的数据将被清空,磁盘上有正在使用的分区时将不能进行该操作,如已挂载分区、已激活的交换空间。 + +命令格式: + +:: + + parted [device] mklabel [label-type] + +示例:给一块磁盘sda创建一个gpt分区表,可以执行以下命令: + +:: + + parted /dev/sda mklabel gpt + +查看磁盘分区情况 +^^^^^^^^^^^^^^^^ + +命令格式: + +:: + + parted [device] print free + +示例:查看磁盘sda分区情况,可以执行以下命令: + +:: + + parted /dev/sda print free + +添加分区 +^^^^^^^^ + +命令格式: + +:: + + parted [device] mkpart [part-type] [start] [end] + +.. hint:: + + start、end既可以是容量也可以是百分比 + + + +示例:在一块容量为20GB刚建立msdos分区表的磁盘sda上建立一个10GB的主分区,可以执行以下命令: + +:: + + parted /dev/sda mkpart primary 0% 10GB + +或者 + +:: + + parted /dev/sda mkpart primary 0% 50% + +删除分区 +^^^^^^^^ + +命令格式: + +:: + + parted [device] rm [partition-number] + +示例:删除磁盘sda的第一个分区sda1,可以执行以下命令: + +:: + + parted /dev/sda rm 1 + +图形分区工具——gparted +~~~~~~~~~~~~~~~~~~~~~ + +gparted是磁盘分区软件parted的GTK+图形界面前端。本节主要介绍gparted的基本使用。 + +启动gparted程序 +^^^^^^^^^^^^^^^ + +- 方法一:命令行启动gparted + + 在桌面上打开一个终端,su到root用户(如果使用root登录的桌面就不需要该操作),执行gparted命令即可启动程序。 + +- 方法二:从桌面菜单启动gparted + + 依次点击桌面上端的“系统-系统管理-GParted”,如 :numref:`Remote01` 所示。 + + +.. _Remote01: +.. figure:: ./pic/gparted01.png + :width: 75% + :alt: 启动GParted + + 启动GParted + +然后会看到一个提示输入管理员口令的对话框(如果是root登录桌面不会有该对话框),需要输入正确的管理员口令确定授权后才能真正开启gparted程序。如 :numref:`Remote02` 所示。 + + +.. _Remote02: +.. figure:: ./pic/gparted02.png + :width: 75% + :alt: 输入管理员口令 + + 输入管理员口令 + +gparted程序首界面 +^^^^^^^^^^^^^^^^^ + +gparted程序首界面如 :numref:`Remote03` 所示。 + + +.. _Remote03: +.. figure:: ./pic/gparted03.png + :width: 70% + :alt: gparted程序首界面 + + gparted程序首界面 + + +.. raw:: latex + + \newpage + +创建分区表 +^^^^^^^^^^ + +在磁盘sda上新建msdos分区表,如 :numref:`Remote04` 所示。 + + +.. _Remote04: +.. figure:: ./pic/gparted04.png + :width: 100% + :alt: 创建分区表 + + 创建分区表 + +.. raw:: latex + + \newpage + +磁盘sda上有活动分区时将不能在上新建分区表,如 :numref:`Remote55` 所示。 + + + +.. _Remote55: +.. figure:: ./pic/gparted05.png + :width: 40% + :alt: 有活动分区时无法新建分区表 + + 有活动分区时无法新建分区表 + +.. raw:: latex + + \newpage + +切换到空闲磁盘sdb并在上面新建分区表,如 :numref:`Remote66` 所示。 + + + +.. _Remote66: +.. figure:: ./pic/gparted06.png + :width: 100% + :alt: 在空闲磁盘上新建分区表 + + 在空闲磁盘上新建分区表 + +.. raw:: latex + + \newpage + +默认新建msdos分区表,如果需要建立其他类型分区表可以在高级选项里配置,如 :numref:`Remote07` 所示。 + + + +.. _Remote07: +.. figure:: ./pic/gparted07.png + :width: 60% + :alt: 选择分区表类型 + + 选择分区表类型 + +.. raw:: latex + + \newpage + + +添加分区 +^^^^^^^^ + +在刚创建完msdos分区表的磁盘sdb上添加一个2000MB的主分区并格式化为ext3文件系统,然后应用全部操作使其生效,如 :numref:`Remote08` 所示。 + + + +.. _Remote08: +.. figure:: ./pic/gparted08.png + :width: 100% + :alt: 新建分区 + + 新建分区 + + +.. figure:: ./pic/gparted09.png + :width: 60% + :alt: 设置分区参数 + + 设置分区参数 + + +.. figure:: ./pic/gparted10.png + :width: 75% + :alt: 应用全部操作 + + 应用全部操作 + +.. figure:: ./pic/gparted11.png + :width: 40% + :alt: 确认应用执行操作 + + 确认应用执行操作 + + +.. figure:: ./pic/gparted12.png + :width: 40% + :alt: 成功完成所有操作 + + 成功完成所有操作 + + +.. figure:: ./pic/gparted13.png + :width: 100% + :alt: 添加分区成功 + + 添加分区成功 + + +.. raw:: latex + + \newpage + +删除分区 +^^^^^^^^ + +删除sdb2分区,如 :numref:`Remote14` 所示。 + + + +.. _Remote14: +.. figure:: ./pic/gparted14.png + :width: 100% + :alt: 删除分区 + + 删除分区 + + +.. raw:: latex + + \newpage + +.. figure:: ./pic/gparted15.png + :width: 40% + :alt: 确认执行操作 + + 确认执行操作 + + +.. figure:: ./pic/gparted16.png + :width: 40% + :alt: 成功完成所有操作 + + 成功完成所有操作 + + +.. figure:: ./pic/gparted17.png + :width: 100% + :alt: 删除分区成功 + + 删除分区成功 + +文件系统 +-------- + +文件系统是操作系统用于明确磁盘或分区上的文件的方法和数据结构,即在磁盘上组织文件的方法。人们熟知,磁盘分区在存储数据之前需要对其进行格式化,其实这就是文件系统建立的过程。 + +凝思安全操作系统支持常见的文件系统,如ext系列、vfat、bfs、xfs等,支持常见文件系统的命令行操作。 + +本节主要介绍如何在分区上创建文件系统和修复文件系统,更多详细的文件系统相关操作,请参考文件系统相关资料。 + +创建文件系统 +~~~~~~~~~~~~ + +.. warning:: + + 在磁盘分区上建立文件系统,磁盘分区上原来的数据将被清空,该操作需要在分区未挂载的情况下进行。 + +命令格式: + +:: + + mkfs.[fs-type] [partition] + +或者 + +:: + + mkfs -t [fs-type] [partition] + +示例:在磁盘分区sda1上建立ext3文件系统,可以执行以下命令 + +:: + + mkfs.ext3 /dev/sda1 + +或者 + +:: + + mkfs -t ext3 /dev/sda1 + +修复文件系统 +~~~~~~~~~~~~ + +文件系统损坏时可以用命令fsck进行修复。 + +.. warning:: + + 文件系统修复操作需要在分区未挂载的情况下进行,否则容易出现不可预料的情况。 + + +命令格式: + +:: + + fsck.[fs-type] [partition] + +或者 + +:: + + fsck -t [fs-type] [partition] + +示例:修复磁盘分区sda1上的ext3文件系统,可以执行以下命令 + +:: + + fsck.ext3 /dev/sda1 + +或者 + +:: + + fsck -t ext3 /dev/sda1 + +磁盘阵列RAID +------------ + +独立磁盘冗余阵列(Redundant Arrays of Inexpensive Disks, +RAID),旧称廉价磁盘冗余阵列,简称硬盘阵列。其基本思想就是把多个相对便宜的硬盘组合起来,成为一个硬盘阵列组,使性能达到甚至超过一个价格昂贵、容量巨大的硬盘。根据选择的版本不同,RAID比单颗硬盘有以下一个或多个方面的好处:增强数据集成度,增强容错功能,增加处理量或容量。另外,磁盘阵列对于计算机来说,看起来就像一个单独的硬盘或逻辑存储单元。分为RAID-0,RAID-1,RAID-1E,RAID-5,RAID-6,RAID-7,RAID-10,RAID-50,RAID-60。 + +简单来说,RAID把多个硬盘组合成为一个逻辑扇区,因此,操作系统只会把它当作一个硬盘。RAID常被用在服务器计算机上,并且常使用完全相同的硬盘作为组合。 + +RAID可分为硬RAID和软RAID。硬RAID需要依赖特定硬件实现,如磁盘阵列柜、磁盘阵列卡。软RAID是通过仿真软件来实现的,如mdadm。 + +本节主要简单介绍在凝思安全操作系统上如何利用mdadm命令来创建和关闭RAID。 + +创建RAID +~~~~~~~~ + +命令格式: + +:: + + mdadm –detail /dev/mdX + mdadm --create --auto=yes /dev/md[0-9] --raid-devices=N \ + --level=[RAID-LEVEL] --spare-devices=N /dev/sdx /dev/hdx... + +选项与参数: + +- –create:创建RAID的选项 + +- –auto=yes:决定创建后面接的软件磁盘阵列装置,即/dev/md0、/dev/md1... + +- –raid-devices=N:使用几个磁盘(或分区)作为磁盘阵列的装置 + +- –spare-devices=N:使用几个磁盘(或分区)作为备用(spare)装置 + +- –level=[RAID-LEVEL]:配置这组磁盘阵列的等级,常用的有0、1、5等 + +- –detail:查看磁盘阵列装置的详细情况 + +示例:利用sdb{1,2,3,4,5}五个分区来做RAID5(实际做RAID时建议使用整个磁盘而不是分区),可以执行以下命令 + +:: + + mdadm --create --auto=yes /dev/md0 --level=5 \ + --raid-devices=4 --spare-devices=1 /dev/sdb{1,2,3,4,5} + +创建成功查看详细情况,可以使用命令 + +:: + + mdadm --detail /dev/md0 + +或者 + +:: + + cat /proc/mdstat + +然后就可以把 ``/dev/md0`` 当作普通的磁盘来使用了。 + +关闭RAID +~~~~~~~~ + +命令格式: + +:: + + mdadm --stop /dev/mdX + +.. hint:: + + 如果RAID已经格式化并挂载使用,需要先将其卸载。 + +示例:关闭上面创建的/dev/md0,可以执行以下命令 + +:: + + mdadm --stop /dev/md0 + +逻辑卷管理LVM +------------- + +LVM全名Logical Volume +Manager,翻译作逻辑卷轴管理员,利用Linux内核的device-mapper来实现存储系统的虚拟化(系统分区独立于底层硬件)。 +通过LVM,可以实现存储空间的抽象化并在上面建立虚拟分区(virtual +partitions),可以更简便地扩大和缩小分区,可以增删分区时无需担心某个硬盘上没有足够的连续空间。 + +LVM基本组成如下: + +- 物理卷Physical volume + (PV):可以在上面建立卷组的媒介,可以是硬盘分区,也可以是硬盘本身或者回环文件(loopback + file)。物理卷包括一个特殊的header,其余部分被切割为一块块物理区域(physical + extents)。 + +- 卷组Volume group (VG):将一组物理卷收集为一个管理单元。 + +- 逻辑卷Logical volume (LV):虚拟分区,由物理区域(physical + extents)组成。 + +- 物理区域Physical extent + (PE):硬盘可供指派给逻辑卷的最小单位(通常为4MB)。 + +本节主要简单介绍在凝思安全操作系统上如何进行逻辑卷的创建、扩容和删除操作。 + +基本命令介绍 +~~~~~~~~~~~~ + +PV相关: + +- pvcreate :将实体partition 创建成为PV ; + +- pvscan:搜寻目前系统里面任何具有PV的磁盘; + +- pvdisplay:显示出目前系统上面的PV状态; + +- pvremove:将PV属性移除,让该partition不具有PV属性; + +.. raw:: latex + + \vspace{.5cm} + +VG相关: + +- vgcreate :创建VG; + +- vgscan :搜寻系统上面是否有VG存在。 + +- vgdisplay :显示目前系统上面的VG状态; + +- vgextend :在VG内添加额外的PV; + +- vgreduce :在VG内移除PV; + +- vgchange :配置VG是否启动(active); + +- vgremove :删除一个VG; + +.. raw:: latex + + \vspace{.5cm} + +LV相关: + +- lvcreate:创建LV; + +- lvscan :查询系统上面的LV; + +- lvdisplay :显示系统上面的LV状态; + +- lvextend :在LV里面添加容量; + +- lvreduce :在LV里面减少容量; + +- lvremove :删除一个 LV; + +- lvresize :对LV进行容量大小的调整; + +逻辑卷创建 +~~~~~~~~~~ + +基本步骤: + +#. 创建物理卷(PV) + +#. 创建卷组(VG) + +#. 创建逻辑卷(LV) + +.. hint:: + + 卷组 (VG)必须在至少一个物理卷(PV)上创建。 + +示例:假设创建一个名为vg00包含/dev/sdb1,2,3,4的PE为4M的VG并在上面建立一个2G的逻辑卷LV,可以执行以下命令: + +:: + + pvcreate /dev/sdb{1,2,3,4} + vgcreate -s 4M vg00 /dev/sdb{1,2,3,4} + lvcreate -L 2G vg00 -n lv00 + +逻辑卷创建完后便可以格式化挂载使用了。 + +逻辑卷扩容 +~~~~~~~~~~ + +示例:假设要给上面已经创建并正挂载使用的逻辑卷lv00扩容1G使其容量变为3G,可以执行以下命令: + +:: + + lvresize -L +1G /dev/vg00/lv00 + +如果vg00(VG)空闲空间不够了,得先扩充vg00,可以执行以下命令: + +:: + + pvcreate /dev/sdb5 + vgextended vg00 /dev/sdb5 + +删除逻辑卷 +~~~~~~~~~~ + +示例:假设要删除上面建立的逻辑卷lv00,可以执行以下命令: + +:: + + lvremove /dev/vg00/lv00 + +如果正在使用需要先卸载,可以执行以下命令: + +:: + + umount /dev/vg00/lv00 + +如果彻底清除上面逻辑卷相关,可以执行以下命令: + +:: + + vgremove vg00 + pvremove sdb{1,2,3,4,5} + diff --git a/source/常见问题解答.rst b/source/常见问题解答.rst new file mode 100644 index 0000000..9f947aa --- /dev/null +++ b/source/常见问题解答.rst @@ -0,0 +1,375 @@ +常见问题解答 +============ + +本章用于解答凝思安全操作系统 V6.0 使用过程中可能出现的一些问题,并建议了相应的解决方法。 + +当您无法解决该问题或者遇到文档中未提及的问题时,请详细记录该问题并联系北京凝思技术支持部。 + + +#. 无法登录 + + 用户输入用户名和口令无法登录到系统。 + + 解决方法: + + #. 确认用户名和口令是否正确。 + + #. 口令可能已过期,帐户已锁定,请联系管理员。 + + +#. 查找信息 + + 系统日志可以客观的反应出系统的运行状态,当出现异常情况时,应检查系统日志信息。凝思安全操作系统会记录大量的详细信息。在您遇到系统问题时,有几个地方可以查看。 + + 以下是最常用到的日志文件及其通常所包含的内容: + + - ``/var/log/syslog`` + + 全局系统日志。 + + - ``/var/log/dmesg`` + + 内核启动日志。 + + - ``/var/log/debug`` + + 内核日志。 + + - ``/var/log/messages`` + + 运行时来自内核和系统日志守护程序的信息。 + + - ``/var/log/auth.log`` + + 包含系统授权信息,包括用户登录和使用的权限机制等。 + + - ``/var/log/wtmp`` + + 包含当前机器会话的用户登录记录的二进制文件。可使用 ``last`` 命令查看它。 + + - ``/var/log/Xorg.*.log`` + + 来自 X Windows 系统的各种启动和运行时日志。在调试失败的 X 启动时,该日志很有用。 + + - ``/var/log/apache2`` + + 包含 Apache 服务器及客户机日志信息的目录。 + + - ``/var/log/samba/`` + + 包含 Samba 服务器及客户机日志信息的目录。 + + - ``/var/log/mail*`` + + 来自邮件系统的信息。 + + - ``/var/log/audit/`` + + 包含审计日志的目录。 + + +#. 网络问题 + + 系统的许多问题可能都与网络相关。您可以使用以下步骤来确定所遇到的网络问题的原因。 + + - 如果使用的是以太网连接,请首先检查硬件。请确保网线已正确地插入计算机。以太网连接器旁边的控制灯(如果有的话)应全部亮起。 + + 如果连接失败,请检查网线在别的机器上是否正常。如果正常,则可能是网卡引起了该问题。如果网络设置中包含集线器和交换机,也需要对它们进行检查。 + + - 如果使用的是无线连接,请检查网络服务器是否可与其它机器建立此无线连接。如果无法建立,请与网络管理人员联系。 + + - 请检查网络服务器是否正在运行并且您的网络设置是否允许您建立连接: + + #. 请检查您的序列号是否过期或无效。可执行命令 ``cat /proc/cmdline`` 查看序列号。 序列号为一串16个十六进制的字符,保存在 :file:`/etc/default/grub` 文件中,例如: + + :: + + GRUB_CMDLINE_LINUX="linx_serial=01234567890abcde security=linx" + + 修改为正确的序列号后,执行 ``update-grub`` 命令将其更新到 ``/boot/grub/grub.cfg`` 文件中,然后重启机器。 + + #. 可使用 ``ping localhost`` (请将 ``localhost`` 替换为服务器的主机名)来检查各台服务器是否正在运行且能够对网络作出响应。 + + - 如果 ``ping``  命令成功,表示您所查找的主机在正常运行,并且网络的名称服务配置正确。 + + - 如果 ``ping`` 命令失败,同时显示讯息目标主机不可访问,则表明您的系统或期望的服务器未正确配置或已宕机。可从其它机器运行 ``ping`` 命令来检查您的系统是否可被访问。如果能够从其他机器成功访问您的机器,则故障原因是服务器未在运行或未正确配置。 + + - 如果 ``ping`` 命令失败,同时显示未知主机,则表示名称服务未正确配置或使用的主机名不正确。请使用 ``ping -c `` ( ````  为尝试连接次数, ````  为主机 IP 地址)尝试连接到这一没有名称服务的主机。如果成功,则请检查主机名的拼写是否正确以及网络中的名称服务是否配置正确。如果 ``ping`` 命令仍然失败,则可能网卡未正确配置或网络硬件存在故障。 + + #. 请使用 ``host localhost`` 来检查您尝试连接的服务器的主机名是否能够正确地转换为 IP 地址,反之亦然。如果此命令返回了该主机的 IP 地址,则名称服务已在正常运行。如果 ``host`` 命令失败,请检查您主机上所有与名称和地址解析相关的网络配置文件。 + + #. 如果系统无法与网络服务器建立连接,并且已排除了名称服务出现问题的可能,则请检查网卡的配置。 + + #. 如果名称服务和网络硬件已正确配置并正在运行,但是某些外部网络连接仍然长时间超时或完全失败,请使用 ``traceroute ``  命令( ```` 为完全合法的域名)来跟踪这些请求所经过的网络路由。此命令将列出某一请求从您的机器传递到其目的地所经过的所有网关。它列出了每个网关的响应时间以及该网关是否可访问。请将 ``traceroute`` 和 ``ping`` 结合使用以确定故障原因并通知网络管理人员。 + + 网络相关的检查工具较多,系统中还有其它常用的网络相关的命令如下: + + - traceroute + + 查看包在网络中的路由情况可或者那个跳点(路由器)出了问题。 + + - netstat + + 查看网络状态信息。 + + - tcpdump + + 高级用户用来分析网络数据包格式。以检查网络通信协议是否出现问题。 + + 详细的使用方法可以查阅系统中相关命令的man手册。 + +#. 运行级别切换 + + 完成系统启动进程后,init 启动所有在默认运行级别配置为启动的服务。 默认运行级别由  ``/etc/inittab`` 中的 ``id`` 给出。凝思安全操作系统 ``V6.0``  默认使用  ``id=2`` 。 + + 凝思安全操作系统 V6.0 使用下列的运行级别: + + - 0——关闭系统 + + - 1——单用户模式(single-user mode) + + - 2~5——多用户模式(multi-user modes) [1]_ + + - 6——重启系统 + + 您可以使用 ``runlevel`` 命令查看当前的运行级别,使用 ``init`` 命令来转换运行级别。 + + 几种运行级别之间的切换方式有三种: + + #. 执行 ``init [0-6]`` 命令 + + 以系统管理员身份登录系统,执行 ``init [0-6]`` ,则系统将立即切换到设定的运行级别。例如当系统处于2级时以系统管理员身份执行 ``init 1`` ,系统将立即进入单用户模式。 + + #. 修改 ``/etc/inittab`` 文件 + + ``/etc/inittab`` 文件中“ ``id:2:initdefault:`` ”字段中间的数字即为运行级别,例如将“ ``id:2:initdefault:`` ”中的 2 改为 1,系统重启后将从多用户模式切换到单用户模式。 + + #. 通过 grub 菜单修改系统运行级别 + + 系统启动进入 grub 界面时,选择任意一项,按 :kbd:`e`  键,在二级菜单中选择 kernel 所在的行,按 :kbd:`e`  键,在此行的最后输入如“ ``_5`` ”,按 :kbd:`Esc`  键,再按 :kbd:`b`  键,系统启动后将进入 5 级多用户模式。 + + .. attention:: + + 如果想通过第三种方式进入运行级别 ``1`` ,则需要在kernel一行的最后输入“_single”而不是“_1”。 + + .. warning:: + + 不要把运行级别 initdefault 设为0或0,否则系统将不能正常启动。 + + + .. [1] 在没有定制过的系统中,运行级别2、3、4、5 是没有区别的。 + +#. 系统启动 + + 在系统启动时,会启动若干服务程序,这些服务程序提供整个操作系统最为核心的基本功能。例如:用户登录界面,后台服务程序,日志服务程序,IPC通信服务等。要确保系统工能正常稳定,这些服务必须正常工作。 + + - 诊断哪些服务在开机时正常启动,哪些服务没有正常启动? + + 执行以下命令列出当前系统所有服务列表。 + + :: + + service –status-all + + 服务名左侧用-、+、?表示服务当前状态。-是未自启动,+自启动,?没有配置。 + + 当某一个功能不可用时,首先检查相应的服务是否启动。如果没有启动,可以执行以下命令手动启动相应服务: + + :: + + service <服务名> start + + - 诊断开机启动过程中的异常问题 + + 当用户发现开机启动异常,需要查看开机过程中更多的信息,以便与技术支持人员联系。可以root用户身份执行以下操作: + + - 修改内核参数: + + 编辑 ``/etc/default/grub`` 文件,删除其中的quiet。 + + - 更新grub配置文件 + + 执行命令: + + :: + + update-grub + + - 重启系统 + + 执行命令: + + :: + + reboot + + - 检查启动过程中的信息 + + .. warning:: + + /etc/default/grub 对系统开机影响较大,请谨慎修改,必要时请联系技术支持人员。 + +#. Core Files + + 当有程序异常退出时,可以通过core文件对崩溃的程序进行调试从而找出问题所在。 + + 使用core文件的前提是需要开启core文件生成开关。步骤如下: + + - 在运行异常代码前执行命令: + + :: + + ulimit -c 10000 + + - 运行一个有异常的程序: + + :: + + ./a.out + + - 设置系统会生成一个core文件在当前目录中,core文件的名称可能是core或是一串数字。 + + - 使用调试工具进行调试: + + :: + + gdb ./a.out core + + - 进入调试界面,输入命令查看程序的调用栈: + + :: + + bt + + - 这时就会发现是哪个函数调用导致程序异常,然后定位这个函数。 + +#. 内核崩溃转储 + + kdump是在系统崩溃、死锁或者死机的时候用来转储内存运行参数的一个工具和服务,打个比方,如果系统一旦崩溃那么正常的内核就没有办法工作了,在这个时候将由kdump产生一个用于capture当前运行信息的内核,该内核会将此时的内存中的所有运行状态和数据信息收集到一个dump core文件中以便于工程师分析崩溃原因,一旦内存信息收集完成,系统将自动重启。 + + 配置步骤: + + - 安装Kdump软件包: + + :: + + #apt-get install kexec-tools kdump-tools + + - 安装内核调试信息软件包: + + :: + + #apt-get install linux-image-2.6.32-5-amd64-dbg + + - 配置kdump服务 + + 编辑 ``/etc/default/kdump-tools`` 文件,修改USE_KDUMP和debug + kernel项。 + + :: + + USE_KDUMP=1 + DEBUG_KERNEL=/usr/lib/debug/boot/vmlinux-2.6.32-5-amd64 + + - 修改GRUB(引导加载程序)配置 + 编辑 ``/etc/default/grub`` 文件,修改对应行内容: + + :: + + GRUB_CMDLINE_LINUX_DEFAULT="crashkernel=64M quiet" + + 更新grub + + :: + + update-grub + + - 重启系统 + + :: + + reboot + + .. warning:: + + 当遇到系统内核崩溃或严重错误时请立即通知北京凝思技术支持部门,由技术人员帮助解决,切勿自行修改系统配置文件从而导致不可逆转的错误。 + + +#. 命令丢失 + + 系统中提供大量的基础命令,供用户完成日常系统使用之用。系统中还可能部署很多其他的应用软件或程序。往往使用者会出现这种现象,当输入某一个命令时,系统提示找不到该命令或命令不存在。这可能会有两种可能,一是命令安装了但没有找到,二是命令没有被安装。 + + 首先,需要确定命令是否被安装。 + + :: + + find / -name <命令>; #在系统中查找命令 + whereis <命令>; #在系统中查找命令,用户手册 + + .. raw:: latex + + \newpage + +#. root密码恢复 + + 当某些设备由于长时间没人接管,而导致root口令丢失时,可以采取某种方法重置root口令。由于这种方法需要对所操作的设备直接控制权(即,需要在设备启动早期阶段介入设备拿到设备控制权,这需要操作人员对设备有直接操作权而非远程操作。) + + 在设备启动阶段会看到如图 :numref:`Remote10.1` 所示界面。 + + .. _Remote10.1: + + .. figure:: ./pic/grub.png + :width: 75% + :alt: GRUB启动界面 + + GRUB启动界面 + + + 在当前界面中输入字符e,进入命令配置界面如图 :numref:`Remote10.2`  所示。 + + .. _Remote10.2: + + .. figure:: ./pic/grub3.png + :width: 75% + :alt: GRUB命令编辑界面 + + GRUB命令编辑界面 + + + 图中红框白字是需要添加的内容,写好后按Ctrl+x键启动系统。 + + 系统会直接启动一个终端程序,为您使用。通过这个终端程序你可以使用passwd命令修改root用户的口令。 + + +#. 诊断和调试工具 + + 部分应用程序在运行时会出现异常情况,这时管理员或开发者可能需要跟踪这些程序的运行轨迹,以便发现其中的问题。 + + 在系统运行的程序可能有两种一种是二进制程序,其执行代码是二进制的是人类不可读的,另一种是脚本程序是它是人类可读的,对于这两种程序的调试方法可能略有不同。 + + 首先,介绍二进制程序。 + + 当有一个二进制程序需要调试时可以用strace命令。 + + :: + + strace ./a.out + + 这时系统会运行 ``./a.out`` 程序,同时将它调用的系统调用打印出来。使用者可以通过strace命令的输出信息了解到 ``./a.out`` 程序的运行轨迹。 + + 在系统中有很多非二进制程序,如bash脚本程序,当遇到这个的程序出现异常时可以通过加命令行选项的方式进行调试。 + + :: + + bash -x ./install.sh + + 当使用上述命令时,系统会运行上述命令并开启调式信息,系统会将 ``./install.sh``  每一行的运行结果打印出来,以便用户观察系统出现的问题。 + +.. raw:: latex + + \appendix + +.. raw:: latex + + \titleformat{\chapter}{\Huge\bfseries}{附录\,\thechapter}{1em}{} + diff --git a/source/开发.rst b/source/开发.rst new file mode 100644 index 0000000..8489b01 --- /dev/null +++ b/source/开发.rst @@ -0,0 +1,512 @@ +开发 +==== + +凝思安全操作系统V6.0支持多个开发环境与开发工具。 + +开发环境 +-------- + +凝思安全操作系统V6.0支持Java、C、C++、Python、Perl、Shell、Ruby、Php、Tcl/tk、 Lisp等开发环境。 + +java开发环境 +~~~~~~~~~~~~ + +#. 查看javac版本 + + :: + + $ javac -version + javac 1.6.0_26 + +#. 编译java程序 + + HelloWorld.java源程序如下: + + :: + + public class HelloWorld{ + public static void main(String[] args) { + System.out.println("Hello World!"); + } + } + + 编译: + + :: + + $ javac HelloWorld.java + +#. 运行java程序 + + :: + + $ java HelloWorld + + 输出结果: + + :: + + Hello World! + +C开发环境 +~~~~~~~~~ + +#. 查看gcc版本 + + :: + + $ gcc -v + Using built-in specs. + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Linx 4.4.5-8linx1' + --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs + --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr + --program-suffix=-4.4 --enable-shared --enable-multiarch + --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib + --without-included-gettext --enable-threads=posix + --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib + --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug + --enable-objc-gc --with-arch-32=i586 --with-tune=generic + --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu + --target=x86_64-linux-gnu + Thread model: posix + gcc version 4.4.5 (Linx 4.4.5-8linx1) + +#. 编译gcc helloworld.c程序 + + helloworld.c源程序如下: + + :: + + #include + int main(int argc, char *argv[]){ + printf(“hello world!”); + return 0; + } + +#. 运行helloworld + + :: + + $ ./helloworld + +.. _c开发环境-1: + +C++开发环境 +~~~~~~~~~~~ + +#. 查看C++版本 + + :: + + $ g++ -v + Using built-in specs. + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Linx 4.4.5-8linx1' + --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs + --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr + --program-suffix=-4.4 --enable-shared --enable-multiarch + --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib + --without-included-gettext --enable-threads=posix + --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib + --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug + --enable-objc-gc --with-arch-32=i586 --with-tune=generic + --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu + --target=x86_64-linux-gnu Thread model: posix + gcc version 4.4.5 (Linx 4.4.5-8linx1) + +#. 编译g++ helloworld.c程序 + + helloworld.c源程序如下: + + :: + + #include + using namespace std; + int main() + { + cout << "Hello World!" << endl; + cout << "Welcome to C++ Programming" << endl; + } + + 编译: + + :: + + $ g++ -g -Wall helloword.c -o helloworld + +#. 运行helloworld + + :: + + $ ./helloworld + Hello World! + Welcome to C++ Programming + +Python开发环境 +~~~~~~~~~~~~~~ + +#. 查看Python版本 + + :: + + $ python -V + Python 2.6.6 + +#. 编译运行helloworld.py程序 + + helloworld.py源程序如下: + + :: + + #!/usr/bin/python + # Hello world python program + print "Hello World!"; + + 编译运行: + + :: + + $ python helloworld.py + Hello World! + + 或者 + + :: + + $ chmod u+x helloworld.py + $ ./helloworld.py + Hello World! + +Perl开发环境 +~~~~~~~~~~~~ + +#. 查看perl版本 + + :: + + $ perl -v + This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi + (with 56 registered patches, see perl -V for more detail) + + Copyright 1987-2009, Larry Wall + + Perl may be copied only under the terms of either the Artistic License or + the GNU General Public License, which may be found in the Perl 5 source + kit. + + Complete documentation for Perl, including FAQ lists, should be found on + this system using "man perl" or "perldoc perl". If you have access to the + Internet, point your browser at http://www.perl.org/, the Perl Home Page. + +#. 编译运行helloworld.pl程序 + + helloworld.pl源程序如下: + + :: + + #!/usr/bin/perl + # Hello world perl program + print "Hello World!"; + + 编译运行: + + :: + + $ perl helloworld.pl + Hello World! + + 或者 + + :: + + $ chmod u+x helloworld.pl + $ ./helloworld.pl + Hello World! + +Shell开发环境 +~~~~~~~~~~~~~ + +#. 查看shell版本 + + :: + + $ sh -version + GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) + Copyright (C) 2009 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later + + This is free software; you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. + +#. 编译运行helloworld.sh程序 + + helloworld.sh源程序如下: + + :: + + #!/bin/bash + echo "Hello, World!" + + 编译运行: + + :: + + chmod +x hello.sh + ./hello.sh + +Ruby开发环境 +~~~~~~~~~~~~ + +#. 查看ruby版本 + + :: + + $ ruby -v + ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] + +#. 编译运行helloworld.rb程序 + + helloworld.rb源程序如下: + + :: + + #!/usr/bin/ruby + # Hello world ruby program + puts "Hello World!"; + + 查看是否安装ruby包,没有则安装ruby包:(以下为查看和安装命令) + + :: + + $ sudo aptitude search ruby + $ sudo apt-get install ruby + + 编译运行: + + :: + + $ ruby helloworld.rb + Hello World! + + 或者 + + :: + + $ chmod u+x helloworld.rb + $ ./helloworld.rb + Hello World! + +Php开发环境 +~~~~~~~~~~~ + +#. 查看php版本 + + 查看是否安装php5包,没有则安装php5包(以下为查看和安装命令): + + :: + + $ sudo aptitude search php5 + $ sudo apt-get install php5 + + $ php -i + phpinfo() + PHP Version => 5.3.3-7+squeeze14 + + System => Linux linx 2.6.32-5-linx-amd64 #1 SMP Tue Oct 29 11:08:27 CST + 2013 x86_64 + Build Date => Aug 6 2012 14:16:54 + + :: + + Server API => Command Line Interface + Virtual Directory Support => disabled + Configuration File (php.ini) Path => /etc/php5/cli + Loaded Configuration File => /etc/php5/cli/php.ini + Scan this dir for additional .ini files => /etc/php5/cli/conf.d + Additional .ini files parsed => /etc/php5/cli/conf.d/pdo.ini + ...... + +Tcl/tk开发环境 +~~~~~~~~~~~~~~ + +#. 查看Tcl/tk版本 + + :: + + $ tclsh + % put $tcl_version + 8.4 + +#. 编译运行tk_hello.tk程序 + + tk_hello.tk源程序如下: + + :: + + #!/usr/bin/wish + #Make a label "Hello World" + label .hello -text "Hello World" + pack .hello + + 编译运行: + + :: + + chmod +x tk_hello.tk + ./tk_hello.tk + +Lisp开发环境 +~~~~~~~~~~~~ + +#. 看lisp版本 + + :: + + $ clisp --version + GNU CLISP 2.48 (2009-07-28) (built 3487500463) (memory 3606457309) + Software: GNU C 4.4.4 + x86_64-linux-gnu-gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith + -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare + -Wno-format-nonliteral -O -falign-functions=4 -DUNICODE -DDYNAMIC_FFI + -DDYNAMIC_MODULES -I. /usr/lib/libreadline.so -lncurses -ldl + + :: + + /usr/lib/libavcall.so /usr/lib/libcallback.so -L/usr/lib -lsigsegv + SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED + TRIVIALMAP_MEMORY + libsigsegv 2.5 + libreadline 5.2 + Features: + (ASDF2 ASDF CLC-OS-DEBIAN COMMON-LISP-CONTROLLER BERKELEY-DB + CLX-ANSI-COMMON-LISP CLX READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS + MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS + LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE BASE-CHAR=CHARACTER + WORD-SIZE=64 PC386 UNIX) + C Modules: (clisp i18n syscalls regexp readline linux clx bdb) + Installation directory: /usr/lib/clisp-2.48/ + User language: ENGLISH + Machine: X86_64 (X86_64) Sxx.sxx [172.16.0.13] + +#. 编译运行helloworld.lisp程序 + + 需安装clisp + + :: + + $ sudo apt-get install clisp + + helloworld.lisp源程序如下: + + :: + + ;hello world lisp program. + (print "Hello World") + + 编译运行: + + :: + + $ clisp helloworld + "Hello World" + +.. raw:: latex + + \newpage + +开发工具 +-------- + +凝思安全操作系统V6.0支持eclipse、kdevelop、emacs、qtcreater等开发工具。 + +eclipse +~~~~~~~ + +下载 ``eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz`` ,下载地址为 https://www.eclipse.org/downloads。 + +解压获得eclipse目录: + +:: + + tar -xf eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz + +进入此目录,运行eclipse + +:: + + $ ./eclipse + +eclipse软件界面如 :numref:`Remote11.1` 所示。 + +.. _Remote11.1: +.. figure:: ./pic/eclipse.png + :width: 100% + :alt: eclipse软件界面 + + eclipse软件界面 + +.. raw:: latex + + \newpage + +kdevelop +~~~~~~~~ + +kdevelop已默认安装,运行 ``/usr/bin/kdevelop`` 即可。 + +:: + + $ /usr/bin/kdevelop + +kdevelop软件界面如图 :numref:`Remote11.2` 所示。 + +.. _Remote11.2: + +.. figure:: ./pic/kdevelop.png + :width: 100% + :alt: kdevelop软件界面 + + kdevelop软件界面 +.. raw:: latex + + \newpage + +emacs +~~~~~ + +emacs已默认安装,在终端直接运行emacs即可。 + +:: + + $ emacs + +或者用鼠标点击应用“程序——附件——GNU Emacs 23” + +emacs软件界面如图 :numref:`Remote11.3` 所示。 + +.. _Remote11.3: +.. figure:: ./pic/emacs.png + :width: 100% + :alt: emacs软件界面 + + emacs软件界面 + +qtcreater +~~~~~~~~~ + +安装编译完成的 ``qt5.2.1-linx_5.2.1-1_amd64.deb`` ,安装qt及qtcreater后,在此qt安装目录下运行 ``./bin/qtcreater`` 。 + +:: + + $ ./bin/qtcreater + +qtcreater软件界面如图 :numref:`Remote11.4` 所示。 + +.. _Remote11.4: +.. figure:: ./pic/qtcreater.png + :width: 100% + :alt: qtcreater软件界面 + + qtcreater软件界面 + diff --git a/source/文件和目录.rst b/source/文件和目录.rst new file mode 100644 index 0000000..976a3de --- /dev/null +++ b/source/文件和目录.rst @@ -0,0 +1,264 @@ + +文件和目录 +========== + +.. raw:: latex + + \fancyhead[LE,RO]{\slshape \rightmark} + +本章从目录的角度出发,总览整个系统,有关各个文件的详情,请参考手册页。 + +完整的目录树分为若干部分,如果将各部分挂载到不同的分区,将更易于进行备份和系统管理。目录树中,主要的几个部分是 ``/、/usr、/var`` 和 ``/home`` ,各部分用途不同。具体描述如下: + +``/`` 目录是每台机器特有的(它一般保存在本地磁盘上,但也可保存在 RAM 磁盘或网络驱动器上),其中包含启动系统和引导装入文件系统所需的文件。因此,对单用户模式来说,只使用一个分区挂载 ``/`` 目录就足够了。另外,该目录内还包含一些工具,用于修复损坏的系统和从备份中恢复丢失的文件。 + +``/usr`` 目录内包含所有的命令库,手册页和其他没有变动过的文件(这些文件是普通操作期间所需要的)。 ``/usr`` 目录内没有专门针对哪台机器的文件,也没有普通用户操作期间应该修改的文件。这样一来,便可以通过网络实现文件共享,从而有效地节约成本,因为这样可节省磁盘空间(要知道  ``/usr`` 文件系统起码也有几百个 MB),使管理工作更容易(在更新应用程序时,只有 ``master/usr`` 需要改动,而不是逐一在每台机器上改动)。即使文件系统是在本地磁盘上,也可以采用只读方式装入它,减小系统崩溃时文件系统受损的可能性。 + +``/var`` 目录中包含有变动的文件,比如假脱机目录(用于邮件、新闻、打印机等)、日志文件、格式化的手册页和临时文件。 + +``/home`` 目录中包含用户的家目录,一般是系统保存用户数据的地方。把家目录和其它目录区分开是为了方便备份;其它部分通常是不需要备份的,或者说至少不需要经常备份(因为它们几乎没有变动)。一个大型的  ``/home`` 目录可能必须分为若干个小型的目录,这就需要在  ``/home`` 下面加一个额外的命名级别,比如 ``/home/students`` 和 ``/home/staff``。 + +上述各个目录可以分别挂载到不同的分区。如果是一个小型的单用户系统,而且用户想一切简单明了的话,可以只挂载一个 ``/`` 目录。 + +不同用途的目录所需空间大小不同,可根据需要挂载到不同的分区。如果要使两个目录在同一个分区,例如 ``/var`` 和 ``/usr``,可以将 ``/var`` 挂载到 ``/usr/var`` 目录 ,然后在 / 中建立一个链接到 ``/usr/var`` 的符号链接 ``/var``。 + +``/`` +----- + +一般说来, ``/`` 应该较小,因为其中包含非常关键的文件和一个小型的,非频繁变动的文件系统。受损的 ``/`` 目录一般意味着系统不能启动,除非借助于特殊的启动设备(比如说软盘),所以一般不要轻易更改它。 + +``/`` 目录一般不包含任何文件,系统的标准启动镜像除外,这个镜像通常称为 ``/vmlinuz``。其他的所有文件都保存在 ``/`` 目录的子目录下: + +#. ``/bin`` + + 启动期间,可供普通用户使用的命令(也可能在启动之后)。 + +#. ``/sbin`` + + 和 ``/bin``  一样,但不是供普通用户使用的,虽然在必要或经过允许的情况下,普通用户也可使用它们。 + +#. ``/etc`` + + 某台机器专用的配置文件。 + +#. ``/root`` + + 用户 ``root`` 的家目录。 + +#. ``/lib、/lib32`` + + ``/`` 目录上的程序所需的共享库。 + +#. ``/lib/modules`` + + 可装载的内核模块,特别是从灾难中恢复时,启动系统所需的那些模块(比如,网络和文件系统驱动程序)。 + +#. ``/dev`` + + 设备文件。 + +#. ``/tmp`` + + 临时文件。 + +#. ``/boot`` + + 启动装载程序所用文件,比如 LILO。内核镜像通常保存在这里,而不是  ``/`` 目录中。如果有多个内核镜像,这个目录就可能增长得很快,所以最好把它单独保存在一个文件系统内。这样做的另一个原因是确保内核镜像在 IDE 磁盘的前1024个磁道内。 + +#. ``/mnt`` + + 系统管理员临时装入的装入点。程序不会自行装入 ``/mnt`` 。 ``/mnt`` 也可以分为若干个子目录(比如 ``/mnt/dosa`` 可能是使用 MS-DOS 文件系统的软驱,而 ``/mnt/extra`` 则可能和 ext2 文件系统如出一辙)。 + +#. ``/proc、/usr、/var`` 和 ``/home`` + + 其它目录的装入点。 + +``/etc`` +-------- + +``/etc`` 目录中包含许多文件。下面将讨论其中的一部分。另外的文件,则应该由你决定它们属于哪个程序,并参考该程序的手册页。许多网络配置文件也被包含在 ``/etc`` 内。 + +#. ``/etc/rc`` 或 ``/etc/rc.d`` 或 ``/etc/rc?.d`` + + 启动时或运行级别发生变化时运行的脚本或脚本的目录。 + +#. ``/etc/passwd`` + + 用户数据库,其中有一些字段指定用户名,用户真名,根目录,加密密码以及该用户的其他信息。 + +#. ``/etc/fstab`` + + 列出启动时由 ``mount -a`` 命令(在 ``/etc/rc`` 或等同的启动文件内)自动装入的文件系统。Linux 系统中,这个文件还包含一些信息,这些信息和 ``swapon -a`` 自动采用的交换区有关。 + +#. ``/etc/group`` + + 类似于 ``/etc/passwd`` ,但它描述的不是用户,而是组。更多详情,请参考 group 手册页。 + +#. ``/etc/inittab`` + + init 配置文件。 + +#. ``/etc/issue`` + + 登录提示出现之前的 getty 输出。通常包含对系统的简短说明或欢迎消息。其内容由系统管理员决定。 + +#. ``/etc/motd`` + + 日期消息,是在成功登录之后自动输出的。其内容由系统管理员决定。通常用来提示每个用户,比如既定的系统关闭警告等。 + +#. ``/etc/mtab`` + + 列出当前已装入的文件系统。最初是由启动脚本设置,由 mount 命令自动更新的。用于需要已装入文件系统列表时(比如说在运行 df 命令时)。 + +#. ``/etc/shadow`` + + 在已安装影子密码软件的系统上的影子密码文件。影子密码把已加密的密码从 ``/etc/passwd`` 移入 ``/etc/shadow`` ;后者只有 ``root`` 才能读取。这样可进一步保证密码的安全性。 + +#. ``/etc/login.defs`` + + login 命令的配置文件。 + +#. ``/etc/profile、/etc/csh.login`` 和 ``/etc/csh.cshrc`` + + 登录或启动时,由 Bourne 或 C 外壳执行的文件。这些文件允许系统管理员为所有的用户设置全局默认设置。各外壳的详情,请参考手册页。 + +#. ``/etc/securetty`` + + 标识安全终端,也就是允许 ``root`` 通过哪些终端登录。一般说来,只列出了虚拟控制台,如此一来,恶意用户不可能通过 modem 或网络攻击系统,从而获得超级用户特权(至少说很难)。 + +#. ``/etc/shells`` + + 列出受托(信得过的)外壳。chsh 命令允许用户把他们自己的登录外壳改成这个文件内列出的受托外壳。为计算机提供 FTP 服务的。ftpd 服务器进程,将复查用户的外壳是否在 ``/etc/shells`` 内,如果在,将允许用户登录,如果不在,就不会让用户登录。 + +``/dev`` +-------- + +``/dev`` 目录下包含所有设备的特定设备文件。设备文件的命名有特殊的约定;对这些约定的描述包括在 Device 列表中。 + +``/usr`` +-------- + +``/usr`` 通常较大,因为所有的程序都是保存在这个文件系统中的。 ``/usr`` 内的文件通常是系统文件;本地安装的程序和其他东西都保存在  ``/usr/local`` 下面。这样一来,就能够通过安装该目录的新版本来升级系统,而不需要再次安装所有的程序。下面列出了部分  ``/usr`` 子目录。 + +#. ``/usr/bin`` + + 几乎包含所有的用户命令。有些命令在 ``/bin`` 或 ``/usr/local/bin`` 内。 + +#. ``/usr/sbin`` + + ``root`` 文件系统上不需要的系统管理命令,例如,大多数服务器程序。 + +#. ``/usr/share/man``, ``/usr/share/info`` 和  ``/usr/share/doc`` + + 分别包含手册页,GNU 信息文档和名目繁多的其他文档文件。 + +#. ``/usr/include`` + + C 编程语言的头文件。实际上,为了保持数据的一致,这个文件应该保存在  ``/usr/lib`` 下面,但过去一直都采用这个名称。 + +#. ``/usr/lib、/usr/lib32`` + + 程序和子系统所用的未变动过的数据文件,其中包括一些和站点有关的配置文件。lib 这个名称源于库(library);最初用来编写子例程的库都保存在 ``/usr/lib`` 和 ``/usr/lib32`` 内。 + +``/var`` +-------- + +``/var`` 内包含系统正常运行时所改动的数据。它是各个系统专有的,也就是说,不能通过网络和其他计算机共享。 + +#. ``/var/lib`` + + 系统正常运行期间发生变化的文件。 + +#. ``/var/lock`` + + 锁文件。许多程序都习惯在 ``/var/lock`` 内建立一个锁文件,借以表明它们正在使用某个特定的设备或文件。其他程序将注意到这个锁文件,并不再尝试使用这个特定的设备或文件。 + +#. ``/var/log`` + + 日志文件,它源于各个程序,特别是 login( ``/var/log/wtmp``, 记录所有的系统登录和注销活动)和 syslog( ``/var/log/messages``,通常保存所有的内核和系统程序消息)。 ``/var/log`` 内的文件通常增长较快,需要定期清空。 + +#. ``/var/run`` + + 系统信息文件,其中包含系统相关信息,在系统下一次启动之前,都是有效的。例如, ``/var/run/utmp`` 内包含和当前登录用户有关的信息。 + +#. ``/var/spool`` + + 用于邮件,新闻,打印机队列和其他队列作业的目录。对每个不同的假脱机来说,在  ``/var/spool`` 下面都有其自己的子目录,比如用户信箱就在 ``/var/spool/mail`` 内。 + +#. ``/var/tmp`` + + 临时文件,通常存放较大或需要保存的时间比 ``/tmp`` 长的文件。 + +``/proc`` +--------- + +``/proc`` 内包含一个伪文件系统,用于提供和系统相关的信息(最初是进程相关信息,并由此得名)。下面将对有些比较重要的文件和目录进行解释。``/proc`` 文件系统的更多详情,请参考 proc 手册页。 + +#. ``/proc/1`` + + 目录,其中有1号进程的相关信息。每个进程在 ``/proc`` 下面都有一个子目录,这个子目录名就是该进程的编号。 + +#. ``/proc/cpuinfo`` + + 其中保存关于中央处理器的信息,比如型号,制造商,模型和性能等。 + +#. ``/proc/devices`` + + 其中列出了已经配置到当前正在运行的内核之中的设备驱动程序。 + +#. ``/proc/dma`` + + 展示当前正在使用的 DMA 通道。 + +#. ``/proc/filesystems`` + + 已配置到内核中的文件系统。 + +#. ``/proc/interrupts`` + + 展示哪些中断号正在使用中,以及各中断号使用了多少次。 + +#. ``/proc/ioports`` + + 展示此时哪些 I/O 端口正在使用中。 + +#. ``/proc/kcore`` + + 系统物理内存的镜像。其大小完全和你的物理内存一样,但事实上占不了多少内存;它是在程序访问它时,即时生成的(记住,除非你把它复制到别的地方,否则, ``/proc`` 根本就不占用任何磁盘空间)。 + +#. ``/proc/loadavg`` + + 系统的“装载平衡”;无意义的三个识别符,表示此时系统应该做多少操作。 + +#. ``/proc/meminfo`` + + 包含和内存使用相关的信息,其中既包括物理内存,又有交换空间。 + +#. ``/proc/modules`` + + 表明此时正在装载哪些内核模块。 + +#. ``/proc/net`` + + 目录,其中包含和网络协议相关的状态信息。 + +#. ``/proc/self`` + + 指向一个程序进程目录的符号链接,这个程序此刻正在查看 ``/proc`` 。如果有两个程序都在查看 ``/proc`` ,它们就会得到两个不同的符号链接。这主要是为了方便程序更容易得到自己的进程目录。 + +#. ``/proc/stat`` + + 关于系统的各种统计数据,比如自系统启动以来出现的页故障次数统计。 + +#. ``/proc/uptime`` + + 表明系统已启用多久。 + +#. ``/proc/version`` + + 内核版本号。 + + 注意,上面的文件越来越发展成为易于理解的文本化文件,但有时,它们采用的格式却是难以理解的。所以,目前有许多命令将上面的文件转换为更便于理解的格式。比如,有个自由软件读取 ``/proc/meminfo`` ,并将指定的字节转换为千字节(同时,还增加了少许信息)。 + + + diff --git a/source/用户管理.rst b/source/用户管理.rst new file mode 100644 index 0000000..5ed28c2 --- /dev/null +++ b/source/用户管理.rst @@ -0,0 +1,316 @@ +用户管理 +======== + +添加用户 +-------- + +以 root 或授权管理员登录,执行 ``useradd testuser1`` ,将添加用户 testuser1,如果需要同时建立用户目录,则执行 ``useradd -m testuser1`` 。 + +.. important:: + 添加用户时会随机生成用户口令,请记录该口令或修改口令。 + +.. hint:: + 执行 ``less /etc/passwd`` 可以看到新增加用户 testuser1 的信息。 + +删除用户 +-------- + +以 root 或授权管理员登录,执行 ``rmuser testuser1`` ,testuser1 的用户信息将会被从各个相关的用户数据文件(如 ``/etc/passwd、/etc/group、/etc/shadow`` 等)中删除,如果需要删除用户目录及其它相关文件,则执行 ``rmuser -r testuser1`` 。 + +添加用户组 +---------- + +以 root 或授权管理员登录,执行 ``groupadd test`` ,将添加用户组 test。 + +.. hint:: + 执行 ``useradd -g test testuser1`` 可创建用户 testuser1 并添加到 test 用户组,但 test 组必须已存在。 + +删除用户组 +---------- + +以 root 或授权管理员登录,执行 ``groupdel test`` ,将删除用户组 test。 + +.. Warning:: + 只有某用户组是空组(没有用户属于该组),或该用户组不是任何用户的 primary group 的情况下,才可以删除该用户组,其它情况下均不能删除该用户组。 + + +将用户添加到用户组 +------------------ + +以 root 或授权管理员登录,执行 ``gpasswd -a testuser1 test`` ,将用户 testuser1 添加到用户组 test。 + +将用户从用户组中删除 +-------------------- + +以 root 或授权管理员登录,执行 ``gpasswd -d testuser1 test`` ,将用户 testuser1 从用户组 test 中删除。 + +.. Attention:: + 用户必须属于至少一个用户组,因此,当用户只属于一个用户组时,将不能使用上述命令将用户从该用户组中删除。 + +改变用户当前所在组 +------------------ + +如果用户同时属于几个用户组,可使用 ``newgrp`` 命令来改变当前所在组,之后将使用新的组 ID 来进行文件存取权限的管理。 + +如:用户 testuser 同时属于 users 和 test 用户组,当前组别为 users,执行 ``touch test1.txt`` 新建文件 ``test1.txt`` ,再执行 ``newgrp test`` 改变登录的用户组到 test,执行 ``touch test2.txt`` 新建文件 ``test2.txt`` 。查看文件 ``test1.txt`` 和 ``test2.txt`` 的信息,属主都是 testuser ,但分别属于 users 和 test 用户组。 + +修改用户口令 +------------ + +使用 ``passwd`` 命令可修改当前用户自己的口令。 + +如:用户 testuser1 使用 ``passwd`` 命令,若旧口令输入错误,则不能修改口令。按要求输入正确的旧口令后,输入新口令并再次确认,口令修改成功。 + +:: + + $ passwd + 为 testuser1 更改 STRESS 密码 + (当前)UNIX 密码: # 输入错误的旧口令 + passwd: 鉴定令牌操作错误 + passwd: password unchanged + + $ passwd + 为 testuser1 更改 STRESS 密码 + (当前)UNIX 密码: # 输入正确的旧口令 + 输入新的 UNIX 密码: + 重新输入新的 UNIX 密码 + passwd: 已成功更新密码 + +若输入的新口令不符合要求(如,与旧口令相同),则会要求重新输入新口令。 + +:: + + 密码未更改 + 输入新的 UNIX 密码: + +重新输入的次数有限制(由授权管理员设置),当尝试次数达到限制次数后,系统返回提示并退出口令修改: + +:: + + passwd: 鉴定令牌操作错误 + passwd: password unchanged + + +输入新口令需要注意以下几点: + +- 口令必须为 6~127 位的英文、数字和特殊字符的组合,若输入的新口令不足5位,系统将提示要求重新输入: + + :: + + 输入新的 UNIX 密码: # 输入不足5位的口令 + 必须选择更长的密码 + 输入新的 UNIX 密码: + +- 输入新口令时,若输入的口令保密性不好,比如与之前的口令相似、是某个英文单词或过于简单,系统也会提示,并要求重新输入: + + :: + + 输入新的 UNIX 密码: # 输入与之前的口令相似,如,原口令为 + # 12345678,输入新口令为 1234567 + Bad: new and old password are too similar + 输入新的 UNIX 密码: # 输入某个英文单词或过于简单 + # 如:rocky1 + Bad: new password is too simple + 输入新的 UNIX 密码: + + .. important:: + 口令位数越少时,就要求越复杂的字符组合。 + +- 若确认新口令(即第二次输入新口令)时错误,系统将提示,并要求重新输入新口令: + + :: + + Sorry, passwords do not match + passwd: 无法恢复鉴定信息 + passwd: password unchanged + +.. important:: + 用户口令的修改也可能被限制。授权管理员可以设定两次修改用户口令之间间隔的最长和最短时间、口令作废的日期、在用户口令作废前多少天警告用户、在账号自动锁定之前容许用户多少天不活动等等。 + +以 root 或授权管理员登录,执行 \ ``passwd`` 命令,可修改任意用户的口令。 + +.. caution:: + 以 root 的身份修改用户口令为强制性修改,不需要验证旧口令,请谨慎使用。 + +修改用户口令时限 +---------------- + +以 root 或授权管理员登录,使用 ``passwd`` 或 ``chage`` 命令可以设定两次修改口令之间间隔的最长和最短时间,口令作废的日期,在用户口令作废前多少天警告用户,在账户自动锁定之前容许用户多少天不活动等。 + +``passwd [Options] username`` + +Options: + +- ``-a, --all`` + + 显示所有帐户的信息。仅能与“``-S``”选项一起使用。 + +- ``-d, --delete`` + + 删除用户帐户的口令。 + +- ``-e, --expire`` + + 用户帐号到期的日期。过了这天,此用户帐号将不可用。 + +- ``-k, --keep-tokens`` + + 只更改到期的口令。 + +- ``-i, --inactive INACTIVE`` + + 停滞时期。如果一个口令已过期这些天,那么此用户帐号将不可用。 + +- ``-l, --lock`` + + 锁定指定的帐号。锁定后,此用户帐号将不可用。 + +- ``-n, --mindays MIN_DAYS`` + + 可更改口令的最小天数,为 0 时代表任何时候都可以更改口令。 + +- ``-S, --status`` + + 显示用户帐号的口令状态信息。 + +- ``-u, --unlock`` + + 为指定的帐号解锁。解锁后,此用户帐号将变为可用。 + +- ``-w, --warndays WARN_DAYS`` + + 用户口令到期前,提前收到警告信息的天数。 + +- ``-x, --maxdays MAX_DAYS`` + + 口令保持有效的最大天数。 + +.. raw:: latex + + \vspace{1cm} + +``chage [Options] username`` + +Options: + +- ``-d, --lastday LAST_DAY`` + + 设置上一次更改口令的日期。 + +- ``-E, --expiredate EXPIRE_DATE`` + + 用户帐号到期的日期。过了这天,此用户帐号将不可用。 + +- ``-I, --inactive INACTIVE`` + + 停滞时期。如果一个口令已过期这些天,那么此用户帐号将不可用。 + +- ``-l, --list`` + + 列出当前的设置。由非特权用户来确定他们的密码或用户帐号何时过期。 + +- ``-m, --mindays MIN_DAYS`` + + 可更改口令的最小天数,为 0 时代表任何时候都可以更改口令。 + +- ``-M, --maxdays MAX_DAYS`` + + 口令保持有效的最大天数。 + +- ``-W, --warndays WARN_DAYS`` + + 用户口令到期前,提前收到警告信息的天数。 + +例如,将用户 testuser1 两次修改口令之间的最小天数设为 2、最大天数设为 90、作废日期为 2009 年 1 月 1 日,并且在接近作废日期的 14 天里警告用户: + +:: + + $ chage -m 2 -M 90 -E 2009-01-01 -W 14 testuser1 + +修改用户信息 +------------ + +以 root 或授权管理员登录,使用 ``usermod`` 命令可修改用户信息。 + +:: + + usermod [-c comment] [-d home_dir [-m]] [-e expire_date] [-f inactive_days] [-g initial_group] [-G groups ...] [-l name] [-s shell] [-u uid [-o]] name + +在命令行中使用一个 ``name`` 参数指定要改变信息的用户(指定的用户必须存在,且不能是当前在线的用户),并且利用它所提供的各个选项来指定改变字段以及值。 + +- ``-c comment`` + + 更改用户的注释。 + +- ``-d home_dir`` + + 更改用户主目录名称。 + +- ``-e expire_date`` + + 更改用户的到期日,到期日使用 ``mm/dd/yy`` 格式来设定。 + +- ``-f inactive_days`` + + 更改用户到期几天后停止使用该用户,设定为0表示到期后立即停用,预设为-1表示要关闭这个功能。 + +- ``-g initial_group`` + + 更改用户的所属组, ``initial_group`` 参数可以使用组的名称或编号来指定组,不过指定的组必须是已存在的。 + +- ``-G group,[...]`` + + 更改该用户属于哪些组的成员,可以指定多个组,组间以逗号分隔。可以使用组的名称或编号来指定组,不过指定的组必须是已存在的。 + +- ``-l name`` + + 更改用户的名称,该用户的主目录名称需要手动修改。 + +- ``-s shell`` + + 更改用户登录系统后执行的 shell,如果指定空白,将会执行系统预设的 shell。 + +- ``-u uid`` + + 更改用户的 UID。指定的 UID 不能与其它用户的 UID 重复,如果 UID 不唯一,则必须加上  ``-o`` 选项。UID 不可为负值。 + +修改口令文件 +------------ + +为了保证系统的安全性,系统通常对用户的口令进行 shadow 处理,并把用户口令保存到只有 root 可读的  ``/etc/shadow`` 文件中。该文件包含了系统中所有用户和用户口令等相关信息。每个用户在该文件中对应一行,并且用冒号分成九个域,每一个域包括以下内容: + +#. 用户登录名 + +#. 用户加密后的口令(若为空,表示该用户不需口令即可登录,若为*号,表示该帐号被禁止) + +#. 从1970年1月1日至口令最近一次被修改的天数 + +#. 口令在多少天内不能被用户修改 + +#. 口令在多少天后必须被修改 + +#. 口令过期多少天后用户帐号被禁止 + +#. 口令在到期多少天内给用户发出警告 + +#. 口令自1970年1月1日被禁止的天数 + +#. 保留域 + +以 root 登录,可对口令文件 ``/etc/shadow`` 进行修改。 + +定义鉴别阈值 +------------ + +用户登录系统时,若输入的新口令不符合要求,则会被要求重新输入新口令。重新输入的次数也有限制,当尝试次数达到限制次数后,系统返回提示并退出口令修改,并在一定的时间内不能再次尝试登录系统。 + +管理员可以修改 ``/etc/login.defs`` 文件来自定义这些阈值。 + +如: + +:: + + LOGIN_RETRIES 3 # 输入口令的尝试次数限制为3次 + LOGIN_TIMEOUT 60 # 登录超时限制为60秒 + PASS_MIN_LEN 5 # 口令必须为5位以上 + diff --git a/source/登录和注销.rst b/source/登录和注销.rst new file mode 100644 index 0000000..9f2e85f --- /dev/null +++ b/source/登录和注销.rst @@ -0,0 +1,373 @@ +登录和注销 +========== + + +登录 +---- + +启动计算机后进入 GRUB 界面,如 :numref:`figgrub` 所示。 + +.. _figgrub: + +.. figure:: ./pic/grub.png + :width: 80% + :alt: GRUB 界面 + + GRUB 界面 + +凝思安全操作系统 V6.0 有几种模式选择: + +:: + + Linx GNU/Linux, with Linux 2.6.32-696-linx-amd64 + +维护模式,启动后任何用户均可登录,主要用来进行系统配置、维护事务。 + +:: + + Linx GNU/Linux, with Linux 2.6.32-696-linx-amd64 (recovery mode) + +恢复模式,提供一个 root shell 和只读的文件系统,用于进行系统恢复。 + +:: + + Linx GNU/Linux, with Linux 2.6.32-696-linx-amd64 (linx no root mode) + +运行模式,启动后无root用户,由管理员用户和普通用户进行日常事务管理和操作。 + + +使用 :kbd:`↑` 和 :kbd:`↓`  键选择 **Linx GNU/Linux, with Linux 2.6.32-696-linx-amd64 (linx no root mode)** ,按 :kbd:`Enter`  键继续。 + +所有用户登录都必须进行鉴定。凝思安全操作系统V6.0采用口令和指纹双因子鉴别方式,当您启动系统后,系统会提示您输入用户名,然后提示输入该用户相应的指纹信息,指纹鉴定成功后再输入口令,才可完成登录。如果用户及其指纹信息尚未创建,请与管理员联系以获取用户名和口令。 + +如果您安装了桌面环境,系统将自动进入桌面登录画面,详见 :numref:`s17` 。如果没有安装桌面环境,系统将使用控制台的登录方式,详见 :numref:`s18`  。您也可以切换到其它控制台登录。 + +.. _s17: + +从桌面登录 +~~~~~~~~~~ + +登录屏幕中包含用户名输入字段,首先需要输入用户名,如 :numref:`figurelogin1` 所示。 + + + +.. _figurelogin1: + +.. figure:: ./pic/login-1.png + :width: 80% + :alt: 登录-输入用户名称 + + 登录-输入用户名称 + +.. raw:: latex + + \newpage + +由于系统采用口令和指纹双因子鉴别方式,输入用户名敲回车键后,输入该用户的指纹信息,此时需要在指纹仪上按下正确的指纹,如 :numref:`figureprinter`  所示。 + + +.. _figureprinter: + +.. figure:: ./pic/fingerprinter.png + :width: 80% + :alt: 登录-输入指纹信息 + + 登录-输入指纹信息 + +.. raw:: latex + + \newpage + +在指纹仪上输入正确的指纹信息后,在登录屏幕界面输入用户口令,若正确输入口令并回车,则可登录到系统中,如 :numref:`figurelogin2`  所示。 + + +.. _figurelogin2: + +.. figure:: ./pic/login-2.png + :width: 80% + :alt: 登录-输入用户口令 + + 登录-输入用户口令 + +.. raw:: latex + + \newpage + +系统默认使用 **Gnome** 桌面环境,如 :numref:`figuregnome`  所示。 + + +.. _figuregnome: + +.. figure:: ./pic/gnome.png + :width: 75% + :alt: Gnome桌面环境 + + Gnome桌面环境 + +.. raw:: latex + + \newpage + + +桌面的使用 +^^^^^^^^^^ + +**Gnome** 桌面的面板位于屏幕上方,包括应用程序菜单、快速启动栏、任务管理器、系统托盘等。单击“应用程序”,选择要启动的程序即可打开使用,如 :numref:`figuregnome3`  所示。您还可以直接点击快速启动栏上的程序,以及将应用程序添加到快速启动栏。 + + + +.. _figuregnome3: + +.. figure:: ./pic/gnome3.png + :width: 75% + :alt: 开始使用系统 + + 开始使用系统 + + +桌面切换位于屏幕下方,您可以将不同的会话分别放置在各个桌面上,直接点击屏幕右下角的图标即可进行桌面切换。默认设置为4个桌面,您还可以自己更改数量。 + +.. raw:: latex + + \newpage + +控制会话 +^^^^^^^^ + +用户名和口令通过登录进程的鉴定后,将启动会话管理器。通过会话管理器,可以保存每个会话的设置。还可以保存最近一次的会话状态,这样,在下次登录时就能返回该状态。 + +会话管理器可以保存并恢复以下设置: + +- 外观和行为设置,如字体、颜色和鼠标设置 + +- 运行的一些应用程序,如文件管理器 + + +.. raw:: latex + + \newpage + +锁定屏幕 +^^^^^^^^ + +要锁定屏幕,请执行以下一项操作: + +- 从启动栏中选择“系统”——“锁住屏幕”,如 :numref:`figuregnome1`  所示。 + + +.. _figuregnome1: + +.. figure:: ./pic/gnome1.png + :width: 75% + :alt: 锁定屏幕 + + 锁定屏幕 + +- 使用键盘快捷方式。通常为 :kbd:`Ctrl-Alt-D` 。 + +.. raw:: latex + + \newpage + +锁定屏幕时会启动屏幕包含程序。要解除屏幕锁定,请移动鼠标以显示锁定的屏幕对话框。输入用户名和口令,然后按 :kbd:`Enter` 键,如 :numref:`figuregnome2`  所示。 + +.. _figuregnome2: + +.. figure:: ./pic/gnome2.png + :width: 75% + :alt: 解除屏幕锁定 + + 解除屏幕锁定 + +.. raw:: latex + + \newpage + +.. _s18: + +从控制台登录 +~~~~~~~~~~~~ + +系统启动后,用户可以得到登录提示: + +``localhost login:`` + +输入用户名,按 :kbd:`Enter`  键。由于系统采用口令和指纹双因子鉴别,在控制台登录时,也需要用户在输入用户名后,在指纹仪中按下正确的指纹完成指纹鉴定: + +``Place your finger on frt610 in 10 seconds then press [Enter]!`` + +指纹鉴定成功后,按下 :kbd:`Enter` 键,系统提示输入用户口令: + +``Password:`` + +输入正确的口令并按 :kbd:`Enter` 键后,该用户将登录到系统,显示如: + +``username@localhost:~ >`` + +若密码输入错误该用户不存在,系统将提示登录失败,需重新登录: + +``Login incorrect`` + +``localhost login:`` + +您可以重新尝试登录,但是有次数限制,如果达到预定义次数的非成功尝试,系统将在一段时间间隔后才允许重新登录。预定义次数和时间间隔由授权管理员设置。 + + +用户还可以在其它情况下登录到凝思安全操作系统。 + +- 使用 :kbd:`Ctrl-Alt` - :kbd:`F1` ~ :kbd:`F6` 切换到不同的控制台,用不同的用户登录。 + +- 使用命令 ``su username`` 从当前用户切换到用户 ``username`` 登录。 + + 如:当前用户为 testuser1,输入命令 ``su testuser2`` 或 ``su - testuser2`` ,输入用户 ``testuser2`` 的口令后,从用户 ``testuser1`` 切换到用户 ``testuser2`` 。 + + :: + + testuser1@localhost:~ >su testuser2 + Passowrd: + testuser2@localhost:/home/testuser1 > + + +文档和帮助 +---------- + +用户使用系统过程中,可以使用 ``man`` 命令查看各命令的手册页,或使用 ``info`` 命令查看各信息页。 + +例如,要阅读 ``ls`` 命令的手册页,在 shell 提示下输入 ``man ls`` (或输入  ``info ls`` 来阅读信息页)。要关闭手册页或信息页,按 :kbd:`q` 。 + +.. raw:: latex + + \newpage + +注销 +---- + +从桌面注销 +~~~~~~~~~~ + +在桌面环境下,您不再使用计算机时,您可以注销并让系统保持运行。 + +要注销并保持系统运行,请执行以下操作: + +- 单击面板上的“系统”,从菜单中选择[注销],如 :numref:`figuregnome4` 所示。 + + +.. _figuregnome4: + +.. figure:: ./pic/gnome4.png + :width: 70% + :alt: 从桌面注销 + + 从桌面注销 + +.. raw:: latex + + \newpage + +- 点击“注销”,如 :numref:`figuregnome5` 所示。 + + + +.. _figuregnome5: + +.. figure:: ./pic/gnome5.png + :width: 70% + :alt: 注销 + + 注销 + +.. raw:: latex + + \newpage + +从控制台注销 +~~~~~~~~~~~~ + +在控制台中,输入 ``logout`` ,该用户将注销登录,系统返回登录提示: + +``login:`` + +用户需重新登录才能使用系统。 + + +远程登录 +-------- + +凝思安全操作系统支持远程桌面,以下是一个简单的使用实例。 + +有两台安装了凝思安全操作系统的机器,假设为machine-1和machine-2,IP分别为172.16.0.245和172.16.0.235。现在想要从machine-2远程登录到machine-1的桌面,可以通过以下步骤实现: +首先在machine-1上开启“允许其他人查看您的桌面”。如 :numref:`figureretmote1` 依次点击桌面左上角“系统——首选项——远程桌面”,在打开的“远程桌面首选项”窗口,如 :numref:`figureretmote2` 选中“允许其他人查看您的桌面”复选项,点击“关闭”。 + +.. _figureretmote1: + +.. figure:: ./pic/remote01.png + :width: 75% + :alt: 允许其他人查看您的桌面 + + 允许其他人查看您的桌面 + +.. _figureretmote2: + +.. figure:: ./pic/remote02.png + :width: 75% + :alt: 允许其他人查看您的桌面 + + 允许其他人查看您的桌面 + + +.. raw:: latex + + \newpage + +然后在machine-2上远程登录到test1。在machine-2的console窗口,执行vncviewer,在弹出交互界面的如 :numref:`figureremote3` 和 :numref:`figureremote4` 所示,server:后输入172.16.0.245(machine-1的IP地址),按“enter”键,然后等待machine-1允许授权。 + + +.. _figureremote3: + +.. figure:: ./pic/remote03.png + :width: 75% + :alt: 远程登录 + + 远程登录 + + +.. _figureremote4: + +.. figure:: ./pic/remote04.png + :width: 75% + :alt: 远程登录 + + 远程登录 + + +.. raw:: latex + + \vspace{.5cm} + +切换到machine-1机器允许machine-2远程登录到自己桌面,如  :numref:`Remote05`  所示。 + +.. _Remote05: + +.. figure:: ./pic/remote05.png + :width: 75% + :alt: 允许远程登录 + + 允许远程登录 + +.. raw:: latex + + \newpage + +切换到machine-2机器,发现已经远程登录到了machine-1的桌面,如 :numref:`Remote06` 所示。 + +.. _Remote06: + +.. figure:: ./pic/remote06.png + :width: 75% + :alt: 登录到远程桌面 + + 登录到远程桌面 + +.. raw:: latex + + \newpage diff --git a/source/系统基本使用.rst b/source/系统基本使用.rst new file mode 100644 index 0000000..ff248f1 --- /dev/null +++ b/source/系统基本使用.rst @@ -0,0 +1,796 @@ +系统基本使用 +============ + +尽管图形用户界面对 Linux 已经越来越重要,但是使用鼠标并不总是处理日常工作的最佳方式。命令行不仅高度灵活而且效率较高。本章主要是对 Bash +shell 基本使用的简要介绍,解释 Linux 中的用户权限概念,并提供较重要的命令列表。 + +要控制文本模式下的计算机,基于文本的应用程序尤为重要。这种情况下需要使用虚拟控制台。有六个控制台可以在文本模式下使用。对应的组合键分别为 :kbd:`Alt` - :kbd:`F1` ~ :kbd:`F6` 。第七个控制台是为 X 窗口系统保留的。 + +.. _s12: + +Bash 简介 +--------- + +用户登录后进入控制台,该控制台通常运行 Bash(Bourne again +shell,该程序是 GNU 项目中的一部分)。运行该 shell 后,请查看第一行的提示,通常由用户名、主机名和当前路径组成。但可对其进行自定义。当光标移到该提示后面时,您可以直接向所在计算机系统发送命令。 + +命令 +~~~~ + +一条命令包含若干元素。第一个元素总是真正的命令,随后是参数或选项。按 :kbd:`Enter` 键即可执行命令。在此之前,您可以很容易地编辑命令行、添加选项或更正输入错误。 ``ls`` 是一个最常用的命令,该命令可以使用参数,也可以不使用。在控制台中只输入 ``ls`` 命令将显示当前目录的内容。 + +选项以连字符为前缀。例如,命令 ``ls -l`` 将显示同一目录中内容的详细信息。在每个文件名后,都可以看到文件的创建日期、以字节表示的文件大小和下文要涉及的其它详细信息。 ``--help`` 是许多命令都有的非常重要的选项。输入 ``ls --help`` 可以显示 ``ls`` 命令的所有选项。 + +也可以使用 ``ls`` 命令查看其它目录下的内容。为此,必须将该目录指定为参数。例如,要查看 ``/home`` 下的内容,应输入 ``ls -l /home`` 。 + +.. _s8: + +文件和目录 +~~~~~~~~~~ + +要高效使用 shell,掌握一些关于 Linux 系统的文件和目录结构的知识将有很大帮助。您可以将目录视为存储文件、程序和子目录的电子文件夹。层次中的顶级目录是根目录,用  ``/`` 表示。从此目录可以访问其它所有目录。 ``/home`` 目录包含用于存储个人用户私人文件的目录。目录树如 :numref:`Tree` 所示。 + +.. _Tree: +.. graphviz:: + :alt: 目录树 + :caption: 目录树 + :align: center + + graph grap { + node[shape=box,fontsize=10]; + size="8,8"; + rankdir="LR"; + + root [ label="/" ]; + rootsbin [ label= "sbin" ]; + usrsbin [ label="sbin" ]; + rootmp [ label="tmp" ]; + vartmp [ label="tmp" ]; + rootbin [ label="bin" ]; + usrbin [ label="bin" ]; + + root -- rootbin + root -- dev + root -- etc + root -- home + root -- lib + root -- opt + root -- proc + root -- rootsbin + root -- sys + root -- rootmp + root -- usr + root -- var + + usr -- usrbin + usr -- include + usr -- local + usr -- usrsbin + usr -- src + usr -- share + var -- log + var -- vartmp + etc -- "init.d" + + share -- doc + share -- man + include -- "c++" + src -- linux + } + + +.. raw:: latex + + \newpage + +以下简要说明了 Linux 中的标准目录。 + +- ``/`` 根目录,目录树的起点 + +- ``/bin`` 在引导过程初期需要的程序 + +- ``/dev`` 代表硬件组件的设备文件 + +- ``/etc`` 重要的系统配置文件 + +- ``/etc/init.d`` 引导脚本 + +- ``/home`` 用户目录 + +- ``/lib`` 共享库(供动态链接程序使用) + +- ``/opt`` 选件,大型装载程序包(如 KDE、GNOME、Netscape) + +- ``/proc`` 进程文件系统 + +- ``/sbin`` 为系统管理员保留的用于引导的程序 + +- ``/sys`` “system”文件系统,在其中收集内核的所有设备信息 + +- ``/tmp`` 临时文件 + +- ``/usr`` 所有应用程序 + +- ``/usr/bin`` 通常可访问的程序 + +- ``/usr/include`` C 编译器的头文件 + +- ``/usr/include/c++`` C++ 编译器的头文件 + +- ``/usr/local`` 本地的、与发布版无关的扩展 + +- ``/usr/sbin`` 为系统管理员保留的程序 + +- ``/usr/share/doc`` 各种文档文件 + +- ``/usr/share/man`` 系统手册页 + +- ``/usr/src`` 系统软件的源代码 + +- ``/usr/src/linux`` 内核源代码 + +- ``/var`` 系统正常运行时所改动的数据 + +- ``/var/log`` 系统日志文件 + +- ``/var/tmp`` 临时文件 + +Bash 功能 +~~~~~~~~~ + +Bash shell 提供的两种重要功能可以让您的工作变得很简单: + +- 历史记录 + + 要重复以前输入的命令,请按 :kbd:`↑` 键,直到先前命令在提示符处出现。按 :kbd:`↓` 键可以在先前输入的命令列表中前移。要编命令行,只需使用箭头键将光标移至所需位置并开始键入。使用 :kbd:`Ctrl` - :kbd:`R` 可在历史记录中搜索。 + +- 展开 + + 在键入文件名的第几个字母后,展开完整的文件名,直至它可以被唯一标识。只需在键入前几个字母后按 :kbd:`Tab` 键即可实现此功能。如果有多个文件名的前几个字母都相同,则按两次 :kbd:`Tab` 键可获取这些文件的列表。 + +指定路径 +~~~~~~~~ + +处理文件或目录时,指定正确的路径十分重要。不过,您不必输入从主目录到各个文件的完整(绝对)路径。您可以从当前目录开始指定。直接用 ~ 来表示主目录。例如主目录下有个 ``test`` 目录,那么有两种方法可以列出 ``test`` 目录中的文件:用 ``ls text`` 输入相对路径或用 ``ls ~/test`` 指定绝对路径。 + +要列出其他用户主目录的内容,请输入 ``ls ~username`` 。例如某个用户是testuser,这样,使用 ``ls ~testuser`` 就会列出 ``testuser`` 主目录的内容。 + +用一个圆点来表示当前目录。当前目录的上一级目录用两个点来表示。输入 ``ls ..`` 可以查看当前目录的父目录的内容。命令 ``ls ../..`` 可用于比当前目录高两个级别的目录的内容。 + +.. _s20: + +通配符 +~~~~~~ + +shell 的便捷之处还体现在通配符上。Bash 提供四种不同的通配符: + +- ``?`` 完全匹配任一字符。 + +- ``*`` 匹配任意数目的字符。 + +- ``[set]`` + 匹配在方括号中指定的字符组中的任一字符,这里用字符串 set 表示字符组。 + +- ``[!set]`` 匹配 set 标识字符之外的任一字符。 + +假定 ``test`` 目录包含文件 ``testfile`` 、 ``testfile1`` 、 ``testfile2`` 和 ``datafile`` ,使用命令 ``ls testfile?`` 则可以列出文件 ``testfile1`` 和 ``testfile2`` 。使用 ``ls testfile*`` ,列表还将包括 ``testfile`` 。 ``ls *file*`` 会显示所有示例文件。最后,您可以使用 ``set`` 通配符表示所有末尾字符为数字的示例文件: ``ls testfile[1-9]`` 。 + +四个通配符中匹配范围最广的是星号。使用它可以将某个目录内的所有文件复制到另一个目录,或通过一个命令删除所有文件。例如,使用命令  ``rm *file*`` 可以删除当前目录中文件名包含字符串 ``file`` 的所有文件。 + +less 和 more +~~~~~~~~~~~~ + +Linux 包含两个直接在 shell 中查看文本文件的小程序。不必启动编辑器来阅读 ``Readme.txt`` 之类的文件,只需输入 ``less Readme.txt`` 即可在控制台窗口中显示其中的文本。使用 :kbd:`Enter` 键可以向下滚动一行,使用 :kbd:`Space` 键可以向下滚动一页,使用 :kbd:`↑` 和 :kbd:`↓` 键可以使文本按行上下滚动,使用 :kbd:`Page Up` 和 :kbd:`Page Down` 键可以使文本按页上下滚动,要退出 **less** ,请按 :kbd:`Q` 。 + +除了使用 **less** 之外,您还可以使用 **more** 这种较早的程序。不过,该程序使用起来不太方便,因为它不允许向上滚动文本,只能使用 :kbd:`Enter` 或 :kbd:`Enter` 键向下滚动一行或一页。 + +**less** 程序得名于 less is +more(少即是多)原则,并且还可用来方便查看命令输出。要了解该程序的这种功能,详见下一节“管道”。 + +管道 +~~~~ + +通常,shell 的标准输出界面是您的屏幕或控制台窗口,而标准输入设备是键盘。要将命令的输出转发到像 **less** 这样的应用程序,就需要使用管道。 + +要查看 ``text`` 目录下的文件,请输入命令 ``ls test | less`` 。 ``test`` 目录的内容将使用 **less** 来显示。这只是在 ``ls`` 命令正常输出过长时才有意义。例如,当您使用 ``ls /dev`` 命令查看 ``dev`` 目录的内容时,您只能在窗口中看到一小部分。而使用 ``ls /dev | less`` 命令则能够查看整个列表。 + +也可以将命令的输出保存到文件中。例如, ``ls test > content`` 会生成一个名为 ``content`` 的新文件,其中包含 ``test`` 中的文件和目录的列表。用 ``less content`` 命令可以查看该文件。 + +您也可以将文件作为命令的输入。例如,用 ``sort < testfile`` 命令对 ``testfile`` 中的文本行进行排序。 ``sort`` 命令的输出被发送到屏幕。文本按各行的首字符进行排序,如果两行的首字符相同,该命令将继续比较这两行的下一字符,如果还相同,将继续进行比较。 + +如果需要用一个新文件来包含排序列表,则需要将 ``sort`` 命令的输出用管道输出至一个文件。要测试该命令,在编辑器中创建一个未排序的名称列表,并在命名为 ``list`` 后保存到 ``test`` 目录中。然后转至 ``test`` 目录并输入命令 ``sort < unsortedlist > sortedlist`` 。最后,使用 **less** 查看经过排序的列表。 + +标准错误输出和标准输出一样,都发送至控制台。不过,要将标准错误输出重定向到名为 ``errors`` 的文件,则需要在相应命令中追加 ``2> errors`` 。如果追加的是 ``>& alloutput`` ,标准输出和标准错误都将保存到名为 ``alloutput`` 的文件中。最后,要将命令输出结果追加到现有文件,该命令后面必须跟有 ``>>`` 而不是单个 ``>`` 。 + +.. hint:: + + 在 ``Linux`` 中,内核为每个命令自动打开3个文件,分别是命令的输入,输出 + 和错误信息文件。每个打开的文件都有一个小的整数与之对应,称为文件描述符。 + 标准输入、标准输出、标准出错的文件描述符分别是0、1、2。 + +存档和数据压缩 +~~~~~~~~~~~~~~ + +您已经创建了一些文件和目录,现在该考虑一下存档和数据压缩的问题了。假定您想将整个 ``test`` 目录打包在一个文件中,以便备份到软盘或通过电子邮件发送。要执行该操作,请使用命令 ``tar`` (代表 tape archiver,即磁带存档程序)。使用  ``tar --help`` 可查看 ``tar`` 命令的所有选项。下面对最重要的一些选项进行了说明: + +- ``-c`` (代表 create)创建新档案。 + +- ``-t`` (代表 table)显示档案中的内容。 + +- ``-x`` (代表 extract)对档案解包。 + +- ``-v`` (代表 verbose)创建档案时在屏幕上显示所有文件。 + +- ``-f`` + (代表 file)为档案文件选择一个文件名。创建档案时,此选项总应放在最后。 + +要将 ``test`` 目录下的所有文件和子目录打包到名为 ``testarchive.tar`` 的档案中,请使用选项 ``-c`` 和 ``-f`` 。尽管不是必需的,但出于测试的目的,请同时添加  ``-v`` 选项,以便跟踪存档过程。在使用 ``cd`` 命令转至 ``test`` 目录所在的主目录后,输入 ``tar -cvf testarchive.tar test`` 。之后,可使用  ``tar -tf testarchive.tar`` 查看档案文件的内容。 ``test`` 目录及其所有文件和目录都在您的硬盘上保持不变。要对档案解包,请输入 ``tar -xvf testarchive.tar`` 。 + +对于文件压缩,常用的 **gzip** 程序当然是 Linux 系统的首选。只需输入 ``gzip testarchive.tar`` 即可。通过 ``ls`` ,您可以看到文件 ``testarchive.tar`` 已不复存在,取而代之的是文件 ``testarchive.tar.gz`` 。这个文件要小得多,因此也更适于通过电子邮件传送或存储到软盘上。 + +现在,将该文件解包到先前创建的 ``test2`` 目录中。这需要输入 ``cp testarchive.tar.gz test2`` 将文件复制到该目录中。使用 ``cd test2`` 转至该目录。扩展名为 ``.tar.gz`` 的压缩档案可用 ``gunzip`` 命令解压缩。输入 ``gunzip testarchive.tar.gz`` 将生成文件 ``testarchive.tar`` ,然后还需使用 ``tar -xvf testarchive.tar`` 命令抽取或执行 untar 操作。您也可以通过添加 ``-z`` 选项一步完成解压和抽取压缩档案。完整的命令为 ``tar -xzvf testarchive.tar.gz`` 。通过 ``ls`` ,您会看到新建的 ``test`` 目录,其内容与主目录中的 ``test`` 目录的内容完全相同。 + +.. _s9: + +用户和访问控制 +-------------- + +访问控制是网络安全防范和保护的主要核心策略,它的主要任务是保证网络资源不被非法使用和访问。访问控制规定了主体对客体访问的限制,并在身份识别的基础上,根据身份对提出资源访问的请求加以控制。它是对信息系统资源进行保护的重要措施,也是计算机系统最重要和最基础的安全机制。 + +访问控制的基本概念有: + +- 主体(Subject) + + 主体是指主动的实体,是访问的发起者,它造成了信息的流动和系统状态的改变,主体通常是进程。 + +- 客体(Object) + + 客体是指包含或接受信息的被动实体,客体在信息流动中的地位是被动的,是处于主体的作用之下,对客体的访问意味着对其中所包含信息的访问。客体通常是用于信息共享、存储和通讯的系统资源(如文件、目录、套接字、共享内存等)。 + +- 访问(Access) + + 访问(Access)是使信息在主体(Subject)和客体(Object)之间流动的一种交互方式。 + +- 访问权限(Access Permissions) + + 访问权限决定了谁能够访问系统,能访问系统的何种资源以及如何使用这些资源。适当的访问权限能够阻止未经允许的用户有意或无意地获取数据。访问权限的手段包括用户识别代码、口令、登录控制、资源授权(例如用户配置文件、资源配置文件和控制列表)、授权核查、日志和审计等等。 + +凝思安全操作系统是一种多用户系统,它支持任意数目的用户同时操作。用户在自己的工作站上启动会话之前必须先登录到系统中。每个用户都有一个用户名及对应的口令。设置用户名和口令可以确保未经授权的用户无法查看他们无权查看的文件。进行这种限制后,普通用户不可能对系统进行改动(如安装新程序),只有被授权的用户(如管理员)才能对系统进行更改或访问文件,而设置了强制访问控制后,即使是管理员也不可能访问所有的文件。下面章节只描述一般情况(未设置强制访问控制)。 + +文件系统权限 +~~~~~~~~~~~~ + +一般而言,Linux 文件系统中的每个文件都属于某个用户和某个组。可以为这些专有组和其它所有组授予读、写或执行这些文件的权限。 + +在这种情况下,可以将组定义为具有特定集合权限的一组相互连接的用户。例如,可以将共同处理某个项目的组称为 ``project1`` 。Linux 系统中的每个用户都是至少一个专有组(通常是 ``users`` )的成员。可以根据需要设置系统中组的数目,但只有管理员才能添加组。每个用户都可以使用 ``groups`` 命令查出自己所属的组。 + +- 文件访问 + + 文件系统中的权限组织结构不同于文件和目录的组织结构。使用 ``ls -l`` 命令可以显示文件权限信息。命令输出可能如下所示: + +:: + + -rw-r----- 1 testuser1 project1 14197 Jun 21 15:03 testfile + +如第三列中所示,此文件属于用户 ``testuser1`` 。该文件被指派给组 ``project1`` 。要确定 ``testfile`` 文件的用户权限,必须仔细检查第一列。 + + +-------+----------+---------+----------------+ + | ``-`` | ``rw-`` | ``r--`` | ``---`` | + +-------+----------+---------+----------------+ + | 类型 | 用户权限 | 组权限 | 其他用户的权限 | + +-------+----------+---------+----------------+ + + 此列含有一个前置字符,后接九个字符,每三个字符为一组。这十个字符中的第一个字符代表文件系统组件的类型。连字符( ``-`` )表示这是一个文件, ``d`` 表示目录、 ``l`` 表示链接、 ``b`` 表示块设备, ``c`` 表示字符设备。 + + 后面的三组字符遵循标准模式。第一个字符表示该文件可读 ( ``r`` )还是不可读( ``-`` ),第二个字符表示该文件可写( ``w`` )还是不可写( ``-`` ),第三个字符表示该文件可执行( ``x`` )还是不可执行( ``-`` )。 + + 在本例中,作为文件 ``testfile`` 的拥有者, ``testuser1`` 有权读( ``r`` )写( ``w`` )该文件,但无法执行它( ``x`` )。 ``project1`` 组中的成员可以读取该文件,但不能修改或执行它。其他用户无权访问此文件。通过 ACL(Access + Control List,访问控制列表)可以指派其它权限。 + +- 目录权限 + + 目录的访问权限类型用 ``d`` 来表示。对目录而言,各种权限的含义稍有不同。 + +:: + + drwxrwxr-x 1 testuser1 project1 35 Jun 21 15:15 ProjectData + +在上例“显示目录权限的示例输出”中,很容易识别出目录  ``ProjectData`` 的拥有者( ``testuser1`` )和所属组( ``project1`` )。与之前的文件访问权限相比,设置读权限( ``r`` )表示可以显示该目录的内容。写权限( ``w`` )表示可以在该目录下创建新文件或删除文件。执行权限( ``x`` )表示用户可以进入该目录。上例中的输出表示用户 ``testuser1`` 及组 ``project1`` 中的成员可以转到 ``ProjectData`` 目录( ``x`` )、查看其中的内容( ``r`` )并添加或删除文件( ``w`` )。其他用户的权限则受到限制。他们可以进入目录( ``x`` )并浏览其中的内容( ``r`` ),但不能创建或删除任何文件( ``w`` )。 + +修改文件权限 +~~~~~~~~~~~~ + +- 更改访问权限 + + 文件或目录的访问权限可以由拥有者更改,当然也可以由管理员更改;更改时要使用命令  ``chmod`` ,后接更改权限的参数及一个或多个文件名。参数可归为四类: + + #. 用户相关参数 + + - ``u`` (user) :文件的拥有者。 + + - ``g`` (group) :与文件属主有相同组 ID 的所有用户。 + + - ``o`` (others):其他用户。 + + .. attention:: + + 如果未指定用户参数,访问权限的更改将应用到所有用户。 + + #. 用于增加( ``+`` )、删除( ``-`` )或设置( ``=`` )的字符。 + + #. 缩写 + + - ``r`` :读 + + - ``w`` :写 + + - ``x`` :执行 + + #. 一个文件名或由空格分隔的多个文件名 + + 例如,在“显示目录权限的示例输出”中,如果用户 ``testuser1`` 还想授予其他用户写入( ``w`` )目录 ``ProjectData`` 的权限,则可以使用命令 ``chmod o+w ProjectData`` 执行该操作。 + + 不过,如果该用户不希望任何用户具有写权限(其本人除外),则可以输入命令 ``chmod go-w ProjectData`` 执行该操作。要防止所有用户向 ``ProjectData`` 添加新文件,请输入 ``chmod -w ProjectData`` 。此时,如果不重新设置写权限,即使是拥有者也无法再写入该文件。 + +- 更改所有权 + + 另有一些重要的命令可用来控制文件系统组件的所有权和权限,这些命令包括 ``chown`` (更改拥有者)和 ``chgrp`` (更改组)。使用命令 ``chown`` 可将文件所有权转让给另一用户。不过,只有 root 才有权执行该操作。 + + 假定“显示目录权限的示例输出”中的文件 ``testfile`` 不应再属于 ``testuser1`` ,而应属于用户 ``testuser2`` ,则 root 应该输入 ``chown testuser2 testfile`` 。 + + ``chgrp`` 用于更改文件的组所有权。不过,文件的拥有者必须是新组的成员。这样,使用命令 ``chgrp project2 ProjectData`` ,“显示文件权限的示例输出”中的用户 ``testuser1`` 即可将文件 ``ProjectData`` 所属的组改换为 ``project2`` ,只要该用户是这个新组的成员。 + +setuid 位 +~~~~~~~~~ + +在某些情况下,访问权限可能过于严格。因此,Linux 另有一些设置,允许为执行特定操作临时更改当前用户和组标识。例如, ``passwd`` 程序通常要求拥有根权限才能访问 ``/etc/passwd`` 。此文件包含一些重要信息,如用户主目录及用户和组 ID。因此,普通用户将无法更改 ``passwd`` ,因此授予所有用户直接访问此文件的权限太过危险。解决该问题的一种可行方案就是 setuid 机制。setuid(设置用户 ID )是一个特殊的文件特性,当一个程序被设置了该标记以后,运行该程序的进程将拥有该程序所有者同样的权限。以 ``passwd`` 命令为例: + +:: + + -rwsr-xr-x 1 root shadow 80036 2004-10-02 11:08 /usr/bin/passwd + +您可以看到为用户权限设置了 ``s`` 位。通过设置 setuid 位,启动 ``passwd`` 命令的所有用户都以 root 身份执行该命令。 + +setgid 位 +~~~~~~~~~ + +setuid 特性适用于用户,setgid 特性则适用于组。进程在执行设置了 setgid 位的文件时,将拥有其文件所有组同样的权限。例如: + +:: + + drwxrws--- 2 testuser1 archive 48 Nov 19 17:12 backup + +您可以看到为组权限设置了 ``s`` 位。目录的拥有者和组 ``archive`` 的成员可以访问此目录。不是该组成员的用户将被“映射到”相应的组;所有写入文件的有效组 ID 将为 ``archive`` 。例如,以组 ID +``archive`` 运行的备份程序即便没有根权限也能访问此目录。 + +粘滞位 +~~~~~~ + +另外还可以设置粘滞位。 + +粘滞位最初的目的是“在 swap 中保存文本”,即以这种方式标记的文件将被装入 RAM ,而不必在每次使用时从硬盘读取,从而提高命令处理的性能。现在 UNIX 系统已经不再使用这个功能,但“粘滞位”这个名称被保留。 + +如果为目录设置了粘滞位,则该目录下的文件只能由 root、该目录的所有者或该文件的所有者删除。典型示例如 ``/tmp`` 目录: + +:: + + drwxrwxrwt 2 sys sys 4096 Oct 21 17:15 tmp + +自主访问控制 +~~~~~~~~~~~~ + +访问控制涉及的领域很广,方法也很多,通常访问控制策略可以划分为自主访问控制和强制访问控制。 + +- 自主访问控制(Discretionary Access Control) + +- 强制访问控制(Mandatory Access Control) + +自主访问控制(DAC)是在确认主体身份及所属组的基础上,根据访问者的身份和授权来决定访问模式,对访问进行限定的一种控制策略。所谓自主,是指具有被授予某种访问权力的用户能够自己决定是否将访问控制权限的一部分授予其他用户或从其他用户那里收回他所授予的访问权限。使用这种控制方法,用户或应用可任意在系统中规定谁可以访问它们的资源,这样,用户或用户进程就可有选择地与其他用户共享资源。它是一种对单独用户执行访问控制的过程和措施。 + +Linux 系统文件对象(如文件或目录)的传统权限概念通过 ACL(访问控制列表)得到了进一步扩展。通过访问控制列表可以将权限指派给文件系统对象的各个用户或组,而不再局限于最初的拥有者或所属组。 + +在凝思安全操作系统 V6.0 中,任何用户都可以使用自主访问控制。 + +- 文件创建时具有缺省自主访问控制属性 + + 创建客体时,新建客体的文件所有关系应为创建者,且文件访问权限为默认方式。 + + 在新建文件的时候,通常使用666作为默认许可位;在新建程序的时候,通常使用777作为默认许可位。实际的文件访问权限由 umask 按位取反再和默认许可按位取与而得到。例如,默认许可位666,umask + 077,则实际的文件访问权限应该是600,即文件所有者有读写权限,其他无权限。用户可以执行 umask 命令查看和更改当前的 uamsk, ``/etc/login.defs`` 里的 umask 定义了一个系统范围内的默认设置。 + + 如:以 testuser1 用户身份登录,umask 为022,运行 ``touch test.txt`` 新建文件 ``test.txt`` 。用 ``ls –l test.txt`` 查看 ``test.txt`` 文件的属性, ``test.txt`` 的所有关系应为: ``testuser1.users`` ,文件属性应为: + ``rw-r—r--`` + +- 自主访问控制的访问权限设定 + + 用户能根据属主/属组/其他关系设置客体的读/写/执行权限。 + + 属主(user):文件拥有者。 + + 属组(group):文件拥有者的用户组。 + + 其他(other):除了属主及其同组成员的其他用户。 + + 如:以 ``testuser1`` 用户身份登录,创建文件 ``test.tmp`` ,将文件的属性设置为 600。用户 ``testuser1`` 能够读写但不能执行文件 ``test.tmp`` ,其它用户不能访问该文件。 + +- 属主可访问其拥有的客体 + + 用户能够访问属于自己的文件。 + + 如:以 testuser1 用户身份登录,创建文件 ``test.txt`` ,用户 testuser1 将能够读写 ``test.txt`` 文件。 + +- 属主可更改其拥有的客体的组所有权 + + 普通用户不能将其拥有的客体所有权转让给其他用户,但可以将其组所有权转让给具有指定组名的组。命令使用如下: + + chgrp [option(s)] groupname file(s) + + ``-R`` 更改所有子目录中的文件和目录。 + +- 属主可改变客体的访问权限 + + 客体属主可以使用 ``chmod`` 命令改变客体的访问权限。 + + 如:以 testuser1 用户身份登录,建立文件 ``test.txt`` 并将其属性改为 660(同组用户可读写,其它用户不能访问)。用 ``ls`` 查看 ``test.txt`` 的属性,应为 660,以 testuser1 不同组的用户身份 testuser2 登录,将不能访问 ``test.txt`` 文件。 + + :: + + $ touch test.txt + $ ls -l test.txt + -rw-r--r-- 1 testuser1 users 0 Sep 4 06:27 test.txt + + $ chmod 660 test.txt + $ ls -l test.txt + -rw-rw---- 1 testuser1 users 0 Sep 4 06:27 test.txt + + login: testuser2 + passwd: + + $ cat test.txt + cat: test.txt: Permission denied + +访问控制列表 +^^^^^^^^^^^^ + +传统类 UNIX 系统以文件属主、组和其它方式设置读、写和执行权限,这会造成文件访问权限的不必要扩散。例如,如果想让某个非同组的用户能够访问一个文件,就只能让所有人都能访问这个文件,这是非常不安全的,也是非常不必要的。 + +访问控制列表(Access Control List, +ACL)提供细粒度的访问控制,能够以特定用户或特定组为单位的访问权限分配,从而防止文件访问权限的不必要扩散。利用访问控制列表机制,我们只要把文件共享给特定用户就可以了,而无须让所有人都能够访问该文件。 + +使用一个简单的 ``ls -l`` 命令即可检测到拥有扩展访问权限的文件或目录: + +:: + + -rw-r--r--+ 1 testuser1 project1 14197 Oct 21 15:03 testfile + +与不带 ACL 的文件的 ``ls`` 输出相比,上述 ``ls`` 的输出并没有显著的不同。 ``testfile`` 由属于组  ``project1`` 的 ``testuser1`` 拥有。 ``testuser1`` 对此文件具有读写权限,而其所属的组及其他所有用户均具有读权限。带 ACL 和不带 ACL 的文件之间唯一显示的区别即在于:前者的第一列内多了一个用来包含权限位的 ``+``\ 。 + +使用命令 ``getfacl`` 可以显示文件名、属主、所属组和访问控制列表(ACL),如果一个目录拥有默认的 ACL,``getfacl`` 也将显示默认的 ACL,非目录文件不能拥有默认的 ACL。 + +通过执行 ``getfacl testfile`` 来获取 ACL 的详细信息: + +:: + + 1 # file: testfile + 2 # owner: testuser1 + 3 # group: project1 + 4 user::rw- + 5 user:testuser2:rw- effective: r-- + 6 group::r-- + +:: + + 7 group:project2:rw- effective: r-- + 8 mask::r-- + 9 other::--- + +输出中的前三行不包含 ``ls -l`` 中没有的信息。这些行只用来表明文件名、拥有者和所属组。第4到9行包含 ACL 条目。传统访问权限只是使用 ACL 可以授予的权限的一部分。本例中的 ACL 为该文件的拥有者以及用户 ``testuser2`` 授予了读写权限(第4到5行)。通过为其他用户授权,传统概念得到了扩展。这种权限的扩展也同样适用于组权限的处理。所属组拥有读权限(第6行),且 ``project2`` 组拥有读写权限。第8行中的 ``mask`` 条目将用户 ``testuser2`` 和组 ``project2`` 的有效权限限制为只能读取。其他用户和组对该文件不具备任何类型的权限(第9行)。 + +使用命令 ``setfacl`` 可以设置文件的访问控制列表。如: + +- 以普通用户 testuser 身份登录系统,在 ``/tmp`` 目录下创建文件 ``aaa`` ,并将其 DAC 属性设置为600,即除自己以外不允许任何用户进行读写: + + :: + + $ touch /tmp/aaa + $ chmod 600 /tmp/aaa + + + - 以普通用户 testuser1 身份登录系统,对 ``/tmp/aaa`` 文件无法进行读或写操作。 + + - 以普通用户 testuser2 身份登录系统,对 ``/tmp/aaa`` 文件无法进行读或写操作。 + + - 以普通用户 testuser 身份将  ``/tmp/aaa`` 文件的 ACL 属性设置为 testuser1 用户可以进行读写: + + :: + + $ setfacl -m u:testuser1:rw /tmp/aaa + + + - 以普通用户 testuser1 身份可以对 \ ``/tmp/aaa`` 文件进行读或写操作。 + + - 以普通用户 testuser2 身份对 ``/tmp/aaa`` 文件仍然无法进行读或写操作。 + +.. important:: + + 只有文件的属主和拥有 ``CAP_FOWNER`` 能力的进程拥有修改文件 ``ACL`` 设置的权 + 力,只有能够读取访问文件的进程才能读取文件的 ``ACL`` 设置,类似于传统UNIX + 文件访问权限的要求。``CAP_FOWNER`` 能力由管理员设置。 + +重要的 Linux 命令 +----------------- + +本节深入探讨 Linux 系统中较为重要的命令,伴随各个命令列出了参数,并且适当的时候还给出了典型的示例应用程序。有关各个命令的详细信息,请使用 ``man`` ,并在后面键入命令名称来查看其手册页,例如 ``man ls`` 。 + +在参考手册页中,用 :kbd:`Page Up` 和 :kbd:`Page Down` 可以上下移动,用 :kbd:`Home` 和 :kbd:`End` 可以切换显示文档的开头和结尾。按 :kbd:`Q` 可以结束这种查看模式。使用 ``man man`` 可以了解有关 ``man`` 命令本身的更多信息。 + +本节所列命令只是众多命令中的一小部分。有关其它命令的信息或更详细的信息,建议您参考 O’Reilly 出版的《Linux +in a Nutshell》。下面的概述中使用不同的字体来表示各个命令元素。 + +命令及其必需选项始终显示为命令选项,需要指定的内容或非必需参数均放在[方括号]中。 + +实际使用时通常可以将几个参数组合起来,例如用 ``ls -la`` 来代替 ``ls -l -a`` 。 + +文件命令 +~~~~~~~~ + +本小节将列出较重要的文件管理命令。它包括从总体文件管理到文件系统 ACL 操纵的所有文件管理命令。 + +#. 文件管理 + + - ``ls [option(s)] [file(s)]`` + + 如果运行 ``ls`` 时未附加任何参数,程序将以缩写格式列出当前目录中的内容。 + + ``-l`` 详细列表。 + + ``-a`` 显示隐藏文件。 + + - ``cp [option(s)] source target`` + + 将 ``source`` 复制到 ``target`` 。 + + ``-i`` 在覆盖现有 ``target`` 之前等待确认(如果需要)。 + + ``-r`` 递归复制(包含子目录)。 + + - ``mv [option(s)] source target`` + + 将 ``source`` 复制到 ``target`` ,然后删除原始 ``source`` 。 + + ``-b`` 在移动 ``source`` 之前创建该文件的备份副本。 + + ``-i`` 在覆盖现有 ``targetfile`` 之前等待确认(如果需要)。 + + - ``rm [option(s)] file(s)`` + + 从文件系统中删除指定文件。除非使用选项 ``-r`` ,否则不能使用 ``rm`` 删除目录。 + + ``-r`` 删除所有现有子目录。 + + ``-i`` 在删除各个文件之前等待确认。 + + - ``ln [option(s)] source target`` + + 创建从 ``source`` 到 ``target`` 的内部链接。通常这种链接直接指向同一文件系统上的 ``source`` 。但是,如果执行带 ``-s`` 选项的 ``ln`` 命令,则可以创建一个符号链接,仅指向 ``source`` 所在的目录,支持跨文件系统的链接。 + + ``-s`` 创建符号链接。 + + - ``cd [option(s)] [directory]`` + + 更改当前目录。执行不带任何参数的 ``cd`` 命令将转到用户主目录。 + + - ``mkdir [option(s)] directoryname`` + + 创建新目录。 + + - ``rmdir [option(s)] directoryname`` + + 删除指定的目录(如果该目录已清空)。 + + - ``chmod [option(s)] mode file(s)`` + + 更改访问权限。 + + ``mode`` 参数由三个部分构成: ``group`` 、 ``access`` 和 ``access type`` 。 ``group`` 接受以下字符: + + ``u`` 用户 + + ``g`` 组 + + ``o`` 其它 + + 对于 ``access`` ,用 ``+`` 可以授予权限,用 ``-`` 可以拒绝授予权限。 + + ``access type`` 受以下选项控制: + + ``r`` 读 + + ``w`` 写 + + ``x`` 执行文件或访问目录。 + + ``s`` + 设置 uid 位——当一个程序被设置了该标记以后,运行该程序的进程将拥有该程序所有者同样的权限。 + + 您也可以使用数字模式来设置访问权限。数字模式是1到4个八进制数,每个数由位权为4、2、1的3位叠加而来。省略的数字缺省设置为0。第一位用来设置 suid(4)、sgid(2)、粘滞位(1);第二位设置文件所有者的权限:可读(4)、可写(2)、可执行(1);第三位设置文件所有者所在组其他用户的权限,设置同第二位;第四位设置其他组的用户的权限,设置同第二位。 + + - ``gzip [parameter(s)] file(s)`` + + 此程序使用复杂的数学算法压缩文件内容。以这种方式压缩的文件的扩展名为 ``.gz`` ,而且使用前需解压缩。要压缩若干文件甚至是整个目录,请使用 ``tar`` 命令。 + + ``-d`` + 将打包的 **gzip** 文件解压缩,使其恢复原始大小,并且能够正常处理(类似命令 ``gunzip`` )。 + + - ``tar option(s) archive file(s)`` + + ``tar`` 将一个或多个文件放入档案。压缩是可选操作。 ``tar`` 是相当复杂的命令,可以附带若干选项,最常用的选项如下: + + ``-f`` 将输出结果写入文件,而不是显示在屏幕上。 + + ``-c`` 创建新的 tar 档案。 + + ``-r`` 将文件添加到现有档案中。 + + ``-t`` 输出档案内容。 + + ``-u`` 添加文件,但仅适用于文件比档案中已有的文件更新的情况。 + + ``-x`` 将档案中的文件解包(抽取)。 + + ``-z`` 用 ``gzip`` 将生成的档案打包。 + + ``-j`` 用 ``bzip2`` 压缩生成的档案。 + + ``-v`` 列出已处理的文件。 + + 由 ``tar`` 创建的档案文件以 ``.tar`` 结尾。如果这个 tar 档案还使用 ``gzip`` 进行了压缩,则以 ``.tgz`` 或 ``.tar.gz`` 结尾。如果是使用 ``bzip2`` 压缩的,则以 ``.tar.bz2`` 结尾。 + + - ``locate pattern(s)`` + + 使用 ``locate`` 命令可以查找指定文件所处的目录。如果需要,可使用通配符来指定文件名。该程序的速度非常快,因为它使用专为此目的创建的数据库(而不是搜索整个文件系统)。但恰恰是这一点也带来了一个重大缺陷:无法找到在最后更新文件数据库后创建的任何文件。以管理员身份使用 ``updatedb`` 可以生成该数据库。 + + - ``updatedb [option(s)]`` + + 此命令可以对 ``locate`` 使用的数据库进行更新。要包含所有现有目录中的文件,请以管理员身份运行程序。最好通过追加与号( ``&`` )。此命令通常作为 daily + cron 作业运行。 + + - ``find [option(s)]`` + + 使用 ``find`` 可以在指定目录中搜索文件。第一个参数指定搜索的起始目录。选项 ``-name`` 后面必须紧跟搜索字符串,字符串中也可以包含通配符。与使用数据库的 ``locate`` 不同, ``find`` 扫描的是实际目录。 + +#. 用于访问文件内容的命令 + + - ``cat [option(s)] file(s)`` + + ``cat`` 命令用于显示文件的内容,使用它可以将所有内容连续打印输出到屏幕上。 + + ``-n`` 在左侧输出编号。 + + - ``less [option(s)] file(s)`` + + 此命令可用于浏览指定文件的内容。使用 :kbd:`Page Up` 和 :kbd:`Page Down` 可以向上或向下滚动半屏,使用 :kbd:`Space` 可以向下滚动一整屏。使用 :kbd:`Home` 和 :kbd:`End` 可以跳转至文件的开头和结尾。按 :kbd:`Q` 可以退出程序。 + + - ``grep [option(s)] searchstring filenames`` + + ``grep`` 命令用于在指定 ``file(s)`` 中查找特定的搜索字符串。如果找到搜索字符串,该命令将显示找到的 ``searchstring`` 所在的行及文件名。 + + ``-i`` 忽略大小写。 + + ``-H`` 为每个匹配打印文件名。 + + ``-n`` 另外显示含有匹配项的行的编号。 + + ``-l`` 只列出其中不含 ``searchstring`` 的文件。 + + - ``diff [option(s)] file1 file2`` + + ``diff`` 命令用于比较两个文件的内容。该程序生成的输出将列出所有不匹配的行。这是只需发送程序变更而不是全部源代码的编程人员经常使用的命令。 + + ``-q`` 只报告两个文件是否不同。 + + ``-u`` 生成一个“统一”的 diff,从而增加输出的可读性。 + +系统命令 +~~~~~~~~ + +本节列出了用于检索系统信息以及进程和网络控制的几个较重要的命令。 + +#. 系统信息 + + - ``df [option(s)] [directory]`` + + ``df`` (可用磁盘)命令如不与任何选项一同使用,则可以显示磁盘空间容量、当前占用磁盘空间以及所有已装入驱动器上的可用空间等相关信息。如果指定了目录,则只显示有关该目录所在的驱动器的信息。 + + ``-h`` 以用户可读的格式显示占用的块数(以 GB、 MB 或 KB 为单位)。 + + ``-T`` 文件系统的类型(ext2、nfs,等等)。 + + - ``du [option(s)] [path]`` + + 执行此命令时若不带任何参数,则可以显示当前目录中的文件和子目录所占用的磁盘空间总量。 + + ``-a`` 显示各个文件的大小。 + + ``-h`` 以用户可读的格式输出。 + + ``-s`` 仅显示计算的总大小。 + + - ``free [option(s)]`` + + ``free`` 命令用于显示有关占用 RAM 和交换空间的信息,可指明这两个类别中的空间总量和占用量。 + + ``-b`` 以字节为单位输出。 + + ``-k`` 以 KB 为单位输出。 + + ``-m`` 以 MB 为单位输出。 + + - ``date [option(s)]`` + + 这个简单程序可以显示当前系统时间。如果以管理员身份运行,该程序也可用于更改系统时间。 + +#. 进程 + + - ``top [option(s)]`` + + ``top`` 提供有关当前运行的进程的快速概览。按 :kbd:`H` 可以进入一个页面,其中简要说明了用于定义该程序的主要选项。 + + - ``ps [option(s)] [process ID]`` + + 如果运行时未指定任何选项,此命令将显示一个表,其中包含您已经启动的所有程序或进程。 + + ``aux`` 显示所有进程的详细列表,不区分拥有者。 + + - ``kill [option(s)] process ID`` + + 有时程序并不能正常终止。多数情况下,通过在执行 ``kill`` 命令时指定相应的进程 ID 就应能够停止此类异常程序。 ``kill`` 将发送 TERM 信号,指示程序自行关闭。如果仍无效,可使用以下参数: + + ``-9`` + 发送一个 KILL 信号而不是 TERM 信号,这将在几乎所有情况下终止指定的进程。 + + - ``killall [option(s)] processname`` + + 此命令类似 ``kill`` ,但它使用进程名(而不是进程 ID)作为参数,可以取消具有该名称的所有进程。 + +#. 网络 + + - ``ping [option(s)] hostname|IP address`` + + ``ping`` 命令是用于测试 TCP/IP 网络基本功能的标准工具。它可以向目标主机发送一个小的数据包,请求立即回复。如果发送有效, ``ping`` 将据此显示一条消息,指明网络链接基本有效。 + + ``-c`` + ``number`` 确定要发送的数据包总数,并且在发送数据包后终止(默认情况下未设置任何限制)。 + + ``-f`` + 溢流 ping:发送尽可能多的数据包;这是为管理员保留的用于测试网络的常用方法。 + + ``-i`` ``value`` 指定发送两个数据包之间的时间间隔(默认值:1秒)。 + + - ``nslookup`` + + 域名系统将域名解析为 IP 地址。使用此工具可以将查询发送到信息服务器(DNS 服务器)。 + + - ``telnet [option(s)] hostname or IP address [Port]`` + + Telnet 实际上是一种 Internet 协议,能支持您跨网络在远程主机上操作。 **Telnet** 同时也是一个 Linux 程序的名称,该程序基于 telnet 协议允许用户登录到远程计算机并进行操作。 + +.. warning:: + + 切勿在第三方可能窃听的网络上使用 **Telnet** 。特别是在因特网上,请 + 使用 ``ssh`` 之类的加密传送方法,避免口令被盗用。 + +#. 其它 + + - ``passwd [option(s)] [username]`` + + 用户可以使用此命令随时更改自己的口令。管理员可以使用该命令更改系统中任意用户的口令。 + + - ``su [option(s)] [username]`` + + 使用 ``su`` 命令可在当前正在运行的会话中以其它用户名登录。指定用户名及相应口令,以便使用该用户的环境。root 用户执行 ``su`` 命令时无需提供口令,因为 root 用户有权切换到任意用户。在未指定用户名的情况下使用该命令时,系统将提示您输入 root 用户口令并切换到 root 用户。 + + - ``clear`` + + 此命令用于清空控制台中的可见区域。该命令不带选项。 + diff --git a/source/系统管理.rst b/source/系统管理.rst new file mode 100644 index 0000000..0930e82 --- /dev/null +++ b/source/系统管理.rst @@ -0,0 +1,574 @@ +系统管理 +======== + +关闭或重新启动系统 +------------------ + +关闭系统 +~~~~~~~~ + +您可以在桌面环境下从主菜单中选择[关机],或者在终端中使用下列命令关闭凝思安全操作系统: + +:: + + $ shutdown -h now + +在系统使用过程中非正常关闭凝思安全操作系统可能造成系统损坏或数据丢失,因此,应该尽量避免这种情况的发生。 + +重启系统 +~~~~~~~~ + +您可以在桌面环境下从主菜单中选择[重启],或者在终端中使用下列命令重新启动凝思安全操作系统: + +:: + + $ shutdown -r now + +初始化设置 +---------- + +设备驱动模块配置 +~~~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/modules`` + +- 作用 + + 设置系统启动时的加载设备模块 + +- 参数设置 + + ``alias 设备号 模块`` + +- 例样 + + :: + + alias eth0 e100 + +profile 文件 +~~~~~~~~~~~~ + +- 路径 + + ``/etc/profile`` (对系统所有用户登录有效) + + ``~/.profile`` (对相应用户登录有效) + +- 作用 + + 设置系统所有用户或者单用户登录时运行的环境变量 + +- 例样 + + :: + + if [ "`id -u`" -eq 0 ]; then + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + else + PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" + fi + export PATH + + if [ "$PS1" ]; then + if [ "$BASH" ]; then + # The file bash.bashrc already sets the default PS1. + # PS1='\h:\w\$ ' + if [ -f /etc/bash.bashrc ]; then + . /etc/bash.bashrc + fi + else + if [ "`id -u`" -eq 0 ]; then + PS1='# ' + else + PS1='$ ' + fi + fi + fi + + :: + + if [ -d /etc/profile.d ]; then + for i in /etc/profile.d/*.sh; do + if [ -r $i ]; then + . $i + fi + done + unset i + fi + + :: + + alias ls= 'ls --color=auto' + alias l= 'ls -l' + alias la= 'ls -a' + umask 022 + +issue 文件 +~~~~~~~~~~ + +- 路径 + + ``/etc/issue`` + +- 作用 + + 系统登录时的欢迎界面 + +- 例样 + :: + + Linx Rocky 6.0 \n \l + +系统配置 +-------- + +.. _s2: + +fstab 文件 +~~~~~~~~~~ + +- 路径 + + ``/etc/fstab`` + +- 作用 + + 静态文件系统信息,包含系统磁盘分区以及存储设备如何挂载,以及挂载点等信息 + +- 参数设置 + + `` `` + + - ```` + + 要挂载的设备文件,包含设备文件所在路径及全名。 + + - ```` + + 设备的挂载点,包含挂载点的路径。 + + - ```` + + 设备的分区格式,如  ``ext2`` 、 ``ext3`` 、 ``xfs`` 、 ``jfs`` 、 ``iso9660`` 、 ``fat`` 、 ``swap`` 等。 + + - ```` + + 挂载设备时所要设定的状态,如  ``ro`` (只读)、 ``defaults`` (包括了其它参数如  ``rw、suid、exec、auto、nouser、async`` )等,默认为  ``defaults`` 。 + + - ```` + + 在系统 DUMP 时是否需要 BACKUP 的标志位,默认值是 0。 + + - ```` + + 设定此  ```` 是否要在开机时做 check 的动作,除了 ``/`` 的 ```` 其必要的 check 为 1 之外,其它皆可视需要设定,默认值是 0。 + +- 例样 + + :: + + # + proc /proc proc defaults 0 0 + sysfs /sys sysfs defaults 0 0 + devpts /dev/pts devpts defaults 0 0 + tmpfs /dev/shm tmpfs defaults 0 0 + /dev/sda1 swap swap defaults 0 0 + /dev/sda2 / ext3 defaults 1 1 + +inittab 文件 +~~~~~~~~~~~~ + +- 路径 + + ``/etc/inittab`` + +- 作用 + + 设置系统的启动参数 + +- 参数设置 + + ``id: runlevels: action: process`` + + - ``id`` + + ``inittab`` 文件中条目的唯一标识,限于 1-4 个字符。对于 ``getty`` 或其它的注册进程。id 必须是响应的终端线路的 tty 后缀,如 1 响应 tty1。 + + - ``runlevels`` + + 列出发生指定动作的运行级。 + + ``runlevels`` 域包含表示不同运行级的多个字符。例如 123 表示本进程在运行级为 1、2 和 3 时都要启动。用于 ``ondemand`` 条目的 ``runlevels`` 域可以包含 A、B 或 C。用于 ``sysinit`` 、 ``boot`` 和 ``bootwait`` 条目的 ``runlevels`` 域被忽略。 + + - ``action`` + + 描述要发生的动作。 + + ``action`` 域可以使用的动作有: + + - ``respawn`` + + 该进程只要终止就立即重新启动(如  ``getty`` )。 + + - ``wait`` + + 只要进入指定的运行级就启动本进程,并且  ``init`` 等待该进程的结束 + + - ``once`` + + 只要进入指定的运行级就启动一次本进程。 + + - ``boot`` + + 在系统引导期间执行本进程,此条目的  ``runlevels`` 域被忽略。 + + - ``bootwait`` + + 在系统引导期间执行本进程。并且  ``init`` 等待该进程的结束(如 ``/etc/rc`` )。此条目的  ``runlevels`` 域被忽略。 + + - ``off`` + + 什么也不做。 + + - ``ondemand`` + + 在进入  ``ondemand`` 运行级时才会执行标记为 ``ondemand`` 的那些进程。无论怎样,实际上没有改变运行级(``ondemand`` 运行级就是‘a’、‘b’、和‘c’)。 + + - ``initdefault`` + + ``initdefault`` 条目给出系统引导完成后进入的运行级,如果不存在这样的条目,``init`` 就会在控制台询问要进入的运行级。此条目的 ``process`` 域被忽略。 + + - ``sysinit`` + + 系统引导期间执行此进程,本进程会在  ``boot`` 或 ``bootwait`` 条目之前得到执行,此条目的 ``runlevels`` 域被忽略。 + + - ``powerwait`` + + 本进程在电源不足时执行,通常在有进程把 UPS 和计算机相连时通知  ``init`` 进程, ``init`` 在继续其它工作之前要等待此进程结束。 + + - ``powerfail`` + + 类似  ``powerwai`` t,但是  ``init`` 不等待此进程完成。 + + - ``powerokwait`` + + 在  ``init`` 收到电源已经恢复的通知后立即执行此进程。 + + - ``powerfailnow`` + + 本进程在  ``init`` 被告知 UPS 电源快耗尽同时外部电源失败(无效)时被执行。(假设 UPS 和监视进程能够发现这样的情况) + + - ``ctrlaltdel`` + + 在  ``init`` 收到 SIGINT 信号时执行此进程,这意味着有人在控制台按下了 :kbd:`Ctrl` - :kbd:`Alt` - :kbd:`Del` 组合键,典型地,可能是想执行类似 ``shutdown`` 然后进入单用户模式或重新引导机器。 + + - ``kbrequest`` + + 本进程在  ``init`` 收到一个从控制台键盘产生的特殊组合按键信号时执行。 + + - ``process`` + + 要执行的进程。 + +- 例样 + + :: + + id:5:initdefault: + + si::sysinit:/etc/rc.d/rc sysinit + + l0:0:wait:/etc/rc.d/rc 0 + l1:S1:wait:/etc/rc.d/rc 1 + l2:2:wait:/etc/rc.d/rc 2 + l3:3:wait:/etc/rc.d/rc 3 + l4:4:wait:/etc/rc.d/rc 4 + l5:5:wait:/etc/rc.d/rc 5 + l6:6:wait:/etc/rc.d/rc 6 + + ft:06:respawn:/sbin/sulogin + su:S1:respawn:/sbin/sulogin + + x:5:respawn:/usr/bin/kdm --nodaemon + + 1:2345:respawn:/sbin/agetty 38400 tty1 + 2:2345:respawn:/sbin/agetty 38400 tty2 + 3:2345:respawn:/sbin/agetty 38400 tty3 + 4:2345:respawn:/sbin/agetty 38400 tty4 + 5:2345:respawn:/sbin/agetty 38400 tty5 + 6:2345:respawn:/sbin/agetty 38400 tty6 + ~~:S:wait:/sbin/sulogin + +挂载和卸载 +---------- + + 只有 root 或授权管理员才能运行  ``mount`` 和 ``umount`` 命令来挂载和卸载。要使其他用户也能运行这些命令,需编辑 ``/etc/fstab`` 文件,为相应的设备指定选项 ``user`` ,即允许一般用户挂载该设备。 + +挂载 +~~~~ + +``mount [option(s)] [device] mountpoint`` + + 使用此命令可以将任意数据介质(如硬盘、CD-ROM 驱动器和其它设备)装入 Linux 文件系统的某个目录。 + +``-r`` 只读装入。 + +``-t filesystem`` + 指定文件系统,通常包括: ``ext2`` (表示 Linux 硬盘)、 ``msdos`` (表示 MS-DOS 介质)、 ``vfat`` (表示 Windows 文件系统)、 ``iso9660`` (表示 CD)。 + + 对于没有在  ``/etc/fstab`` 中定义的硬盘,还须同时指定设备类型。在这种情况下只能由系统管理员装入。如果其他用户也应该能够装入文件系统,则应在 ``/etc/fstab`` 文件的对应行中输入选项 ``user`` (用逗号分隔多个用户),并保存所做更改。 + +卸载 +~~~~ + +``umount [option(s)] mountpoint`` + + 此命令可用于从文件系统中卸载装入的驱动器。为防止数据丢失,请在将可移除的数据介质从其所在驱动器中移除之前运行此命令。 + +系统监控 +-------- + + 凝思安全操作系统默认自带系统监控工具gnome-system-monitor和xosview。 + + gnome-system-monitor和xosview分别可以从“应用程序——系统工具——系统监视器”和“应用程序——系统工具——Xosview”启动。 + +.. figure:: ./pic/monitor.png + :width: 40% + :alt: 系统监控工具 + + 系统监控工具 + + gnome-system-monitor界面,如  :numref:`Remote_7_1` 所示。 + +.. _Remote_7_1: +.. figure:: ./pic/gnome-system-monitor.png + :width: 65% + :alt: gnome-system-monitor + + gnome-system-monitor + + xosview界面,如 :numref:`Remote_7_2` 所示。 + +.. _Remote_7_2: +.. figure:: ./pic/xosview.png + :width: 40% + :alt: xosview + + xosview + +.. raw:: latex + + \newpage + +数据备份与恢复 +-------------- + +数据备份的重要性 +~~~~~~~~~~~~~~~~ + + 凝思安全操作系统是稳定而健壮的。但是任何操作系统都有可能遭遇到一些无法考虑到的特殊情况,比如认为误操作,电气故障,以及自然界不可抗等因素,最终导致系统中最珍贵的数据丢失。所以数据备份和恢复就显得非常重要。 + +工具名称 +~~~~~~~~ + + 凝思安全操作系统上的备份恢复工具可使用dump和restore。 + +工具安装 +~~~~~~~~ + + 光驱中插入凝思安全操作系统安装光盘,执行如下命令进行工具的安装: + +:: + + apt-get install dump + +备份与恢复策略 +~~~~~~~~~~~~~~ + +完全备份 +^^^^^^^^ + + 完全备份是完整地备份数据。 + + 完全备份的优点是当数据发生丢失时,可以恢复所有丢失的数据;缺点是重复地进行数据完整备份会占用大量的空间,而且备份时间也会较长。 + + 完全备份的示意图如 :numref:`Remote_7_4` 所示。 + +.. _Remote_7_4: +.. figure:: ./pic/backup1.png + :width: 60% + :alt: 完全备份示意图 + + 完全备份示意图 + +.. raw:: latex + + \newpage + +增量备份 +^^^^^^^^ + + 增量备份只能用于挂载了分区的目录。 + + 增量备份是在依次完全备份或上一次增量备份后,以后每次的备份只需备份与前一次相比增加或者被修改的文件。这意味着,第一次增量备份的对象是进行完全备份后产生的增加和修改的文件,后续的增量备份则是对前一次增量备份所产生的增加和修改的文件,增量备份级别为1-9。 + + 增量备份的优点是没有重复的备份数据,因此备份的数据量不大,备份所需的时间很短;缺点是增量备份的数据恢复比较麻烦,必须具有需要恢复的增量备份前面依赖的完全备份和增量备份(一旦丢失或者损坏其中任何一份,就会造成恢复失败),并且恢复是沿着完全备份到依次产生的增量备份按时间顺序进行恢复的,极大地延长了恢复时间。 + + 增量备份的示意图如 :numref:`Remote_7_5` 所示。 + +.. _Remote_7_5: +.. figure:: ./pic/backup2.png + :width: 60% + :alt: 增量备份示意图 + + 增量备份示意图 + +差异备份 +^^^^^^^^ + + 差异备份只能用于挂载了分区的目录。 + + 差异备份是以完全备份为基准的一种备份方式。例如,第一次对原数据进行完全备份,第二次的备份为原数据从第一次完全备份到第二次备份间的差异,原数据从第三次备份为第一次完全备份到第三次备份间的差异,依次类推。 + + 差异备份的优点是避免了以上两种备份策略的缺陷,同时由具备有两者的优点,无需每次都对系统做完全备份,因此备份数据量小,备份时间短,其次在恢复数据时也很方面,只需要两个备份,即第一次的完全备份和数据发生灾难前一次的差异备份即可。 + + 差异备份的示意图如 :numref:`Remote_7_6` 所示。 + +.. _Remote_7_6: +.. figure:: ./pic/backup3.png + :width: 60% + :alt: 差异备份示意图 + + 差异备份示意图 + +工具参数 +~~~~~~~~ + +.. table:: dump + + ======================= ====================================================================== + **命令格式** dump + [-选项中的备份级别][-选项][-f备份文件] 要备份的数据 + ======================= ====================================================================== + **命令选项** **选项解析** + -[0-9] 备份级别,普通备份使用0,分区备份中使用不 同的数字进行增量或差异备份。 + -S 后跟需要备份的文件,可以计算出备份需要的空间。 + -u 将本次备份时间记入档案,本选项不支持非分区挂载点。 + -v 显示详细执行信息。 + -j 加入bzip2支持,将内容进行压缩。 + -f 指定备份文件,也可以接设备文件如 \ ``/dev/st0`` 等 。 + -W 列出在 \ ``/etc/fstab`` 里具有dump设定的分区是否有进行过备份。 + ======================= ====================================================================== + + +.. table:: restore + + +-------------------------------------+--------------------------------+ + | **命令格式** | **命令解析** | + +-------------------------------------+--------------------------------+ + | restore -t [-f备份文件] | 查看备份文件信息 | + +-------------------------------------+--------------------------------+ + | restore -C [-f备份文件] [-D 挂载点] | 比较备份数据和挂载点数据的差别 | + +-------------------------------------+--------------------------------+ + | restore -i [-f备份文件] | 进入互动模式 | + +-------------------------------------+--------------------------------+ + | restore -r [-f备份文件] | 还原系统分区 | + +-------------------------------------+--------------------------------+ + +功能演示 +~~~~~~~~ + +#. 以不同策略对分区进行备份 + + ``/dev/sda6`` 的挂载目录为 ``/tmp/mountpoint`` ,要对该分区备份3次。 + + #. 采取完全备份 + + :: + + dump -0u -f /tmp/lv00.dmp /tmp/mountpoint + + 第一次完全备份,备份文件为  ``/tmp/lv00.dmp`` 。 + + :: + + dump -0u -f /tmp/lv02.dmp /tmp/mountpoint + + 第二次完全备份,备份文件为  ``/tmp/lv02.dmp`` 。 + + :: + + dump -0u -f /tmp/lv03.dmp /tmp/mountpoint + + 第三次完全备份,备份文件为  ``/tmp/lv03.dmp`` 。 + + #. 采取增量备份 + + :: + + dump -0u -f /tmp/lva0.dmp /tmp/mountpoint + + 第一次为完全备份,备份文件为  ``/tmp/lva0.dmp`` 。 + + :: + + dump -0u -f /tmp/lva1.dmp /tmp/mountpoint + + 基于第一次备份的增量备份,备份文件为  ``/tmp/lva1.dmp`` 。 + + :: + + dump -0u -f /tmp/lva2.dmp /tmp/mountpoint + + 基于前两次备份的增量备份,备份文件为  ``/tmp/lva2.dmp`` 。 + + #. 采取差异备份 + + :: + + dump -0u -f /tmp/lvd00.dmp /tmp/mountpoint + + 第一次为完全备份,备份文件为  ``/tmp/lvd00.dmp`` 。 + + :: + + dump -0u -f /tmp/lvd01.dmp /tmp/mountpoint + + 基于第一次备份的差异备份,备份文件为  ``/tmp/lvd01.dmp`` 。 + + :: + + dump -0u -f /tmp/lvd02.dmp /tmp/mountpoint + + 基于第二次备份的差异备份,备份文件为  ``/tmp/lvd02.dmp`` 。 + +#. 普通文件备份 + + :: + + dump -0 -f /tmp/bakfile /tmp/nmountpoint + + 把  ``/tmp/nmountpoint`` 完全备份到  ``/tmp/bakfile`` 。 + +#. 数据恢复 + + 查看备份内容: + + :: + + restore -tf /tmp/bakfile #查看备份文件bakfile中备份的文件 + + 通过备份文件交互式地完成数据恢复: + + :: + + restore -if /tmp/bakfile #进入交互模式,开始恢复bakfile备份的内容 + restore > help #在交互式命令行中输入help,查看恢复命令 + restore > cd /tmp #切换目录 + restore > add /nmountpoint #添加nmountpoint到恢复队列 + restore > extract #开始恢复 + restore > quit #退出交互 + diff --git a/source/网络管理.rst b/source/网络管理.rst new file mode 100644 index 0000000..802c0ee --- /dev/null +++ b/source/网络管理.rst @@ -0,0 +1,2753 @@ +网络管理 +======== + +网络参数配置 +------------ + +interfaces 文件 +~~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/network/interfaces`` + +- 作用 + + 设置网络接口参数。 + +- 例样 + + 下面是一个配置示例,它在一个网络接口中配置了两个静态 IP 地址: + + :: + + # This file describes the network interfaces available on your + # system and how to activate them. For more information, see + # interfaces(5). + + # The loopback interface + auto lo + iface lo inet loopback + + # The primary network interfaces + auto eth0 + iface eth0 inet static + address 192.168.1.1 + netmask 255.255.255.0 + network 192.168.1.0 + broadcast 192.168.1.255 + gateway 192.168.1.1 + + :: + + auto eth0:0 + iface eth0:0 inet static + address 192.168.1.2 + netmask 255.255.255.0 + network 192.168.1.0 + broadcast 192.168.1.255 + gateway 192.168.1.1 + + .. raw:: latex + + \vspace{1cm} + + 下面是一个从 DHCP 服务器自动获得 IP 地址的示例: + + :: + + # This file describes the network interfaces available on your + # system and how to activate them. For more information, see + # interfaces(5). + + # The loopback interface + auto lo + iface lo inet loopback + + # The primary network interfaces + allow-hotplug eth0 + iface eth0 inet dhcp + +resolv.conf 文件 +~~~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/resolv.conf`` + +- 作用 + + DNS 域名解析的配置文件。 + +- 参数设置 + + :: + + nameserver # 定义DNS服务器的IP地址 + domain # 定义本地域名 + search # 定义域名的搜索列表 + sortlist # 对返回的域名进行排序 + + 最主要是 ``nameserver`` 关键字,如果没指定 ``nameserver`` 找不到 DNS 服务器,其它关键字是可选的。 + +- 例样 + + :: + + nameserver 192.168.0.1 + domain linx-info.com + search www.linx-info.com + +hostname 文件 +~~~~~~~~~~~~~ + +- 路径 + + ``/etc/hostname`` + +- 作用 + + 记录本机的主机名。 + +- 例样 + + 该文件只有一行,如: + + :: + + Rocky + +services 文件 +~~~~~~~~~~~~~ + +- 路径 + + ``/etc/services`` + +- 作用 + + Internet 网络服务文件,记录网络服务名和它们对应使用的端口号及协议。文件中的每一行对应一种服务,它由4个字段组成,中间用 :kbd:`Tab` 或空格分隔,分别表示“服务名称”、“使用端口”、“协议名称”以及“别名”。 + +- 例样 + + 下面是这个文件的节选内容: + + :: + + tcpmux 1/tcp # TCP port service multiplexer + echo 7/tcp + echo 7/udp + discard 9/tcp sink null + discard 9/udp sink null + systat 11/tcp users + daytime 13/tcp + + :: + + daytime 13/udp + netstat 15/tcp + qotd 17/tcp quote + msp 18/tcp # message send protocol + msp 18/udp + chargen 19/tcp ttytst source + chargen 19/udp ttytst source + ftp-data 20/tcp + ftp 21/tcp + fsp 21/udp fspd + ssh 22/tcp # SSH Remote Login Protocol + ssh 22/udp + telnet 23/tcp + smtp 25/tcp mail + time 37/tcp timserver + +.. hint:: + + 一般情况下,不要修改该文件的内容,因为这些设置都是 Internet 标准的设置。一旦修改,可能会造成系统冲突,使用户无法正常访问资源。 + + Linxu 系统的端口号范围为 0~65535, 不同范围有不同的意义。 + + - 0 不使用 + + - 1 ~ 1023 系统保留,只能由root用户使用 + + - 1024 ~ 4999 由客户端程序自由分配 + + - 5000 ~ 65535 由服务器端程序自由分配 + +hosts.allow 文件 +~~~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/hosts.allow`` + +- 作用 + + 设置系统的外部连接许可 + +- 参数设置 + + ``: `` + + .. attention:: + hosts.all 优先级高于 hosts.deny + +- 例样 + + :: + + sshd : 192.168.0.0/255.255.255.0 + # 允许~192.168.0~网段的客户端通过~sshd~服务访问服务器 + +hosts.deny 文件 +~~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/hosts.deny`` + +- 作用 + + 设置系统的外部连接拒绝 + +- 参数设置 + + ``: `` + + 特殊参数与 \ ``hosts.allow`` 相同 + + .. attention:: + hosts.all 优先级高于 hosts.deny + +- 例样 + + :: + + ALL: ALL: DENY + +.. raw:: latex + + \vspace{1cm} + +.. attention:: + 为了保持系统的安全性,请尽量不要修改本文件,如需设置其他客户端通过服务访问本机,只需在 /etc/hoasts.allow 文件中设置允许即可。 + +host.conf 文件 +~~~~~~~~~~~~~~ + +- 路径 + + ``/etc/host.conf`` + +- 作用 + + 设置系统的配置信息。当系统中同时存在 DNS 域名解析和  ``/etc/hosts`` 主机表机制时,由 ``/etc/host.conf`` 确定主机名解释顺序。 + +- 参数设置 + + 文件包含了为解析库声明的配置信息,它应该每行含一个配置关键字,其后跟着合适的配置信息。 + + 系统识别的关键字有 ``order`` 、 ``trim`` 、 ``multi`` 、 ``nospoof`` 和 ``reorder`` 。 + + - ``order`` + + 确定了主机查询是如何执行的。它后面应该跟随一个或者更多的查询方式,这些查询方式用逗号分隔。有效的方式有: ``bind`` 、 ``hosts`` 和 ``nis`` 。 + + - ``trim`` + + 可以多次出现。每次出现其后应该跟随单个的以句点开头的域名。如果设置了它, ``resolver`` 库会自动截去任何通过 DNS 解析出来的主机名后面的域名。这个选项用于本地主机和域。 + + - ``multi`` + + 有效的值为  ``on`` 和 ``off`` 。如果设置为  ``on`` , ``resolver`` 库会返回一台主机在 ``/etc/hosts`` 文件中出现的的所有有效地址,而不只是第一个。默认情况下设为 ``off`` 。 + + - ``nospoof`` + + 有效的值为  ``on`` 和 ``off`` 。如果设置为  ``on`` , ``resolver`` 库会尝试阻止主机名欺骗以提高使用 ``rlogin`` 和 ``rsh`` 的安全性。在执行了一个主机地址的查询之后,``resolver`` 会对该地址执行一次主机名的查询;如果两者不匹配,查询即失败。 + + - ``spoofalert`` + + 如果该选项设为  ``on`` ,同时也设置了  ``nospoof`` 选项,``resolver`` 会通过 ``syslog`` 设施记录错误报警信息,默认的值为 ``off`` 。 + + - ``reorder`` + + 有效的值为  ``on`` 和 ``off`` 。如果设置为  ``on`` , ``resolver`` 会试图重新排列主机地址,以便执行 ``gethostbyname(3)`` 时,首先列出本地地址(即在同一子网中的地址),重新排序适合于所有查询方式,默认的值为 ``off`` 。 + +- 例样 + + :: + + order hosts,bind + multi on + +ifconfig 命令 +~~~~~~~~~~~~~ + +您还可以使用 ``ifconfig`` 命令来配置和查看网卡参数。 + +当有多块网卡时,系统中网卡命名规律:eth0,eth1,eth2……另外,lo 为环回接口,它的 IP 地址固定为 127.0.0.1,掩码 8 位。它代表你的机器本身。 + +#. 查看网卡信息 + + ``ifconfig [Interface]`` + + ``Interface`` 是可选项,如果不加此项,则显示系统中所有网卡的信息。如果添加此选项则显示所指定的网卡信息。 + + 如: + + :: + + $ ifconfig + eth0 Link encap:Ethernet HWaddr 00:11:D8:6D:C5:A1 + inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 + inet6 addr: fe80::211:d8ff:fe6d:c5a1/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:9771 errors:0 dropped:0 overruns:0 frame:0 + TX packets:8802 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:958022 (935.5 Kb) TX bytes:9606400 (9.1 Mb) + Interrupt:17 + + lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:824 errors:0 dropped:0 overruns:0 frame:0 + TX packets:824 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:374847 (366.0 Kb) TX bytes:374847 (366.0 Kb) + + - ``Link encap`` + + 连接类型, ``Ethernet`` 指以太网。 + + - ``HWaddr`` + + 硬件 mac 地址。 + + - ``inet addr`` + + 网卡的 IP 地址。 + + - ``Bcast`` + + 网卡的广播地址。 + + - ``Mask`` + + 网卡的子网掩码。 + + - ``inet6`` + + 网卡的 IPv6 地址。 + + - ``Scope`` + + 范围。 + + - ``UP BROADCAST RUNNING MULTICAST MTU:1500`` + + 接口的活动类型。 + + - ``UP`` 网卡开启状态 + + - ``BROADCAST`` 网卡支持广播 + + - ``RUNNING`` 网卡的网线被接上 + + - ``MULTICAST`` 网卡支持组播 + + - ``MTU:1500`` 最大传输单元为 1500 字节 + + - ``RX packets`` + + 接收数据包情况统计。 + + - ``TX packets`` + + 发送数据包情况统计。 + + - ``RX bytes`` + + 接收数据字节数统计信息。 + + - ``TX bytes`` + + 发送数据字节数统计信息。 + +#. 选项 + + 在 ``ifconfig`` 命令中可以指定许多选项以改变其行为: + + - ``-a`` + + 该选项告诉 ``ifconfig`` 显示所有接口信息,包括活动的和非活动的。 + + - ``-s`` + + 这是一个“短列表”选项,它为每个接口显示一行摘要数据。该返回信息是有关接口活动性的,并且没有配置。该输出和 ``netstat -i`` 命令的返回内容是一样的。 + + - ``-v`` + + 这个“详细的”选项在满足某些类型的错误条件时返回额外信息以帮助发现并处理故障。 + +#. 配置网卡参数 + + 除此之外,还有几个选项可以配置网卡参数。 + + - 配置网卡的 IP 地址 + + ``ifconifg [Interface] [addr]`` + + 只在接口名称后指定一个地址,将设置该接口的 IP 地址。 + + 如,在 eth0 上配置 192.168.0.1 的 IP 地址,使用以下命令: + + :: + + $ ifconfig eth0 192.168.0.1 + + 若想在 eth0 上再配置一个 192.168.1.1/24 的 IP 地址,使用以下命令: + + :: + + $ ifconfig eth0:0 192.168.1.1 + + 这时再用 ``ifconifg`` 命令查看,就可以看到两个网卡的信息了,分别为 eth0 和 eth0:0。若还想再增加 IP,那网卡的命名就接着是 eth0:1、eth0:2…… + + - 配置网卡的子网掩码 + + ``ifconifg [Interface] netmask [addr]`` + + 使用“``netmask``”选项使得你可以为一个给定接口设置网络掩码。 + + 如,在 eth0 上配置 24 位掩码,使用以下命令: + + :: + + $ ifconfig eth0 netmask 255.255.255.0 + + - 配置网卡的广播地址 + + ``ifconifg [Interface] broadcast [addr]`` + + 当“``broadcast``”选项后面跟随一个地址参数,那么将设置指定接口 + 的广播地址。 + + 如,在 eth0 上配置广播地址为 192.168.0.255,使用以下命令: + + :: + + $ ifconfig eth0 broadcast 192.168.0.255 + + - 配置网卡的硬件地址 + + :: + + $ ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx + + - 启用网卡 + + ``ifconfig [Interface] up`` + + 如果一个接口不是活动的,该选项将激活它。 + + 如,启动网卡 eth0: + + :: + + $ ifconfig eth0 up + + - 禁用网卡 + + ``ifconfig [Interface] down`` + + 与 ``up`` 相反,它使指定接口无效。 + + 如,禁用网卡 eth0: + + :: + + $ ifconfig eth0 down + +网络服务 +-------- + +凝思安全操作系统提供下列网络服务: + +- Apache + +- BIND + +- Samba + +- SSH + +- DHCP + +所有服务都通过适当修改和配置,充分发挥了凝思安全操作系统的安全机制,能够完全防止缓冲器溢出攻击,大大增强了网络服务的安全性。 + +#. 运行服务 + + 以管理员用户登录,对所有网络服务可以进行配置、启动、停止。各服务的启动脚本位于 ``/etc/init.d/`` 下。 + + #) 启动服务 + + 例如,要启动 apache2 服务,以管理员登录,执行命令: + + :: + + /etc/init.d/apache2 start + + #) 停止服务 + + 例如,要停止 apache2 服务,以管理员登录,执行命令: + + :: + + /etc/init.d/apache2 stop + +#. 设置开机自动启动 + + 下面以设置 apache2 服务开机自动启动为例。 + + 将 apache2 启动脚本复制到 ``/etc/init.d`` 目录下(一般安装软件时会自动装入,也可以手动复制),并命名为 apache2。 + + :: + + cp /usr/sbin/apachectl /etc/init.d/apache2 + + 查看系统的当前启动级别(系统默认为“N 2”)。 + + :: + + runlevels + + 进入系统开机启动级别(例如“N + 2”)目录,建立软件启动文件的符号链接。S 表示 start(启动),K 表示 kill(关闭),数字大小代表启动顺序的先后,数字大的启动顺序排在后面。 + + :: + + cd /etc/rc2.d + ln -s /etc/init.d/apache2 S20apache2 + + 这样,apache2 服务将在开机时自动启动。 + + + 您还可以使用 ``update-rc.d`` 命令设置启动级别: + + #. 从(所有的)运行级别配置目录中是删除指定的服务(K 和 S) + + :: + + update-rc.d -f remove + + #. 配置服务在运行级别列表中按指定的顺序启动 + + :: + + update-rc.d start + + #. 配置服务在运行级别列表中指定的顺序停止 + + :: + + update-rc.d stop `` + + 例如: + + :: + + $ update-rc.d -f apache2 remove + $ update-rc.d apache2 stop 91 0 1 2 3 4 5 6 . + (注意带着“.”) + + 第一个命令移除了所有的指向 ``/etc/init.d/apache2`` 服务脚本的运行级别链接,``-f`` 选项将会使得 ``update-rc.d`` 在 apache2 脚本本身已经存在的情况下仍然进行相应的处理。 + + 第二个命令在每一个运行级别创建了一个服务顺序为91的停止脚本。例如,这会创建一个 ``/etc/rc3.d/K91apache2`` 的符号链接来禁止运行级别3中 apache2 的运行。(这里要注意的是要添加 reboot 与 shutdown 运行级别,即0和6,尽管其中所有的服务都会被设置成为“stop”)。 + + 作为另外的一个例子,下面所显示的命令将会在运行级别3、4、5允许 apache2 的运行,而在其他的运行级别中则被禁止: + + :: + + $ update-rc.d -f apache2 remove + $ update-rc.d apache2 start 91 3 4 5 . stop 91 0 1 2 6 . + (注意带着“.”) + + .. hint:: + + 每个运行级别中,同一个服务的符号链接只能有一个要么 K 开头的要么 S 开头的,不能同时存在。 + +.. raw:: latex + + \vspace{1cm} + +下面逐一说明各个网络服务的配置。 + +Apache +~~~~~~ + +简介 +^^^^ + +Apache 服务用于实现 WEB 服务,它是 Internet 网上应用最为广泛的 Web 服务器软件之一。Apache 服务器源自美国国家超级技术计算应用中心(NCSA)的 Web 服务器项目中。目前已在互联网中占据了领导地位。Apache 服务器经过配置之后,能适应高负荷,大吞吐量的互联网工作。 + +配置文件 +^^^^^^^^ + +Apache 的主配置文件  ``apache2.conf`` 位于  `/etc/apache2`` 目录下,提供了最基本的服务器配置。这些配置文件控制着服务器各个方面的特性,因此,为了正常运行服务器便需要设置好这些文件。 + +除了配置文件之外,Apache 还使用  ``mime.types`` 文件用于标识不同文件对应的 MIME 类型,``magic`` 文件设置不同 MIME 类型文件的特殊标识,当 Apache 服务器从文档后缀不能判断出文件的 MIME 类型时,能通过文件内容中的这些特殊标记来判断文档的 MIME 类型。 + +在 ``apache2.conf`` 中引用到了以下文件: + +- 动态模块的配置: + + ``/etc/apache2/mods-enabled/*.load`` + + ``/etc/apache2/mods-enabled/*.conf`` + +- 用户自己的配置: + + ``/etc/apache2/httpd.conf`` + +- 端口监听的配置: + + ``/etc/apache2/ports.conf`` + +- 一般性的配置语句片断: + + ``/etc/apache2/conf.d/`` + +- 虚拟主机的配置指令: + + ``/etc/apache2/sites-enabled/`` + +配置文件参数 +^^^^^^^^^^^^ + +- ``ServerRoot “/usr”`` + + 安装服务器的基础目录。 + + 格式: ``ServerRoot directory-path`` + + ``ServerRoot`` 用于指定守护进程 httpd 的运行目录,httpd 启动之后会自动将进程的根目录改变为这个目录,因此如果设置文件中指定的文件或目录是相对路径,那么真实路径就位于这个 ``ServerRoot`` 定义的路径之下。 + +- ``Listen 80`` + + :: + + Listen 12.34.56.78:80 + + 服务器监听的 IP 地址和端口。 + + 格式: ``Listen [IP-address:]portnumber [protocol]`` + + ``Listen`` 指示 Apache 只在指定的 IP 地址和端口上监听;默认情况下 Apache 会在所有 IP 地址上监听。``Listen`` 是必须设置的。如果在配置文件中找不到这个参数,服务器将无法启动。如果只指定一个端口,服务器将在所有地址上监听该端口。如果指定了地址和端口的组合,服务器将在指定地址的指定端口上监听。 + + 使用多个  ``Listen`` 可以指定多个不同的监听端口和或地址端口组合。服务器将会对列出的所有端口和地址端口组合上的请求作出应答。 + + 例如,想要服务器接受 80 和 8000 端口上的请求,可以这样设置: + + :: + + Listen 80 + Listen 8000 + + 为了让服务器在两个确定的地址端口组合上接受请求,可以这样设置: + + :: + + Listen 192.170.2.1:80 + Listen 192.170.2.5:8000 + + IPv6 地址必须用方括号括起来: + + :: + + Listen [2001:db8::a00:20ff:fea7:ccea]:80 + + 可选的 protocol 参数在大多数情况下并不需要。若未指定该参数,则将为 443 端口使用默认的 https 协议,为其它端口使用 http 协议。在这里指定协议是为了确定使用哪个模块来处理请求,以及根据 AcceptFilter 根据不同的协议有针对性的进行优化。 + + 仅在使用非标准端口时才需要指定 protocol 参数。比如在 8443 端口运行 https 协议: + + :: + + Listen 192.170.2.1:8443 https + + .. raw:: latex + + \vspace{1ex} + + .. raw:: latex + + \setlength{\fboxsep}{10pt} + + .. raw:: latex + + \vspace{1em} + +- 模块 + + Apache 服务器的一个重要特性就是其模块化的结构,这不但表现在编译时能通过新的模块加入新的功能,还表现在运行时能动态加载入模块,而不必预先包含所有模块。使用 Apache 的动态加载模块只需要设置好  ``LoadModule`` 参数就可以了,这种特性就是 Apache 的 DSO(Dynamic + Shared + Object)特性,然而要想充分使用 DSO 特性仍然不是一个简单的事情,不适当的改动这里的设置就可能造成服务器不能正常启动。因此如果不是要增加或减少服务器提供的功能,就不要改动这里的设置。 + + 例如,编辑  ``/etc/apache2/httpd.conf`` 文件内容如下: + + :: + + LoadModule authn_file_module lib/apache2/modules/mod_authn_file.so + LoadModule authn_dbm_module lib/apache2/modules//mod_authn_dbm.so + LoadModule authn_anon_module lib/apache2/modules/mod_authn_anon.so + LoadModule authn_dbd_module lib/apache2/modules/mod_authn_dbd.so + LoadModule authn_default_module lib/apache2/modules/mod_authn_default.so + LoadModule authz_host_module lib/apache2/modules//mod_authz_host.so + LoadModule authz_groupfile_module lib/apache2/modules/mod_authz_groupfile.so + LoadModule authz_user_module lib/apache2/modules/mod_authz_user.so + LoadModule authz_dbm_module lib/apache2/modules/mod_authz_dbm.so + LoadModule authz_owner_module lib/apache2/modules/mod_authz_owner.so + LoadModule authz_default_module lib/apache2/modules/mod_authz_default.so + LoadModule auth_basic_module lib/apache2/modules/mod_auth_basic.so + LoadModule auth_digest_module lib/apache2/modules/mod_auth_digest.so + LoadModule dbd_module lib/apache2/modules/mod_dbd.so + LoadModule dumpio_module lib/apache2/modules/mod_dumpio.so + LoadModule ext_filter_module lib/apache2/modules/mod_ext_filter.so + LoadModule include_module lib/apache2/modules/mod_include.so + LoadModule filter_module lib/apache2/modules/mod_filter.so + LoadModule substitute_module lib/apache2/modules/mod_substitute.so + LoadModule deflate_module lib/apache2/modules/mod_deflate.so + LoadModule log_forensic_module lib/apache2/modules/mod_log_forensic.so + LoadModule env_module lib/apache2/modules/mod_env.so + LoadModule mime_magic_module lib/apache2/modules/mod_mime_magic.so + LoadModule cern_meta_module lib/apache2/modules/mod_cern_meta.so + LoadModule expires_module lib/apache2/modules/mod_expires.so + LoadModule headers_module lib/apache2/modules/mod_headers.so + LoadModule ident_module lib/apache2/modules/mod_ident.so + LoadModule usertrack_module lib/apache2/modules/mod_usertrack.so + LoadModule unique_id_module lib/apache2/modules/mod_unique_id.so + LoadModule setenvif_module lib/apache2/modules/mod_setenvif.so + LoadModule version_module lib/apache2/modules/mod_version.so + LoadModule ssl_module lib/apache2/modules/mod_ssl.so + LoadModule mime_module lib/apache2/modules/mod_mime.so + LoadModule dav_module lib/apache2/modules/mod_dav.so + LoadModule status_module lib/apache2/modules/mod_status.so + LoadModule autoindex_module lib/apache2/modules/mod_autoindex.so + LoadModule asis_module lib/apache2/modules/mod_asis.so + LoadModule info_module lib/apache2/modules/mod_info.so + LoadModule cgi_module lib/apache2/modules/mod_cgi.so + LoadModule dav_fs_module lib/apache2/modules/mod_dav_fs.so + LoadModule vhost_alias_module lib/apache2/modules/mod_vhost_alias.so + LoadModule negotiation_module lib/apache2/modules/mod_negotiation.so + LoadModule dir_module lib/apache2/modules/mod_dir.so + LoadModule imagemap_module lib/apache2/modules/mod_imagemap.so + LoadModule actions_module lib/apache2/modules/mod_actions.so + LoadModule speling_module lib/apache2/modules/mod_speling.so + LoadModule userdir_module lib/apache2/modules/mod_userdir.so + LoadModule alias_module lib/apache2/modules/mod_alias.so + LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so + + LoadModule php5_module lib/apache2/modules//libphp5.so + + + + 上面这些列表就显示了凝思安全操作系统中可以支持的模块,事实上很多模块是没有必要的,不必要的模块不会被载入内存。模块可以静态连接到 Apache 服务器内部,也可以动态加载,这样就以很小的性能的代价,带来极大的灵活性。 + + 但是动态可加载的能力还是对性能有轻微的影响,因此可以重新编译 Apache,将自己所需要的功能编译进 Apache 服务器内部,让系统显得更为干净,效率也有轻微的提高。通常仅仅为了这一个目的就重新编译 Apache 是没有必要的,如果需要增加其它特性而重新编译 Apache,不妨在增加其它模块的同时将所有的模块都静态连接入 Apache 服务器。有的使用者更喜欢动态加载模块,那么也不妨全部都使用动态加载模块。这些模块都被放置到  ``/usr/lib/apache2/modules/`` 目录下,每个模块对应 Apache 服务器的一个特性。 + +- ``User httpd`` + + ``Group httpd`` + + User 和 Group 配置是 Apache 的安全保证,Apache 在打开端口之后,就将其本身设置为这两个选项设置的用户和组权限进行运行,这样就降低了服务器的危险性。凝思安全操作系统通过能力机制允许任何用户在任何端口上(可以小于1024)运行 Apache。 + + Apache 的缺省设置为  ``nobody`` 和 ``nogroup`` ,这个用户和组在系统中不拥有文件,保证了服务器本身和由它启动的 CGI 进程没有权限更改文件系统。在某些情况下,例如为了运行 CGI 与 UNIX 交互,也需要让服务器来访问服务器上的文件,如果仍然使用  ``nobody`` 和 ``nogroup`` ,那么系统中将会出现属于  ``nobody`` 的文件,这对于系统安全是不利的,因为其它程序也会以 ``nobody`` 和 ``nogroup`` 的权限执行某些操作,就有可能访问这些 ``nobody`` 拥有的文件,造成安全问题。一般情况下要为 Web 服务设定一个特定的用户和组,同时在这里更改用户和组设置。凝思安全操作系统缺省的 Apache 用户和组是 httpd 和 httpd。 + +- ``ServerAdmin netadmin@localhost`` + + 配置文件中应该改变的也许只有  ``ServerAdmin`` ,这一项用于配置 WWW 服务器的管理员的 email 地址,这将在 HTTP 服务出现错误的条件下返回给浏览器,以便让 Web 使用者和管理员联系,报告错误。习惯上使用服务器上的 webmaster 作为 WWW 服务器的管理员,通过邮件服务器的别名机制,将发送给 webmaster 的电子邮件转发给真正的 Web 管理员。 + +- ``ServerName new.host.name:80`` + + 服务器用于辨识自己的主机名和端口号。 + + 格式: ``ServerName [scheme://]fully-qualified-domain-name[:port]`` + + ``ServerName`` 设置了服务器用于辨识自己的主机名和端口号。这主要用于创建重定向 URL。 + + 通常一个 Web 服务器可以具有多个名字,客户浏览器可以使用所有这些名字或 IP 地址访问这台服务器,但在没有定义虚拟主机的情况下,服务器总是以自己的正式名字回应浏览器。 ``ServerName`` 就定义了 Web 服务器自己承认的正式名字,例如一台服务器名字(在 DNS 中定义了 A 类型)为 exmaple.org.cn,同时为了方便记忆还定义了一个别名(CNAME 记录)为 www.exmaple.org.cn,那么 Apache 自动解析得到的名字就为 example.org.cn,这样不管客户浏览器使用哪个名字发送请求,服务器总是告诉客户程序自己为 example.org.cn。虽然这一般并不会造成什么问题,但是考虑到某一天服务器可能迁移到其它计算机上,而只想通过更改 DNS 中的 www 别名配置就完成迁移任务,所以不想让客户在其书签中使用 Linux 记录下这个服务器的地址,就必须使用 ``ServerName`` 来重新指定服务器的正式名字。 + + 当没有指定  ``ServerName`` 时,服务器会尝试对 IP 地址进行反向查询来推断主机名。但如果服务器的名字解析有问题(通常为反向解析不正确),或者没有正式的 DNS 名字,也可以在这里指定 IP 地址。当 ``ServerName`` 设置不正确的时候,服务器不能正常启动。如果在 ``ServerName`` 中没有指定端口号,服务器会使用接受请求的那个端口。为了加强可靠性和可预测性,您应该使用 ``ServerName`` 显式的指定一个主机名和端口号。 + + 如果使用的是基于域名的虚拟主机,在  ```` 段中的 ``ServerName`` 将是为了匹配这个虚拟主机,在“``Host:``”请求头中必须出现的主机名。 + +- ``DocumentRoot "/var/www/htdocs"`` + + ``DocumentRoot`` 定义这个服务器对外发布的超文本文档存放的路径,客户程序请求的 URL 就被映射为这个目录下的网页文件。这个目录下的子目录,以及使用符号连接指出的文件和目录都能被浏览器访问,只是要在 URL 上使用同样的相对目录名。 + + 注意,符号连接虽然逻辑上位于根文档目录之下,但实际上可以位于计算机上的任意目录中,因此可以使客户程序能访问那些根文档目录之外的目录,这在增加了灵活性的同时减少了安全性。Apache 在目录的访问控制中提供了 \ ``FollowSymLinks`` 选项来打开或关闭支持符号连接的特性。 + +- 文档访问控制 + + :: + + + Options FollowSymLinks + AllowOverride None + Order deny, allow + Deny from all + + + Apache 服务器可以针对目录进行文档的访问控制,然而访问控制可以通过两种方式来实现,一个是在设置文件  ``httpd.conf`` 中针对每个目录进行设置,另一个方法是在每个目录下设置访问控制文件,通常访问控制文件名字为  ``.htaccess`` 。虽然使用这两个方式都能用于控制浏览器的访问,然而第一种方法要求每次改动后重新启动 httpd 守护进程,比较不灵活,因此主要用于配置服务器系统的整体安全控制策略,而使用每个目录下的  ``.htaccess`` 文件设置具体目录的访问控制更为灵活方便。 + + ``Directory`` 语句就是用来定义目录的访问限制,这里可以看出它为一个目录定义访问限制的标准语法。上例的这个设置是针对系统的根目录进行的,设置了允许符号连接的选项 ``FollowSymLinks`` ,以及使用  ``AllowOverride None`` 表示不允许这个目录下的访问控制文件改变这里进行的配置,这也意味着不用查看这个目录下的相应访问控制文件。 + + 由于 Apache 对一个目录的访问控制设置是能够被下一级目录继承的,因此对根目录的设置将影响到它的下级目录。注意由于  ``AllowOverride None`` 的设置,使得 Apache 服务器不需要查看根目录下的访问控制文件,也不需要查看以下各级目录下的访问控制文件,直至 ``httpd.conf`` (或  ``access.conf`` )中为某个目录指定了允许  ``Alloworride`` ,即允许查看访问控制文件。由于 Apache 对目录访问控制是采用的继承方式,如果从根目录就允许查看访问控制文件,那么 Apache 就必须一级一级的查看访问控制文件,对系统性能会造成影响。而缺省关闭了根目录的这个特性,就使得 Apache 从  ``httpd.conf`` 中具体指定的目录向下搜寻,减少了搜寻的级数,增加了系统性能。因此对于系统根目录设置 ``AllowOverride None`` 不但对于系统安全有帮助,也有益于系统性能。 + +- 目录访问位置 + + :: + + + Options Indexes FollowSymLinks + AllowOverride None + Order allow, deny + Allow from all + + + 这里定义的是系统对外发布文档的目录的访问设置,设置不同的  ``AllowOverride`` 选项,以定义配置文件中的目录设置和用户目录下的安全控制文件的关系,而 ``Options`` 选项用于定义该目录的特性。 + + #. ``AllowOverride`` 的设置 + + 对每个目录访问控制文件作用的影响。 + + 配置文件和每个目录下的访问控制文件都可以设置访问限制,设置文件是由管理员设置的,而每个目录下的访问控制文件是由目录的属主设置的,因此管理员可以规定目录的属主是否能覆盖系统在设置文件中的设置,这就需要使用  ``AllowOverride`` 参数进行设置,通常可以设置的值为: + + - ``All`` + + 缺省值,使访问控制文件可以覆盖系统配置。 + + - ``None`` + + 服务器忽略访问控制文件的设置。 + + - ``Options`` + + 允许访问控制文件中可以使用  ``Options`` 参数定义目录的选项。 + + - ``FileInfo`` + + 允许访问控制文件中可以使用  ``AddType`` 等参数设置。 + + - ``AuthConfig`` + + 允许访问控制文件使用  ``AuthName`` , ``AuthType`` 等针对每个用户的认证机制,这使目录属主能用口令和用户名保护目录。 + + - ``Limit`` + + 允许对访问目录的客户机的IP地址和名字进行限制。 + + #. ``Options`` 的设置 + + 服务器特性设置。 + + 每个目录具备一定属性,可以使用  ``Options`` 来控制这个目录下的一些访问特性设置,以下为常用的特性选项: + + - ``All`` + + 所有的目录特性都有效,这是缺省状态。 + + - ``None`` + + 所有的目录特性都无效。 + + - ``FollowSymLinks`` + + 允许使用符号连接,这将使浏览器有可能访问文档根目录(DocumentRoot)之外的文档。 + + - ``SymLinksIfOwnerMatch`` + + 只有符号连接的目的与符号连接本身为同一用户所拥有时,才允许访问,这个设置将增加一些安全性。 + + - ``ExecCGI`` + + 允许这个目录下可以执行 CGI 程序。 + + - ``Indexes`` + + 允许浏览器可以生成这个目录下所有文件的索引,使得在这个目录下没有  ``index.html`` (或其它索引文件)时,能向浏览器发送这个目录下的文件列表。 + + 此外,上例中还使用了  ``Order`` , ``Allow`` , ``Deny`` 等参数,这是 ``Limit`` 语句中用来根据浏览器的域名和 IP 地址来控制访问的一种方式。其中 ``Order`` 定义处理 ``Allow`` 和 ``Deny`` 的顺序,而 ``Allow`` , ``Deny`` 则针对名字或IP进行访问控制设置,上例使用 ``allowfrom all`` ,表示允许所有的客户机访问这个目录,而不进行任何限制。 + +- + + DirectoryIndex index.html + + + + 很多情况下,URL 中并没有指定文档的名字,而只是给出了一个目录名。那么 Apache 服务器就自动返回这个目录下由  ``DirectoryIndex`` 定义的文件,当然可以指定多个文件名字,系统会在这个目录下顺序搜索。当所有由 ``DirectoryIndex`` 指定的文件都不存在时,Apache 服务器可以根据系统设置,生成这个目录下的所有文件列表,提供用户选择。此时该目录的访问控制选项中的 ``Indexes`` 选项(``Options Indexes`` )必须打开,使得服务器能够生成目录列表,否则 Apache 将拒绝访问。 + +- ``AccessFileName .htaccess`` + + ``AccessFileName`` 定义每个目录下的访问控制文件的文件名,缺省为 ``.htaccess`` ,可以通过更改这个文件,来改变不同目录的访问控制限制。 + + :: + + + Order allow,deny + Deny from all + Satisfy All + + + 除了可以针对目录进行访问控制之外,还可以根据文件来设置访问控制,这就是  ``File`` 语句的任务。使用 ``File`` 语句,不管文件处于哪个目录,只要名字匹配,就必须接受相应的访问控制。这个语句对于系统安全比较重要,例如上例将屏蔽所有的使用者不能访问 ``.htaccess`` 文件,这样  ``.htaccess`` 中的安全信息就不能被客户获取。 + +- 日志记录 + + :: + + ErrorLog "/var/log/apache2/error_log" + LogLevel warn + + + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" + combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" + %I %O" combinedio + + + CustomLog "/var/log/apache2/access_log" common + + + 这里定义了系统日志的形式。对于服务器错误记录,由  ``ErrorLog`` 指定记录错误日志的文件,``LogLevel`` 指定要记录的内容。 + + 对于系统的访问日志,缺省使用  ``CustomLog`` 参数定义日志的位置。可以使用 ``combined`` 参数指定将所有的访问日志放在一个文件中,也可以将不同种类的访问日志放在不同的日志记录文件中,这是通过在 ``CustomLog`` 中指定不同的记录类型来完成的。 + + - ``common`` 表示普通的对单页面请求访问记录; + + - ``referer`` 表示每个页面的引用记录,可以看出一个页面中包含的请求数; + + - ``agent`` 表示对客户机的类型记录。 + + 显然可以将现有的  ``combined`` 定义的设置行注释掉,并使用 ``common`` 、 ``referer`` 和 ``agent`` 作为 ``CustomLog`` 的参数,来为不同种类的日志分别指定日志记录文件。 + + 显然, ``LogFormat`` 是用于定义不同类型的日志进行记录时使用的格式,这里使用了以 % 开头的宏定义,以记录不同的内容。如果这些参数指定的文件使用的是相对路径,那么就是相对于 ``ServerRoot`` 的路径。 + +- 别名映射 + + :: + + + Alias /test "/var/www/htdocs/test" + + Options Indexes MultiViews + AllowOverride AuthConfig + Order allow,deny + Allow from all + + + ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" + + + + AllowOverride None + Options None + Order allow,deny + Allow from all + + + ``Alias`` 用于将 URL 与服务器文件系统中的真实位置进行直接映射,一般的文档将在 ``DocumentRoot`` 中进行查询,然而使用 ``Alias`` 定义的路径将直接映射到相应目录下,而不再到 ``DocumentRoot`` 下面进行查询。因此 ``Alias`` 可以用来映射一些公用文件的路径,例如保存了各种常用图标的 ``icons`` 路径。这样使得除了使用符号连接之外,文档根目录( ``DocumentRoot`` )外的目录也可以通过使用了 ``Alias`` 映射,提供给浏览器访问。 + + 定义好映射的路径之后,应该需要使用 ``Directory`` 语句设置访问限制。 + + ``ScriptAlias`` 也是用于 URL 路径的映射,但与 ``Alias`` 的不同在于,``ScriptAlias`` 是用于映射 CGI 程序的路径,这个路径下的文件都被定义为 CGI 程序,通过执行它们获得结果,而不是由服务器直接返回其内容。缺省情况下 CGI 程序使用 ``cgi-bin`` 目录作为虚拟路径。 + +- ``DefaultType text/plain`` + + 如果 Web 服务器不能决定一个文档的缺省类型,这通常表示文档使用了非标准的后缀,那么服务器就使用  ``DefaultType`` 定义的 MIME 类型将文档发送给客户浏览器。这里的设置为 ``text/plain`` ,这样设置的问题是,如果服务器不能判断出文档的 MIME,那么大部分情况下这个文档为一个二进制文档,但使用  ``text/plain`` 格式发送回去,浏览器将在内部打开它而不会提示保存。因此建议将这个设置更改为 ``application/octet-stream`` ,这样浏览器将提示用户进行保存。 + +- MIME 文件 + + :: + + + TypesConfig /etc/mime.types + + #AddType application/x-gzip .tgz + + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + + #AddHandler cgi-script .cgi + + #AddHandler type-map var + + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + + + ``TypeConfig`` 用于设置保存不同的MIME类型数据的文件名,缺省设置为 ``/etc/mime.types`` 。 + + ``AddEncoding`` + + ``AddType`` 可以为特定后缀的文件指定 MIME 类型,这里的设置将覆盖 ``mime.types`` 中的设置。 + + ``AddHandler`` 是用于指定非静态的处理类型,用于定义文档为一个非静态的文档类型,需要进行处理,再向浏览器返回处理结果。例如上面注释中的设置是将以 ``.cgi`` 结尾的文件设置为 ``cgi-script`` 类型,那么服务器将启动这个 CGI 程序以进行处理。如果需要在前面 ``AliasScript`` 定义的路径之外执行 CGI 程序,就需要使用这个参数进行设置,此后以 ``.cgi`` 结尾的文件将被当作 CGI 程序执行。 + + ``AddOutputFilter`` + +- + + MIMEMagicFile /etc/apache2/magic + + + + 除了从文件的后缀出发来判断文件的 MIME 类型之外,Apache 还可以进一步分析文件的一些特征,来判断文件的真实 MIME 类型。这个功能是由 \ ``mod_mime_magic`` 模块实现的,它需要一个记录各种 MIME 类型特征的文件,以进行分析判断。上面的设置是一个条件语句,如果载入了这个模块,就必须指定相应的标志文件 ``magic`` 的位置。 + +- 错误代码 + + :: + + #ErrorDocument 500 "The server made a boo boo." + #ErrorDocument 404 /missing.html + #ErrorDocument 404 /cgi-bin/missing_handler.pl + #ErrorDocument 402 http://some.other_server.com/subscription_info.html + + 如果客户请求的网页不存在,或者没有访问权限等情况发生时,服务器将产生一个错误代码,同时也将回应客户浏览器一个标识错误的网页。 + + ``ErrorDocument`` 就用于设置当出现哪个错误时应该回应客户浏览器哪些内容,``ErrorDocument`` 的第一个参数为错误的序号,第二个参数为回应的数据,可以为简单的文本,本地网页,本地 CGI 程序,以及远程主机上的网页。 + +- ``Include`` + + 在服务器配置文件中包含其它配置文件。 + + 格式: ``Include file-path|directory-path`` + + 这个参数允许在服务器配置文件中加入其它配置文件。 + + Shell 风格( ``fnmatch()`` )的通配符可以用于按照字母顺序一次包含多个文件。另外,如果  ``Include`` 指向了一个目录而不是一个文件,Apache 将读入该目录及其子目录下的所有文件,并依照字母顺序将这些文件作为配置文件进行解析。但是并不推荐这么做,因为偶尔会有临时文件在这个目录中生成,从而导致 httpd 启动失败。 + + 文件的路径可以是一个完整的绝对路径(以一个斜杠开头),如: + + :: + + Include /etc/apache2/mods-available/ssl.conf + Include /etc/apache2/mods-enabled/*.conf + + 或是相对于  ``ServerRoot`` 目录(假设为 ``/etc/apache2/`` )的相对路径,如: + + :: + + Include mods-available/ssl.conf + Include mods-enabled/*.conf + + 请确保包含的目录中不包含任何诸如编辑器临时文件等引起误导的文件,因为 Apache 会尝试读取它们并把其中的内容作为配置参数来处理,这样可能会导致启动过程的失败。运行  ``apachectl configtest`` 将会把配置检查时所使用的所有文件列出来以供参考。这将有助于检验配置中是否仅包含了您所希望出现那些文件。 + + 这个参数  ``Include`` 可用于与使用 ``srm.conf`` 和 ``access.conf`` 设置文件的老版本 Apache 兼容。如果没有兼容的需要,可以将设置文件指定为  ``/dev/null`` ,即 ``Include /dev/null`` ,这将表示不存在其它设置文件,而仅使用  ``apache2.conf`` 一个文件来保存所有的设置选项。 + +- ``PidFile "/var/run/apache2/httpd.pid"`` + + ``PidFile`` 指定的文件将记录 httpd 守护进程的进程号,由于 httpd 能自动复制其自身,因此系统中有多个 httpd 进程,但只有一个进程为最初启动的进程,它为其它进程的父进程,对这个进程发送信号将影响所有的 httpd 进程。``PidFILE`` 定义的文件中就记录 httpd 父进程的进程号。 + +- ``LockFile "/var/log/apache2/accept.lock"`` + + 接受串行锁文件的位置。 + + 由于 httpd 会经常进行并发的文件操作,就需要使用加锁的方式来保证文件操作不冲突,由于 NFS 文件系统在文件加锁方面能力有限,因此这个目录应该是本地磁盘文件系统,而不应该使用 NFS 文件系统。 + + ``LockFile`` 指定了 httpd 守护进程的加锁文件,一般不需要设置这个参数,Apache 服务器将自动在 ``ServerRoot`` 下面的路径中进行操作。但如果 ``ServerRoot`` 为 NFS 文件系统,便需要使用这个参数指定本地文件系统中的路径。 + + .. important:: + + 最好不要将此文件放在任何人都可以具有写权限的目录(比如/var/tmp)中,因为别人可以通过建立一个与服务器企图建立的锁文件同名的文件,来阻止服务器启动,从而造成一个拒绝服务攻击。 + +- ``StartServers 5`` + + ``StartServers`` 就是用来设置 httpd 启动时产生的子进程副本数量,这个参数与上面定义的 ``MinSpareServers`` 和 ``MaxSpareServers`` 相关,都是用于启动空闲子进程以提高服务器的反应速度的。这个参数应该设置为前两个值之间的一个数值,小于 ``MinSpareServers`` 和大于 ``MaxSpareServers`` 都没有意义。 + +- ``MinSpareServers 5`` + + ``MaxSpareServers 10`` + + 在使用子进程处理 HTTP 请求的 Web 服务器上,由于要首先生成子进程才能处理客户的请求,因此反应时间就有一些延迟。Apache 服务器使用了一个特殊技术解决这个问题,这就是预先生成多个空余的子进程驻留在系统中,一旦有请求出现,就立即使用这些空余的子进程进行处理,这样就不存在生成子进程造成的延迟了。在运行中随着客户请求的增多,启动的子进程会随之增多,但这些服务器副本在处理完一次 HTTP 请求之后并不立即退出,而是停留在计算机中等待下次请求。但是空余的子进程副本不能只增加不减少,太多的空余子进程没有处理任务,也占用服务器的处理能力,因此就要限制空余副本的数量,使其保持一个合适的范围,这样既能及时回应客户请求,又能减少不必要的进程数量。 + + 因此就可以使用 \ ``MinSpareServers`` 来设置最少的空余子进程数量,以及使用 ``MaxSpareServers`` 来限制最多的空闲子进程数量,多余的服务器进程副本就会退出。根据服务器的实际情况来进行设置,如果服务器性能较高,并且也被频繁访问,就应该增大这两个参数的设置。对于高负载的专业网站,这两个值应该大致相同,并且等同于系统支持的最多服务器副本数量,也减少不必要的副本退出。 + +- ``MaxClients 150`` + + 在另一方面,服务器的能力毕竟是有限的,不可能同时处理无限多的连接请求,因此 ``Maxclients`` 就用于规定服务器支持的最多并发访问的客户数,如果这个值设置得过大,系统在繁忙时不得不在过多的进程之间进行切换,这样就会减慢对每个客户的反应,并降低了整体的效率。如果这个值设置的较小,那么系统繁忙时就会拒绝一些客户的连接请求,并将其放入请求队列。当服务器性能较高时,就可以适当增加这个值的设置。对于专业网站,应该使用提高服务器效率的策略,因此这个参数不能超过硬件本身的限制,如果频繁出现拒绝访问现象,就说明需要升级服务器硬件了。对于非专业网站,不太在意对客户浏览器的反应速度,或者认为反应速度较慢也比拒绝连接好,就也可以略微超过硬件条件来设置这个参数。 + +- ``MaxRequestsPerChild 30`` + + 使用子进程的方式提供服务的 Web 服务器,常用的方式是一个子进程为一次连接服务,这样造成的问题就是每次连接都需要进行生成和退出子进程的系统操作,使得这些额外的处理过程占据了计算机的大量处理能力。因此最好的方式是一个子进程可以为多次连接请求服务,这样就不需要这些生成和退出进程的系统消耗,Apache 就采用了这样的方式,一次连接结束后,子进程并不退出,而是停留在系统中等待下一次服务请求,这样就极大的提高了性能。 + + 但由于在处理过程中子进程要不断的申请和释放内存,次数多了就会造成一些内存垃圾,从而影响系统的稳定性,浪费不必要的系统资源。因此在一个副本处理过一定次数的请求之后,就可以让这个子进程副本退出,再从原始的 httpd 进程中重新复制一个干净的副本,这样就能提高系统的稳定性。每个子进程处理服务请求次数由 \ ``MaxRequestPerChild`` 定义。缺省的设置值为30,这个值对于具备高稳定性特点的 Linux 系统来讲是过于保守的设置,可以设置为 1000 甚至更高,设置为 0 支持每个副本进行无限次的服务处理。 + +- 索引和图标 + + :: + + IndexOptions FancyIndexing HTMLTable VersionSort + + Alias /icons/ "/var/www/icons/" + + + Options Indexes MultiViews + AllowOverride None + Order allow,deny + Allow from all + + + AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip + + AddIconByType (TXT,/icons/text.gif) text/* + AddIconByType (IMG,/icons/image2.gif) image/* + AddIconByType (SND,/icons/sound2.gif) audio/* + AddIconByType (VID,/icons/movie.gif) video/* + + AddIcon /icons/binary.gif .bin .exe + AddIcon /icons/binhex.gif .hqx + AddIcon /icons/tar.gif .tar + AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv + AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip + AddIcon /icons/a.gif .ps .ai .eps + AddIcon /icons/layout.gif .html .shtml .htm .pdf + AddIcon /icons/text.gif .txt + AddIcon /icons/c.gif .c + AddIcon /icons/p.gif .pl .py + AddIcon /icons/f.gif .for + AddIcon /icons/dvi.gif .dvi + AddIcon /icons/uuencoded.gif .uu + AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl + AddIcon /icons/tex.gif .tex + AddIcon /icons/bomb.gif core + + AddIcon /icons/back.gif .. + AddIcon /icons/hand.right.gif README + AddIcon /icons/folder.gif ^^DIRECTORY^^ + AddIcon /icons/blank.gif ^^BLANKICON^^ + + DefaultIcon /icons/unknown.gif + + #AddDescription "GZIP compressed document" .gz + #AddDescription "tar archive" .tar + #AddDescription "GZIP compressed tar archive" .tgz + + ReadmeName README.html + HeaderName HEADER.html + + IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t + + 当一个 HTTP 请求的 URL 为一个目录的时候,服务器返回这个目录中的索引文件。但如果一个目录中不存在缺省的索引文件,并且该服务器又许可显示目录文件列表的时候,就会显示出这个目录中的文件列表,为了使得这个文件列表能具有可理解性,而不仅仅是一个简单的列表,就需要前面的这些设置参数。 + + 如果使用了  ``IndexOptions FancyIndexing`` 选项,可以让服务器产生的目录列表中针对各种不同类型的文档引用各种图标。而哪种文件使用哪种图标,则使用下面的 ``AddIconByEncoding`` ,  ``AddIconByType`` 以及 ``AddIcon`` 来定义,分别依据 MIME 的编码,类型以及文件的后缀来判断使用何种图标。如果不能确定文档使用的图标,就使用 ``DefaultIcon`` 定义的缺省图标。 + + 同样,使用  ``AddDescription`` 可以为不同类型的文档加入不同的描述。服务器还在目录下,查询使用 ``ReadmeName`` 和 ``HeaderName`` 定义的文件(自动加上 ``.html`` 后缀,如果没有发现,再使用 ``.txt`` 后缀进行搜索),如果发现了这些文件,就在文件列表之前首先显示这些文件的内容,以使得普通目录列表具备更大的可理解性。 + + ``IndexIgnore`` 让服务器在列出文件列表时忽略相应的文件, + 这里使用模式配置的方式定义文件名。 + +- 语言设置 + + :: + + AddLanguage ca .ca + AddLanguage cs .cz .cs + AddLanguage da .dk + AddLanguage de .de + AddLanguage el .el + AddLanguage en .en + AddLanguage eo .eo + AddLanguage es .es + AddLanguage et .et + AddLanguage fr .fr + AddLanguage he .he + AddLanguage hr .hr + AddLanguage it .it + AddLanguage ja .ja + AddLanguage ko .ko + AddLanguage ltz .ltz + AddLanguage nl .nl + AddLanguage nn .nn + AddLanguage no .no + AddLanguage pl .po + AddLanguage pt .pt + AddLanguage pt-BR .pt-br + AddLanguage ru .ru + AddLanguage sv .sv + AddLanguage tr .tr + AddLanguage zh-CN .zh-cn + AddLanguage zh-TW .zh-tw + + LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl + nn no pl pt pt-BR ru sv tr zh-CN zh-TW + + ForceLanguagePriority Prefer Fallback + + AddCharset us-ascii.ascii .us-ascii + AddCharset ISO-8859-1 .iso8859-1 .latin1 + AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen + AddCharset ISO-8859-3 .iso8859-3 .latin3 + AddCharset ISO-8859-4 .iso8859-4 .latin4 + AddCharset ISO-8859-5 .iso8859-5 .cyr .iso-ru + AddCharset ISO-8859-6 .iso8859-6 .arb .arabic + AddCharset ISO-8859-7 .iso8859-7 .grk .greek + AddCharset ISO-8859-8 .iso8859-8 .heb .hebrew + AddCharset ISO-8859-9 .iso8859-9 .latin5 .trk + AddCharset ISO-8859-10 .iso8859-10 .latin6 + AddCharset ISO-8859-13 .iso8859-13 + AddCharset ISO-8859-14 .iso8859-14 .latin8 + AddCharset ISO-8859-15 .iso8859-15 .latin9 + AddCharset ISO-8859-16 .iso8859-16 .latin10 + AddCharset ISO-2022-JP .iso2022-jp .jis + AddCharset ISO-2022-KR .iso2022-kr .kis + AddCharset ISO-2022-CN .iso2022-cn .cis + AddCharset Big5.Big5 .big5 .b5 + AddCharset cn-Big5 .cn-big5 + + AddCharset WINDOWS-1251 .cp-1251 .win-1251 + AddCharset CP866 .cp866 + AddCharset KOI8 .koi8 + AddCharset KOI8-E .koi8-e + AddCharset KOI8-r .koi8-r .koi8-ru + AddCharset KOI8-U .koi8-u + AddCharset KOI8-ru .koi8-uk .ua + AddCharset ISO-10646-UCS-2 .ucs2 + AddCharset ISO-10646-UCS-4 .ucs4 + AddCharset UTF-7 .utf7 + AddCharset UTF-8 .utf8 + AddCharset UTF-16 .utf16 + AddCharset UTF-16BE .utf16be + AddCharset UTF-16LE .utf16le + AddCharset UTF-32 .utf32 + AddCharset UTF-32BE .utf32be + AddCharset UTF-32LE .utf32le + AddCharset euc-cn .euc-cn + AddCharset euc-gb .euc-gb + AddCharset euc-jp .euc-jp + AddCharset euc-kr .euc-kr + AddCharset EUC-TW .euc-tw + AddCharset gb2312 .gb2312 .gb + AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2 + AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4 + AddCharset shift_jis .shift_jis .sjis + + ``AddLanguage`` 在文件扩展名与特定的语言之间建立映射。定义以 ``extension`` 为扩展名的文件是以 MIME-lang 语言写成的。这个映射关系会添加在所有有效的映射关系上,并覆盖所有相同的 ``extension`` 扩展名映射。虽然内容的语言会返回给客户端,但浏览器一般未必会使用这一信息。``AddLanguage`` 更多的用于内容协商,以决定哪个文档应当被返回给用户。如果同一个扩展名被赋予多个语言,那么使用最后出现的那个。 + + 在处理 \ ``MultiViews`` 请求时,``LanguagePriority`` 在客户没有指示语言偏爱的情况下,设定语言变体的优先级列表。这个 MIME-lang 列表是按优先级降序排列的。 + + .. attention:: + + 本参数只在根据其它信息无法决定最好的语言或者 ForceLanguagePriority 不是 None 时才有效。对正确实现的 HTTP/1.1 请求,本参数没有任何作用。 + + ``ForceLanguagePriority`` 使用 ``LanguagePriority`` 的设置,在服务器无法返回单个匹配文档的情况下,指定完成协商过程的方法。``ForceLanguagePriority Prefer`` 在有几个等价选择的情况下,使用 ``LanguagePriority`` 的设定以提供一个有效的结果,而不是返回 HTTP 结果 300(多重选择)。``ForceLanguagePriority Fallback`` 使用 ``LanguagePriority`` 在无法找到合适结果的情况下,指定一个有效的结果,而不是返回 HTTP 结果 406(不可接受)。``Prefer`` 和 ``Fallback`` 两个选项可以同时指定,这样在有一个以上有效变体的情况下,返回 ``LanguagePriority`` 列表中第一个匹配的变体文档,而在没有变体能够匹配客户可接受的语言的情况下,返回第一个可用的变体文档。 + + ``AddCharset`` 在特定的文件扩展名与特定的字符集之间建立映射。``charset`` 是以 ``extension`` 为扩展名的文件的MIME字符集参数。这个映射关系会强制添加在所有现存的映射关系上,并覆盖所有现存的 ``extension`` 扩展名映射。``AddCharset`` 除了用于通知客户端文档的字符集编码方式以便正确地翻译和显示以外,还用于内容协商(根据用户的优先选择信息,从几个文档中选择一个返回给用户)。``extension`` 参数是大小写无关的,并且可以带或不带前导点。 + +- 多用户主页设置 + + ``UserDir public_html`` + + 当在一台 Linux 上运行 Apache 服务器时,这台计算机上的所有用户都可以有自己的网页路径,形如 http://example.org.cn/~user,使用波浪符号加上用户名就可以映射到用户自己的网页目录上。映射目录为用户个人主目录下的一个子目录,其名字就用 \ ``UseDir`` 这个参数进行定义,缺省为 ``public_html``\ 。如果不想为正式的用户提供网页服务,使用 \ ``DISABLED`` 作 ``UserDir`` 的参数即可。 + +- + + AllowOverride FileInfo AuthConfig Limit Indexes + + Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec + + + + Order allow, deny + + Allow from all + + + + + + Order deny, allow + + Deny from all + + + + + + 这里可以看到  ``Directory`` 的另一个用法,即可以通过简单的模式匹配方法,针对分布在不同目录下的子目录定义访问控制权限。这样设置需要 Apache 服务器对每个路径进行额外的处理,因此就会降低服务器的性能,所以缺省情况并没有打开这种访问限制。 + + 这里可以看到另外一个语句  ``Limit`` , ``Limit`` 语句就是用来针对具体的请求方法来设定访问控制的,其中可以使用 ``GET`` , ``POST`` 等各种服务器支持的请求方法做 ``Limit`` 的参数,设定不同请求方法的访问限制。一般可以打开对 ``GET`` , ``POST`` ,  ``HEAD`` 三种请求方法,而屏蔽其它的请求方法,以增加安全性。 ``Limit`` 语句中,可以用 ``Order`` 、 ``Allow`` 、 ``Deny`` , ``Allow`` 和 ``Deny`` 中可以使用匹配的方法针对域名和 IP 进行限制,只是对于域名是从后向前匹配,对于 IP 地址则从前向后匹配。 + +- 访问控制 + + :: + + + SetHandler server-status + Order deny, allow + Deny from all + Allow from .your_domain.com + + + + SetHandler server-info + Order deny,allow + Deny from all + Allow from .your_domain.com + + + 用于设置访问控制的设置主要是针对目录和文件进行设置的,然而也可以针对不同的 URL 进行访问控制的设置,这样就不必担心 ``ScriptAlias`` ,``Alias`` 是否将路径设置到了受控制的目录之外。针对 URL 进行控制的语句为 ``Location`` ,这样不但能对服务器上的文件, CGI 提供保护,此外,它还能保护不能找到对应文件,而是由服务器本身提供的特殊功能 URL。http://servername/server-status 用于报告当前 Apache 服务器的状态,http://servername/server-info 用于报告 Apache 服务器的统计信息。与此相关的设置还有  ``ExtendedStatus`` ,可以让服务器输出更详细的的报告。 + +- ``ExtendedStatus On`` + + Apache 服务器可以通过特殊的 HTTP 请求报告自身的运行状态,打开这个  ``ExtendedStatus`` 可以让服务器报告更全面的运行状态信息。 + +- 虚拟主机 + + :: + + NameVirtualHost *:80 + + + ServerAdmin webmaster@dummy-host.example.com + DocumentRoot "/usr/docs/dummy-host.example.com" + ServerName dummy-host.example.com + ServerAlias www.dummy-host.example.com + ErrorLog "/var/log/apache2/dummy-host.example.com-error_log" + CustomLog "/var/log/apache2/dummy-host.example.com-access_log" common + + + + ServerAdmin webmaster@dummy-host2.example.com + DocumentRoot "/usr/docs/dummy-host2.example.com" + ServerName dummy-host2.example.com + ErrorLog "/var/log/apache2/dummy-host2.example.com-error_log" + CustomLog "/var/log/apache2/dummy-host2.example.com-access_log" common + + + 缺省设置文件中的这些内容是用于设置命名基础的虚拟主机服务器时使用。 + + 其中  ``NameVirtualHost`` 用来指定虚拟主机使用的 IP 地址,这个 IP 地址将对应多个 DNS 名字,如果 Apache 使用了 ``Listen`` 控制了多个端口,那么就可以在这里加上端口号以进一步进行区分对不同端口的不同连接请求。此后,使用 ``VirtualHost`` 语句,使用 ``NameVirtualHost`` 指定的 IP 地址作参数,对每个名字都定义对应的虚拟主机设置。 + + 虚拟主机是在一台 Web 服务器上,可以为多个单独域名提供 Web 服务,并且每个域名都完全独立,包括具有完全独立的文档目录结构及设置,这样域名之间完全独立,不但使用每个域名访问到的内容完全独立,并且使用另一个域名无法访问其它域名提供的网页内容。 + + 虚拟主机的概念对于 ISP 来讲非常有用,因为虽然一个组织可以将自己的网页挂在具备其它域名的服务器上的下级网址上,但使用独立的域名和根网址更为正式,易为众人接受。传统上,必须自己设立一台服务器才能达到单独域名的目的,然而这需要维护一个单独的服务器,很多小单位缺乏足够的维护能力,更为合适的方式是租用别人维护的服务器。ISP也没有必要为一个机构提供一个单独的服务器,完全可以使用虚拟主机能力,使服务器为多个域名提供 Web 服务,而且不同的服务互不干扰,对外就表现为多个不同的服务器。 + + 有两种设定虚拟主机的方式,一种是基于 HTTP + 1.0 标准,需要一个具备多 IP 地址的服务器,再配置 DNS 服务器,给每个 IP 地址以不同的域名,最后才能配置 Apache 的配置文件,使服务器对不同域名返回不同的 Web 文档。由于这需要使用额外的 IP 地址,对每个要提供服务的域名都要使用单独的 IP 地址,因此这种方式实现起来问题较多。 + + 可以在一个网络界面上绑定多个 IP 地址,Linux 下需要使用  ``ifconfig`` 的 ``alias`` 来进行这个配置,但此时会影响网络性能。 + + HTTP + 1.1 标准在协议中规定了对浏览器和服务器通信时,服务器能够跟踪浏览器请求的是哪个主机名字。因此可以利用这个新特性,使用更轻松的方式设定虚拟主机。这种方式不需要额外的 IP 地址,但需要新版本的浏览器支持。这种方式已经成为建立虚拟主机的标准方式。 + + 要建立非 IP 基础的虚拟主机,多个域名是不可少的配置,因为每个域名对应一个要服务的虚拟主机。因此需要更改 DNS 服务器的配置,为服务器增加多个  ``CNAME`` 选项,如: + + :: + + linux IN A 192.168.1.64 + vhost1 IN CNAME linux + vhost2 IN CNAME linux + + 基本的设置选项都是为了 Linux 主机设定的,如果要为  ``vhost1`` 和 ``vhost2`` 设定虚拟主机,就要使用 ``VirtualHost`` 语句定义不同的选项,在语句中可以使用配置文件前面中的大部分选项,而可以重新定义几乎所有的针对服务器的设置。 + + :: + + DocumentRoot "/var/www/htdocs" + ServerName localhost + ServerAdmin root@localhost + ErrorLog /var/log/httpd/error_log + TransferLog /var/log/httpd/access_log + + 这里需要注意的是, ``VirtualHost`` 的参数地址一定要和 ``NameVirtualHost`` 定义的地址相一致,必须保证所有的值严格一致,Apache 服务器才承认这些定义是为这个 IP 地址定义的虚拟主机。 + + 此外,定义过  ``NameVirtualHost`` 之后,那么对这个 IP 地址的访问都被区分不同的虚拟主机进行处理,而对其它 IP 地址的访问,例如 127.0.0.1,才应用前面定义的缺省选项。 + +- 特性支持 + + :: + + BrowserMatch "Mozilla/2" nokeepalive + BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 + BrowserMatch "RealPlayer 4\.0" force-response-1.0 + BrowserMatch "Java/1\.0" force-response-1.0 + BrowserMatch "JDK/1\.0" force-response-1.0 + BrowserMatch "Microsoft Data Access Internet Publishing Provider" + redirect-carefully + BrowserMatch "MS FrontPage" redirect-carefully + BrowserMatch "^WebDrive" redirect-carefully + BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully + BrowserMatch "^gnome-vfs/1.0" redirect-carefully + BrowserMatch "^XML Spy" redirect-carefully + BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully + + ``BrowserMatch`` 为特定的客户程序,设置特殊的参数,以保证对老版本浏览器的兼容性,并支持新浏览器的新特性。 + +- ``Timeout 300`` + + ``Timeout`` 定义客户程序和服务器连接的超时间隔,超过这个时间间隔(秒)后服务器将断开与客户机的连接。 + +- ``KeepAlive On`` + + 在 HTTP + 1.0 中,一次连接只能作传输一次 HTTP 请求,而  ``KeepAlive`` 用于支持 HTTP + 1.1 版本的一次连接,多次传输功能,这样就可以在一次连接中传递多个 HTTP 请求。虽然只有较新的浏览器才支持这个功能,但还是打开这个选项。打开的结果是允许用户建立永久连接。 + +- ``MaxKeepAliveRequests 100`` + + ``MaxKeepAliveRequests`` 为一次连接可以进行的 HTTP 请求的最大次数。将其值设为 0 将支持在一次连接内进行无限次的传输请求。事实上没有客户程序在一次连接中请求太多的页面,通常达不到这个上限就完成连接了。 + +- ``KeepAliveTimeout 15`` + + ``KeepAliveTimeout`` 测试一次连接中的多次请求传输之间的时间,如果服务器已经完成了一次请求,但一直没有接收到客户程序的下一次请求,在间隔超过了这个参数设置的值之后,服务器就断开连接。 + +- ``UseCanonicalName On`` + + 打开  ``UseCanonicalName`` 是 Web 服务器的标准做法,因为客户发送的大部分请求都是对本服务器的引用,这样服务器就能使用 ``ServerName`` 和 ``Port`` 选项的设置内容构建完整的 URL,并回应客户,使浏览器能得到规范的 URL。如果将这个参数设置为 ``Off`` ,那么 Apache 将使用从客户请求中获得服务器的名字和端口值(支持 HTTP + 1.1 的客户的请求中将会有这些信息),重新构建 URL。 + +- ``AccessFileName .htaccess`` + + 分布式配置文件的名字。如果为某个目录启用了分布式配置文件功能,那么在向客户端返回其中的文档时,服务器将在这个文档所在的各级目录中查找此配置文件。 + +- ``ServerTokens Full`` + + 这个参数控制了服务器回应给客户端的“``Server:``”应答头是否包含关于服务器操作系统类型和编译进的模块描述信息。 + + - ``ServerTokens Prod[uctOnly]`` + + 服务器会发送(比如): ``Server: Apache`` + + - ``ServerTokens Major`` + + 服务器会发送(比如): ``Server: Apache/2`` + + - ``ServerTokens Minor`` + + 服务器会发送(比如): ``Server: Apache/2.0`` + + - ``ServerTokens Min[imal]`` + + 服务器会发送(比如): ``Server: Apache/2.0.41`` + + - ``ServerTokens OS`` + + 服务器会发送(比如): ``Server: Apache/2.0.41 (Unix)`` + + - ``ServerTokens Full`` (或未指定) + + 服务器会发送(比如): ``Server: Apache/2.0.41 (Unix) PHP/4.3.2 MyMod/1.2`` + + 此设置将作用于整个服务器,而且不能用在虚拟主机的配置段中。这个参数还控制着  ``ServerSignature`` 的显示内容。 + +- ``ServerSignature On`` + + 一些情况下,例如当客户请求的网页并不存在时,服务器将产生错误文档,缺省情况下由于打开了  ``ServerSignature`` 选项,错误文档的最后一行将包含服务器的名字,Apache 的版本等信息。有的管理员更倾向于不对外显示这些信息,就可以将这个参数设置为 ``Off`` ,或者设置为  ``Email`` ,最后一行将替换为对  ``ServerAdmin`` 的 ``Email`` 提示。 + + ``HostnameLookups Off`` + + 此参数启用了 DNS 查询,使得主机名能被记入日志(并用  ``REMOTE_HOST`` 变量传递给 CGI/SSI)。参数 ``Double`` 指定进行一次双向 DNS 查询。也就是说在一次反向查询之后,再对返回的结果进行一次正向查询。在正向查询结果中至少应该有一个 ip 地址与初始的地址相符。 + + 不论此处如何设置,当您使用  ``mod_authz_host`` 来根据主机名控制访问的时候,就会执行一次双向查询。这对安全来说非常必要。请注意如果您没有设置 ``HostnameLookups Double`` ,这种双向查询的结果不是自动生成的。比如说:如果仅仅设置了  ``HostnameLookups On`` 而且请求是针对一个根据主机名做了限制的对象,不论双向查询是否失败,CGI 还是会把单向查询的结果用 ``REMOTE_HOST`` 来传送。 + + 默认值设置为 ``Off`` 是为了那些不需要进行反向查询的站点节约网络带宽考虑的。这对最终用户也是有益的,因为这样他们就不用忍受查询造成的延迟了。高访问量的网站应该将此参数设置为 ``Off`` 因为 DNS 查询会造成明显的时间消耗。在 ``bin`` 目录下的 logresolve 工具可以在离线的情况下对已经记入日志的 IP 地址进行主机名的查询。 + +- ``ScoreBoardFile /var/run/httpd.scoreboard`` + + httpd 使用  ``ScoreBoardFile`` 文件维护进程的内部数据,因此通常不需要改变这个参数,除非管理员想在一台计算机上运行几个 Apache 服务器,这时每个 Apache 服务器都需要独立的设置文件 ``httpd.conf`` ,并使用不同的 ``ScoreBoardFile`` 。 + +- ``CacheNegotiatedDocs On`` + + 缺省情况下如果代理服务器和 Apache 服务器协商是否缓存其网页,Apache 给予否定的回答,不希望自己的网页被代理服务器缓存。然而这样就不能有效的利用代理服务器的优势,因此可以设置  ``CacheNegotiatieDocs`` 选项为 ``On`` , + 使得代理服务器可以对网页进行缓存。然而即使不设置这个选项,有的代理服务器(或通过调整设置)也能对网页进行缓存。 + +- ``Redirect permanent /foo`` + + ``Redirect`` 是用来重写 URL 的,当浏览器访问服务器上的一个已经不存在的资源的时候,服务器返回给浏览器新的 URL,告诉浏览器从该 URL 中获取资源。这主要用于原来存在于服务器上的文档,改变了位置之后,而又希望能使用老 URL 能访问到,以保持与以前的 URL 兼容。 + +- ``MetaDir .web`` + + ``MetaSuffix .meta`` + + ``Meta`` 信息是在文档发送给客户之前,预先发送给客户浏览器一些数据,因此浏览器可以通过 ``HEAD`` 请求来访问这些 ``Meta`` 信息而不必真正通过 ``GET`` 来返回全部文档数据。服务器通常发送给浏览器的是一些标准的 HTTP 头信息,如果要想增加额外的信息,就需要使用 ``MetaDir`` 来定义 ``Meta`` 数据存放的目录, + 而  ``MetaSuffix`` 用于指定包含 ``Meta`` 数据的文件后缀。 + +- 浏览器代理设置 + + :: + + # + # ProxyRequests On + # + # + # Allow from .your_domain.com + # + + # + # Order deny,allow + # Deny from all + # Allow from .your_domain.com + # + + # Enable/disable the handling of HTTP/1.1 "Via:" headers. + # ("Full" adds the server version; + # "Block" removes all outgoing Via: headers) + # Set to one of: Off | On | Full | Block + + # ProxyVia On + + # To enable the cache as well,edit and uncomment the following lines: + # (no cacheing without CacheRoot) + + # CacheRoot "/var/www/cache" + # CacheSize 5 + # CacheGcInterval 4 + # CacheMaxExpire 24 + # CacheLastModifiedFactor 0.1 + # CacheDefaultExpire 1 + # NoCache a_domain.com another_domain.edu joes.garage_sale.com + + # + + Apache 服务器本身就具备代理的功能,然而这要求加载入  ``mod_proxy`` 模块。这能使用 ``IfModule`` 语句进行判断,如果存在 ``mod_proxy`` 模块,就使用 ``ProxyRequests`` 打开代理支持。此后的 ``Directory`` 用于设置对 ``Proxy`` 功能的访问权限设置,以及用于设置缓冲的各个参数设置。 + +日志 +^^^^ + +Apache 内建了记录服务活动的功能,这就是它的日志。 + +- ``/var/log/apache2/access_log`` + + 访问日志,记录了所有对 Web 服务器的访问活动。 + + 访问日志文件的位置实际上是一个配置选项。在  ``/etc/apache2/httpd.conf`` 配置文件中,有如下这行内容: + + ``CustomLog "/var/log/apache2/access_log" common`` + + ``CustomLog`` 指定了保存日志文件的具体位置以及日志的格式。上面这行指定的是 ``common`` 日志格式。 + + ``CustomLog`` 中的路径是日志文件的路径。注意,由于日志文件是由 HTTP 用户打开的(用 User 指定),因此必须注意这个路径要有安全保证,防止该文件被随意改写。 + +- ``/var/log/apache2/error_log`` + + 错误日志,记录了 Apache 发生的错误。 + + 错误日志和访问日志一样也是 Apache 服务的标准日志。 + + 错误日志无论在格式上还是在内容上都和访问日志不同。然而,错误日志和访问日志一样也提供丰富的信息,我们可以利用这些信息分析服务器的运行情况,哪里出现了问题。 + + 错误日志的位置可以通过  ``/etc/apache2/httpd.conf`` 文件中的 ``ErrorLog`` 选项进行设置: + + ``ErrorLog "/var/log/apache2/error.log"`` + + 除非文件位置用“``/``”开头,否则这个文件位置是相对于  ``ServerRoot`` 目录的相对路径。 + + 错误日志记录了服务器运行期间遇到的各种错误,以及一些普通的诊断信息,比如服务器何时启动,何时关闭等。 + + 我们可以设置日志文件记录信息级别的高低,控制日志文件记录信息的数量和类型。这是通过  ``LogLevel`` 设置的,该参数默认设置的级别是 ``error`` ,即记录称得上错误的事件。 + + 大多数情况下,我们在日志文件中见到的内容分属两类:文档错误和 CGI 错误。但是,错误日志中偶尔也会出现配置错误,另外还有前面提到的服务器启动和关闭信息。 + +#. **解读日志** + + 下面是访问日志中一个典型的记录: + + ``216.35.116.91 - - [19/Aug/2000:14:47:37 -0400] "GET / HTTP/1.0" 200 654`` + + 这行内容由7项构成,上面的例子中有两项空白,但整行内容仍旧分成了7项。 + + 第一项信息是远程主机的地址,即它表明访问网站的究竟是谁。在上面的例子中,访问网站的主机是 216.35.116.91。随便说一句,这个地址属于一台名为 si3001.inktomi.com 的机器(要找出这个信息,可以使用 nslookup 工具查找 DNS),inktomi.com 是一家制作 Web 搜索软件的公司。可以看出,仅仅从日志记录的第一项出发,我们就可以得到有关访问者的不少信息。 + + 默认情况下,第一项信息只是远程主机的 IP 地址,但我们可以要求 Apache 查出所有的主机名字,并在日志文件中用主机名字来替代 IP 地址。然而,这种做法通常不值得推荐,因为它将极大地影响服务器记录日志的速度,从而也就减低了整个网站的效率。另外,有许多工具能够将日志文件中的 IP 地址转换成主机名字,因此要求 Apache 记录主机名字替代 IP 地址是得不偿失的。 + + 然而,如果确实有必要让 Apache 找出远程主机的名字,那么我们可以使用如下命令: + + ``HostNameLookups on`` + + 如果  ``HostNameLookups`` 设置成 ``double`` 而不是 ``on`` ,日志记录程序将对它找到的主机名字进行反向查找,验证该主机名字确实指向了原来出现的 IP 地址。默认情况下 ``HostNameLookups`` 设置为 ``off`` 。 + + 上例日志记录中的第二项是空白,用一个占位符“-”替代。实际上绝大多数时候这一项都是如此。这个位置用于记录浏览者的标识,这不只是浏览者的登录名字,而是浏览者的 email 地址或者其它唯一标识符。这个信息由 identd 返回,或者直接由浏览器返回。很早的时候,那时  **Netscape0.9** 还占据着统治地位,这个位置往往记录着浏览者的 email 地址。然而,由于有人用它来收集邮件地址和发送垃圾邮件,所以它未能保留很长时间,很久之前市场上几乎所有的浏览器就取消了这项功能。因此,到了今天,我们在日志记录的第二项看到 email 地址的机会已经微乎其微了。 + + 日志记录的第三项也是空白。这个位置用于记录浏览者进行身份验证时提供的名字。当然,如果网站的某些内容要求用户进行身份验证,那么这项信息是不会空白的。但是,对于大多数网站来说,日志文件的大多数记录中这一项仍旧是空白的。 + + 日志记录的第四项是请求的时间。这个信息用方括号包围,而且采用所谓的“公共日志格式”或“标准英文格式”。因此,上例日志记录表示请求的时间是2000年8月19日星期三14:47:37。时间信息最后的“-0400”表示服务器所处时区位于 UTC 之前的4小时。 + + 日志记录的第五项信息或许是整个日志记录中最有用的信息,它告诉我们服务器收到的是一个什么样的请求。该项信息的典型格式是“``METHOD RESOURCE PROTOCOL``”,即“方法  资源  协议”。 + + 在上例中, ``METHOD`` 是 ``GET`` ,其它经常可能出现的  ``METHOD`` 还有 ``POST`` 和 ``HEAD`` 。此外还有不少可能出现的合法  ``METHOD`` ,但主要就是这三种。 + + ``RESOURCE`` 是指浏览者向服务器请求的文档,或 URL。在这个例子中,浏览者请求的是“``/``”,即网站的主页或根。大多数情况下,“``/``”指向  ``DocumentRoot`` 目录的 ``index.html`` 文档,但根据服务器配置的不同它也可能指向其它文件。 + + ``PROTOCOL`` 通常是 HTTP,后面再加上版本号。版本号或者是1.0,或者是1.1,但出现1.0的时候比较多。我们知道,HTTP 协议是 Web 得以工作的基础,HTTP/1.0 是 HTTP 协议的早期版本,而1.1是最近的版本。当前大多数 Web 客户程序仍使用1.0版本的 HTTP 协议。 + + 日志记录的第六项信息是状态代码。它告诉我们请求是否成功,或者遇到了什么样的错误。大多数时候,这项值是200,它表示服务器已经成功地响应浏览器的请求,一切正常。一般地说,以2开头的状态代码表示成功,以3开头的状态代码表示由于各种不同的原因用户请求被重定向到了其它位置,以4开头的状态代码表示客户端存在某种错误,以5开头的状态代码表示服务器遇到了某个错误。 + + 日志记录的第七项表示发送给客户端的总字节数。它告诉我们传输被打断(即,该数值是否和文件的大小相同)。把日志记录中的这些值加起来就可以得知服务器在一天,一周或者一月内发送了多少数据。 + +#. **CGI错误** + + 错误日志最主要的用途可能是诊断行为异常的 CGI 程序。为了进一步分析和处理方便,CGI 程序输出到 STDERR(Standard + Error,标准错误设备)的所有内容都将直接进入错误日志。这意味着,任何编写良好的 CGI 程序,如果出现了问题,错误日志就会告诉我们有关问题的详细信息。 + + 然而,把 CGI 程序错误输出到错误日志也有它的缺点,错误日志中将出现许多没有标准格式的内容,这使得用错误日志自动分析程序从中分析出有用的信息变得相当困难。 + + 由于 CGI 程序运行环境的特殊性,如果没有错误日志的帮助,大多数 CGI 程序的错误都将很难解决。 + + 有不少人在邮件列表或者新闻组中抱怨说自己有一个 CGI 程序,当打开网页时服务器却返回错误,比如“``Internal Server Error``”。我们可以肯定,这些人还没有看过服务器的错误日志,或者根本不知道错误日志的存在。决多大多数情况下,错误日志能够精确地指出 CGI 错误的所在以及如何修正这个错误。 + +#. **定义日志格式** + + 定制日志文件的格式涉及到两个参数,即  ``LogFormat`` 和 ``CustomLog`` ,默认 ``httpd.conf`` 文件提供了关于这两个参数的几个示例。 + + ``LogFormat`` 定义格式并为格式指定一个名字,以后我们就可以直接引用这个名字。``CustomLog`` 设置日志文件,并指明日志文件所用的格式(通常通过格式的名字)。 + + ``LogFormat`` 的功能是定义日志格式并为它指定一个名字。例如,在默认的 ``httpd.conf`` 文件中,我们可以找到下面这行代码: + + ``LogFormat “%h %l %u %t \”%r\” %>s %b” common`` + + 该命令创建了一种名为“``common``”的日志格式,日志的格式在双引号包围的内容中指定。格式字符串中的每一个变量代表着一项特定的信息,这些信息按照格式串规定的次序写入到日志文件。 + + Apache 文档已经给出了所有可用于格式串的变量及其含义,下面是其译文: + + ``%...a`` :远程 IP 地址 + + ``%...A`` :本地 IP 地址 + + ``%...B`` :已发送的字节数,不包含 HTTP 头 + + ``%...b`` :CLF 格式的已发送字节数量,不包含 HTTP 头。例如当没有发送数据时,写入“-”而不是0。 + + ``%...{FOOBAR}e`` :环境变量  ``FOOBAR`` 的内容 + + ``%...f`` :文件名字 + + ``%...h`` :远程主机 + + ``%...H`` :请求的协议 + + ``%...{Foobar}i`` : ``Foobar`` 的内容,发送给服务器的请求的标头行 + + ``%...l`` :远程登录名字(自 identd,如提供的话) + + ``%...m`` :请求的方法 + + ``%...{Foobar}n`` :来自另外一个模块的注解“``Foobar``”的内容 + + ``%...{Foobar}o`` : ``Foobar`` 的内容,应答的标头行 + + ``%...p`` :服务器响应请求时使用的端口 + + ``%...P`` :响应请求的子进程 ID + + ``%...q`` :查询字符串(果存在查询字符串,则包含“?”后面的部分;则它是一个空字符串) + + ``%...r`` :请求的第一行 + + ``%...s`` :状态,对于进行内部重定向的请求,这是指“原来”请求的状态. + 如果用  ``%...>s`` ,则是指后来的请求 + + ``%...t`` :以公共日志时间格式表示的时间(称为标准英文格式) + + ``%...{format}t`` :以指定格式  ``format`` 表示的时间 + + ``%...T`` :为响应请求而耗费的时间,以秒计 + + ``%...u`` :远程用户(如果返回状态( ``%s`` )401则可能是伪造的) + + ``%...U`` :用户所请求的 URL 路径 + + ``%...v`` :响应请求的服务器的  ``ServerName`` + + ``%...V`` :依照  ``UseCanonicalName`` 设置得到的服务器名字 + + 在所有上面列出的变量中,“...”表示一个可选的条件。如果没有指定条件,则变量的值将以“-”取代。分析前面来自默认  ``httpd.conf`` 文件的 ``LogFormat`` 示例,可以看出它创建了一种名为“``common``”的日志格式,其中包括:远程主机,远程登录名字,远程用户,请求时间,请求的第一行代码,请求状态,以及发送的字节数。 + + 有时候我们只想在日志中记录某些特定的,已定义的信息,这时就要用到“...”。如果在“``%``”和变量之间放入了一个或者多个 HTTP 状态代码,则只有当请求返回的状态代码属于指定的状态代码之一时,变量所代表的内容才会被记录。例如,如果我们想要记录的是网站的所有无效链接,那么可以使用: + + ``LogFormat %404{Referer}i BrokenLinks`` + + 反之,如果我们想要记录那些状态代码不等于指定值的请求,只需加入一个“!”符号即可: + + ``LogFormat %!200U SomethingWrong`` + +参考信息 +^^^^^^^^ + +有关  **Apache** 的详细信息,请参见位于 http://www.apache.org/ 的官方主页。 + +BIND +~~~~ + +.. _简介-1: + +简介 +^^^^ + +DNS 服务提供主机名字之间和互联网地址之间的映射。 + +.. _配置文件-1: + +配置文件 +^^^^^^^^ + +- DNS 服务的配置文件为  ``/etc/bind/named.conf`` 。 + +- 区数据文件位于  ``/var/cache/bind`` 下,分为两种: + + - 正向解析:以机器域名开头,实现从机器名到 IP 地址的转换。 + + - 反向解析:以 IP 地址域开头,实现从 IP 地址到机器名的转换。 + +.. _配置文件参数-1: + +配置文件参数 +^^^^^^^^^^^^ + +下面是  ``named.conf`` 文件的一个示例: + +:: + + options { + directory "/var/cache/bind"; + notify-source 10.0.0.2; + pid-file "/var/run/bind/run/named.pid"; + }; + zone "." { + type master; + file "root.hint"; + }; + zone "example.com" { + type master; + file "sample.com.zone"; + }; + +DNS 服务器的配置有多种可用的选项,如果需要更加详细的信息请参考有关DNS服务器的书籍。在上面的例子中  ``directory "/var/cache/bind"`` 语句指明了区数据库文件存放的具体位置;``notify-source`` 语句指明服务器把区变动通知(NOTIFY)消息发送到IP地址所指的地方,当主 DNS 服务器检测到区数据库文件发生变动时就会向辅助服务器发出区数据文件变动的消息。``pid-file`` 语句只是告诉守护进程(daemon)服务器写入 ID 信息的路径,通常是 ``/var/run/bind/run/named.pid`` 文件,但如果你重新设置了目录的布局,也可以根据需要对其进行手动更改。 + +在上面的例子中第一个区登记项(即  ``zone "."`` )是用来告知 DNS 服务在何处定位其根服务器的信息。服务器发送和接收的信息不仅仅是自己所在区域的信息,同时也包括 Internet 上所有的区域的信息。并不是每个服务器上都有每个域名的登记项,但每个服务器都知道怎样获取此类信息。当然,由于每个区数据库文件列表会定期定时更新其数据文件,所以也应当定期定时作备份记录。 + +在以上  ``named.conf`` 示例文件中第二个区登记项(即 ``zone "example.com"`` )是一个“主控”域项,意思是这个 DNS 服务器保存着 example.com 的有效信息,Internet 上其它所有的 DNS 服务器都将用它来参照任何与这个域相关的信息。Example.com 项引用  ``/var/cache/bind/sample.com.zone`` 这个文件。这是一个纯文本文件,它告诉 DNS 服务器所有有关 example.com 的信息,包括 ``serial`` 值,刷新时间等所有的 DNS 记录以及其它一些相关项目信息。 + +#. **区数据文件** + + 示例: + + :: + + @ IN SOA ns1.sample.com. root.sample.com. ( + 200001001 # serial 序列号 + 14400 # refresh 刷新时间(秒) + 3600 # retry 重试时间(秒) + 3600000 # expire 过期时间(秒) + 86400) # TTL (time to live) 否定缓存~TTL(秒) + IN NS ns1.sample.com. + IN NS ns2.sample.com. + # + # Domain Mail Handlers + # + sample.com. IN MX 10 mail + # + # Hosts in order + # + www IN A 212.204.319.71 + ftp IN A 212.204.319.71 + mail IN A 212.204.319.71 + pop IN CNAME mail + + .. csv-table:: "区域示例文件参数说明" + :header: "资源类型记录","说明","解释" + :widths: 10, 10, 30 + + "@", "", "代表目前所管辖的域。" + "SOA", "起始授权机构", "此记录指定区域的起点。它所包含的信息有区域名、区域管理员电子邮件地址,以及指示辅DNS服务器如何更新区域数据文件的设置等。" + "A", "地址", "此记录列出特定主机名的IP地址。这是名称解析的重要记录。" + "CNAME", "标准名称", "此记录指定标准主机名的别名。" + "MX", "邮件交换器", "此记录列出了负责接收发到域中的电子邮件的主机。" + "NS", "名称服务器", "此记录指定负责给定区域的名称服务器。" + + - 序列号(serial) + + 作用于本区的所有数据。当辅域名服务器与主域名联系得到区数据时,先会请求相关数据的序列号,如果辅域名服务器的序列号比主域名服务器的序列号小,则说明辅域名服务器的数据已经过时,需加载新的区数据拷贝。 + + - 刷新时间(refresh) + + 刷新间隔说明辅域名服务器间隔多久检查该区的数据是最新的。 + + - 重试时间(retry) + + 如果辅域名服务器超过刷新间隔后无法访问主域名服务器,则开始按照每隔一段重试时间间隔就试着连接一次。通常重试时间要比刷新时间短。 + + - 过期时间(expire) + + 如过期时间内仍无法与主域名服务器联系,则辅域名服务器将使这个区失效。使一个区失效就意味着辅域名服务器将停止关于该区的回答。 + + - 否定缓存 TTL(TTL (time to live)) + + 表示可以将一个区的否定响应(negative response)缓存的时间。 + + .. raw:: latex + + \vspace{1cm} + + 所有区数据库文件都要以 SOA(Start of Authority)打头;序列号(serial)使服务器能够纪录所经过的各次更新。守护进程在最近一次启动后只要此数字出现了增长变化,它就会重新把信息读入到数据库中去。举例来说,你可以从0开始然后在每次更新之后加上一个数字,也可以使用日期项如20000101(这样能够看到最近的一次更新的发生并且看出一天是否发生过多次更新)。接下来的四行以秒为单位(亦可以以分钟、小时、天等为单位)处理刷新时间和超时周期等,如果 DNS 数据库文件没有发生过人工或者服务器范围的刷新,此服务器会自动的重新读入新信息。在此不需要经常改变此处所列出的数值信息,只有由于某种特殊原因此域需要非常频繁地改变它们的信息时才需要对这些数值进行更改。接着列出的是此域的主 DNS 服务器,这样 DNS 就会知道是谁会控制整个域。下面列出的是 MX 纪录,它使服务器知道当有邮件信息请求 sample.com 区域时应当发出什么样信息,在本例中 mail.samle.com 的优先级是10,同时可以列出多个 MX 纪录作为邮件服务器的备份。数字越小代表优先级越高。要注意的是必须有一个相应的 A 记录给出了 mail.sample.com 的 IP 地址,这是必不可少的,这样 DNS 服务器就可以知道怎样根据域信息直接把邮件请求发往目的地。一个 A 记录仅仅是把 IP 地址赋给一个子域项,如 www,mail,ftp 等等,这些都必须用以上格式录入,而且必须都与一个 IP 地址相对应。例如,当某个用户请求 www.sample.com 时,他将会被指向该域所在的 Web 服务器的 IP 地址212.104.319.71。另外在上面的例子中还有一个 CNAME 项,CNAME(Canonical Name) 用于指定 IP 地址的别名,当使用这些别名时还是要回过头参考已经使用过的 A 记录。 + +#. **辅域名服务器部分** + + 以下是辅助域名服务器  ``name.conf`` 文件中一部分的一个例子: + + :: + + zone "sample2.com" { + type slave; + file "/var/cache/bind/sample2.com.zone"; + master { 10.0.0.1}; + }; + + 与主域名服务器相比较,二者最主要的两个区别在于:一是\ ``type`` 项,它既可以是 ``master`` 也可以是 ``slave`` ,二是 IP 地址指定的是主控 DNS 服务器。其它选项大致基本相同。 + +.. _参考信息-1: + +参考信息 +^^^^^^^^ + +有关  **BIND** 的详细信息,请参见位于 http://www.isc.org/ 的官方主页。 + +.. _日志-1: + +日志 +^^^^ + +DNS 服务的日志文件存放于  ``/var/log/`` ,其日志文件分为两部分,一部分为存储 DNS 服务信息文件,其存放位置为  ``/var/log/message`` ,另一部分为 DNS 服务出错信息文件,其存放位置为  ``/var/log/errors`` ,通过这两个文件,我们就可以清楚的了解 DNS 服务的各种动态,以及各种出错信息,以便我们更加有效的配置 DNS 服务。 + +Samba +~~~~~ + +.. _简介-2: + +简介 +^^^^ + +Samba 是一组软件包,运行于 Linux 系统中,用来实现与 Windows 系统之间的通信。它允许 Linux 系统出现在 Windows 的网络邻居中,使 Windows 用户享受由 Linux 主机提供的文件与打印服务。 + +Samba 由两个主要程序组成,它们是 smbd 和 nmbd。这两个守护进程在服务器启动到停止期间持续运行,Samba 提供了四个服务:文件和打印服务、授权与被授权、名字解析、浏览服务。前两项服务由 smbd 提供,后两项服务则由 nmbd 提供。简单地说,smbd 进程的作用是处理到来的 SMB 软件包,为使用该软件包的资源与 Linux 进行协商,nmbd 进程使主机(或工作站)能浏览 Linux 服务器。 + +.. _配置文件-2: + +配置文件 +^^^^^^^^ + +Samba 的配置文件 \ ``smb.conf`` 位于 ``/etc/samba/`` 目录下,可以设置各种参数,设置哪些资源被共享、以及其它用户对这些资源的操作权限等等。 + +.. _配置文件参数-2: + +配置文件参数 +^^^^^^^^^^^^ + +``smb.conf`` 文件的格式非常容易理解,可以对它进行编辑与修改使它适合自己的需求。 + +#. **三个特殊段** + + 除了控制访问共享的定制外,\ ``smb.conf`` 有三个特殊段: + + - ``[global]`` 段定义了整个过程中的全局参数,并为其它段提供缺省值。 + + - ``[homes]`` 段定义远程用户存取在本地 Linux 机的用户主目录的参数。 + + - ``[printers]`` 段定义远程用户共享本地 Linux 的打印机。 + + 下面就配置文件中比较重要的几个段分别给与说明。 + + #. ``[global]`` + + ``[global]`` 节是全局参数节,该部分提供了全局参数,对 Samba 的功能具有很大的影响,主要用来设置整个系统规则,其设置直接影响 Samba 系统的行为。 + + - ``netbios name`` + + 设置主机名称,即 Windows 系统“网上邻居”中所见的机器名。 + + - ``workgroup`` + + 用来指定主机所在网络上所属的 NT 域名或者工作组名称。格式是: + + ``workgroup= Nt Domain-Name or workgroup-name`` + + - ``server string`` + + 用来设置本机描述,说明服务器用途,缺省是 \ ``Samba Server``\ 。 + + - ``host allow`` + + 允许访问的主机 IP 地址,对安全非常重要。它设置了哪些机器可以访问 Samba 服务器。 + + - ``load printers`` + + 允许自动加载打印机列表,而不需要单独设置每一台打印机。 + + - ``interface`` + + 配置 Samba 使用多个网络接口。 + + - ``domain controller`` + + 仅当网络中有主域控制器时使用此选项。 + + - ``security`` + + 设置安全参数,定义安全模式。Samba 的安全模式有三种: + + ``share user server`` + + 其中 \ ``share`` 安全级别最低,``user`` 模式要求连接时输入用户名和口令,``server`` 模式要求用户的认证由 Samba 服务器或 NT 服务器来完成。 + + - ``encrypt passwords`` + + ``smb passwd file`` + + 设置是否需要加密口令。 + + 例样: + + :: + + [global] + netbios name=Samba test + workgroup = in.linx + smb passwd file = /etc/samba/private/smbpasswd + server string = Samba Server + hosts allow = 192.168.0. 192.168.0. 127. + dns proxy = no + security = user + encrypt passwords = yes + guest account = testuser + interfaces = 192.168.0.1/24 + max log size = 50 + socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 + log file = /var/log/samba/log.%m + load printers = yes + printcap name = /etc/printcap + ... ... + + #. ``[homes]`` + + ``[homes]`` 部分指定了 Windows 共享的主目录,如果在 Windows 工作站登录的名字与 Linux 用户名相同,提供的口令也一致,那么打开网络邻居,双击共享目录图标,就可获得访问该目录的权力。从 Windows 访问 Linux 主目录时,用户名作为主目录共享名。该部分通常定义了 Linux 机器上共享的目录资源,其名字可以由用户确定。段中的设置控制了每一个用户目录的共享权限。 + + 当任何一个客户访问 Samba 服务器时,在网络资源中都能出现自己的 \ ``home`` 目录共享。其配置如下: + + - ``comment`` + + 设定在浏览本机资源时,出现在指定资源旁边的字符串。 + + - ``browseable`` + + 控制一项服务是否能够出现在网上邻居中,\ ``no`` 意味着这个目录将在浏览时显示为要验证的用户名称,``yes`` 则显示 ``homes`` 和要验证的用户名称的共享目录。 + + - ``writable`` + + 控制是否允许通过验证的用户对主目录有写入的权限,但最终取决于该目录的权限。设置 \ ``writable = yes`` 后,主目录是可写的。 + + 例样: + + :: + + [homes] + comment = Home Directories + browseable = no + writable = no + + #. ``[printers]`` + + ``[printers]`` 部分用于指定如何共享 Linux 网络打印机,从 windows 系统访问 Linux 网络打印机时,共享应是 printcap 中指定的 Linux 打印机名。其配置如下: + + - ``comment`` + + 指定为哪些设备进行设置。 + + - ``browseable`` + + 指定是否能够浏览 Windows 客户机的 printcap 文件定义的全部打印机。 + + - ``printable`` + + 指定是否允许不打印而去访问与打印服务相关的假脱机目录,例如:\ ``/var/spool/lpd/lp``\ 。 + + - ``public`` + + 指定未被 Linux 用户名验证的 Windows 客户机是否有权使用 Samba 打印服务。 + + - ``writable`` + + 指定是否有权写假脱机目录。 + + 例样: + + :: + + [printers] + comment = All Printers + browseable = no + printable = yes + public = no + writable = no + +#. **其它配置方法** + + #. 用户共享目录 \ ``[public]`` + + 设置公共访问目录。 + + ``[public]`` 段提供了所有用户都可以共同访问的目录。除了那些属于维护人员具有读、写、执行权外,用户只具有读取的访问权限。其配置如下: + + - ``path`` + + 指定公众共享目录路径。 + + - ``public`` + + 取值为 \ ``yes``\ 时,允许公众共享,否则,禁止公众共享该目录。 + + - ``writable`` + + 取值为 \ ``yes`` 时,公众对 ``/home/samba`` 有可写权力。 + + - ``printable`` + + 取值为 \ ``yes`` 时,公众对 ``/home/samba`` 有打印权力。 + + - ``write list`` + + 指定具有可写权力的用户名单。 + + 例样: + + :: + + [public] + path = /home/samba + public = yes + writable = yes + printable = no + writelist = @staff + + #. 用户映射 + + 全局参数“``username map``”用来控制用户映射,它允许管理员指定一个映射文件,该文件包含了在客户机和服务器之间进行用户映射的信息。 + + 如:\ ``username map = /etc/samba/smbuser`` + + 用户映射经常在 windows 和 linux 主机间进行。两个系统拥有不同的用户账号,用户映射的目的是将不同的用户映射成为一个用户,便于共享文件。 + + 下面是一个映射文件的例子: + + :: + + # Map Windows admin to sysadmin + sysadmin = admin administrator + # Map the member of developer to studio + studio = @developer + + 等号左边是单独的 Linux 账号,等号右边是要映射的账号列表。 + + 服务器逐行分析映射文件,如果提供的账号和某行有右侧列表中的账号匹配,就把它替换为等号左边的账号。 + + #. 使用加密口令 + + 新版本的 Windows 95 以及 Windows 98、Windows + NT(sp3 以上版本),在网络传输中仅传递加密口令作为用户认证的信息。这类客户机和不支持加密口令并且以 user 安全级运行的 Samba 服务器通讯时,会出现故障。为了正常的通讯,Samba 服务器使用加密口令。下面讨论如何在 Samba 中使用加密口令。 + + #. 口令文件 \ ``/etc/samba/private/smbpasswd`` + + 为了使用加密口令,Samba 需要一份口令文件,并且该文件应该和 Linux 的口令文件(\ ``/etc/passwd``\ )保持同步。下面是生成文件命令: + + ``$ less /etc/password | mksmbpasswd > /etc/samba/private/smbpasswd`` + + ``smbpasswd`` 是需要的口令文件,其权限是0600,所有者是 ``sysadmin``\ 。 + + ``smbpasswd`` 和 ``passwd``\ 文件的记录对应,密码部分不同。密码有两部分组成,每部分是32个“X”,前部分用于和 Lanman 通讯,后部分和 Windows + NT 通讯。\ ``sysadmin`` 用户可以使用 ``smbpasswd`` 命令为每个用户设定 Samba 口令。 + + #. 修改配置文件 \ ``/etc/samba/smb.conf`` + + 要使 Samba 使用加密口令,需要在配置文件 \ ``smb.conf`` 中加入如下参数。 + + :: + + Encrypt passwords = yes + Smb passwd file = /etc/samba/private/smbpasswd + + 第一行通知 Samba 使用加密口令,第二行给出口令文件的位置。 + + #. Windows 系统中的明码口令 + + Samba 系统中使用明码口令作为连接 SMB 的默认设置。当 SMB 服务器对协商协议做出响应时,响应信息包含了一位,以说明服务器是否支持询问或者响应加密。随着 Win95 的网络重定向更新程序的发布,Microsoft 修改了默认值,这样,Windows 客户就不会向不支持加密的服务器发送明码口令了。 + + 在这种情况下,有两种解决办法: + + #. 设置 Samba 服务器使用加密口令 + + #. 让 Windows 客户使用明码口令 + + 这里选用第2种解决办法,通过修改注册表来实现。下面对 Win95/Win98、 Winnt 用户分别给与说明。 + + #. Win98/Win95 系统用户 + + 在注册表中加入下列注册字,并重新启动机器: + + :: + + [HKLM\System\CurrentCntrolSet\Services\VxD\VNETSUP] + "EnablePlainTextPAssword" = dword:00000001 + + #. Winnt 系统用户 + + 修改注册表,加入下列注册表项,并重新启动机器: + + :: + + [HKLM\System\CurrentCntrolSet\Services\Rdr\Parameters] + "EnablePlainTextPAssword" = dword:00000001 + + #. 配置 Samba 实现本地打印机共享 + + 在开始之前,确信的 Samba 运行正常,并且 Windows 用户可以在网络邻居的列表中可以看到共享的 Samba 服务器。 + + 为了配置 \ ``smb.conf`` 文件实现共享一个本地打印机,检查 Linux 下的打印机是否工作正常。下一步在 Windows 客户端安装同一个打印机。这样做的话,需要 Windows 下打印机的安装盘。开始安装打印机,点击开始,选择打印机,并且双击添加打印机。 + + 在打印机安装向导中,按照屏幕上的说明一步一步进行操作,直到在列表中选择打印机的名称。要点:写出打印机的准确名称,注意大小写(名称对大小写是敏感的)。如果需要,在安装完成后要重启计算机。 + + 然后在 Samba 服务器上以系统管理员(\ ``sysadmin``\ )身份登录,对 Samba 配置文件 \ ``/etc/samba/smb.conf`` 进行相应修改。 + + 在 \ ``[global]`` 这一节,找到打印名称这行,如果想使 Windows 用户可以使用所有本地打印机,去掉这一行,并且如果文件中没有这些内容的话,添加上: + + :: + + printcap name = /etc/printcap + load printers = yes + + 如果只想让其它用户用一个打印机,不要删掉那行,也不用添加什么。需要注意的是在大多数从 BSD 发展而来的系统上,Samba 假设使用默认的打印系统。如果用的是其它打印系统,在打印系统配置中,找到相应的行,改变默认设置(\ ``bsd``\ )。选择包括 \ ``sysv``\ 、\ ``plp``\ 、\ ``lprng``\ 、\ ``aix``\ 、\ ``hpux`` 和 ``qnx``\ 。如果不能确认正在使用的打印系统,可以查看一下相关文件,但大多数情况下都是默认的。 + + 下一步,使所有的本地打印机都实现共享。所有的打印机都在 \ ``/etc/printcap`` 文件的打印机列表中,在 ``/etc/samba/smb.conf`` 文件尾添加以下服务条目: + + :: + + [printers] + writable = no + path = /tmp + printable = yes + + 如果只要共享一个打印机,在 \ ``smb.conf`` 文件的 ``[global]`` 小节添加一个自动服务行。和在 ``/etc/printcap`` 中的相同,这行指定想使用的打印机名称。下行中在 lp 填写默认打印机的名称: + + ``auto services = lp`` + + 而且,仿照下面创建一个打印机定义,添加到 \ ``[services]`` 小节中(在 ``/etc/samba/smb.conf`` 文件末尾): + + :: + + [lp] + printable = yes + comment = Epson Stylus(Color) + public = yes + writable = no + browseable = yes + printer driver= Epson Stylus Color 740 + + 定义中的打印机名是 lp,这个名称必须和上面自动服务行中的名称相一致,并且也要和在 \ ``/etc/printcap`` 文件中定义的打印机名称相同(或打印机的别名)。需要注意的是,打印机驱动行需要正确的输入 Windows 中的打印机信息(在这里,Epson + Stylus Color 740,还是需要注意大小写)。 + + 重新启动 Samba 服务后就可以共享使用打印机了。 + +.. _日志-2: + +日志 +^^^^ + +Samba 日志文件可以帮助诊断大多数的 Samba 管理员在初期可能面对的问题。Samba 在形成日志的时候非常灵活,可以随意设置服务器记录日志的大小。 + +Samba 日志文件位于 \ ``/var/log/samba/``\ ,其中 \ ``log.nmbd`` 和 ``log.smbd`` 日志文件记录了 Samba 服务的开启、关闭以及出错信息。``log.nmbd`` 记录了 nmbd 进程的信息,而 ``log.smbd`` 记录的是 smbd 进程的信息。另外,Samba 可以为每一个连接的客户使用唯一的配置和日志文件,并使用这个文件跟踪故障。只要某一个用户出现了问题,就可以利用查看某一个用户的 Samba 配置文件来进行正确的配置。 + +.. _参考信息-2: + +参考信息 +^^^^^^^^ + +有关 \ **Samba** 的详细信息,请参见位于 http://www.samba.org/ 的官方主页。 + +SSH +~~~ + +.. _简介-3: + +简介 +^^^^ + +SSH(Secure +Shell)是目前较可靠,专为远程登录会话和其它网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。用户通过 SSH 可以把所有传输的数据进行加密,使“中间人”的攻击方式不可能实现,而且也能够防止 DNS 和 IP 欺骗。它还有一个额外的好处是传输的数据是经过压缩的,可以加快传输的速度。SSH 作用广泛,既可以代替 Telnet,又可以为 FTP、POP,甚至为 PPP 提供一个安全的“通道”,主要是解决口令在网上明文传输的问题。为了系统安全和用户自身的权益,推广 SSH 是必要的。 + +.. hint:: + + 管理员用户无法通过ssh远程登录到凝思安全操作系统V6.0,,能由普通用户登录,然后再通过ssh切换到其它管理员用户。 + +.. _配置文件-3: + +配置文件 +^^^^^^^^ + +SSH 服务器的配置使用的是 \ ``/etc/ssh/sshd_config``\ 。 + +.. _配置文件参数-3: + +配置文件参数 +^^^^^^^^^^^^ + +#. **基本设置** + + 编辑“``sshd_config``”文件(\ ``vi /etc/ssh/sshd_config``\ ),加入或改变下面的参数: + + :: + + # This is ssh server systemwide configuration file. + Port 22 + ListenAddress 192.168.1.1 + HostKey /etc/ssh/ssh_host_key + ServerKeyBits 1024 + LoginGraceTime 600 + KeyRegenerationInterval 3600 + PermitRootLogin no + IgnoreRhosts yes + + :: + + IgnoreUserKnownHosts yes + StrictModes yes + X11Forwarding no + PrintMotd yes + SyslogFacility AUTH + LogLevel INFO + RhostsAuthentication no + RhostsRSAAuthentication no + RSAAuthentication yes + PasswordAuthentication yes + PermitEmptyPasswords no + AllowUsers admin  + + .. raw:: latex + + \vspace{1cm} + + 下面将逐行说明上面的选项设置: + + - ``Port`` + + 设置 sshd 监听的端口号。 + + - ``ListenAddress`` + + 设置 sshd 服务器绑定的 IP 地址。 + + - ``HostKey`` + + 设置包含计算机私人密匙的文件。 + + - ``ServerKeyBits`` + + 定义服务器密匙的位数。 + + - ``LoginGraceTime`` + + 设置如果用户不能成功登录,在切断连接之前服务器需要等待的时间(以秒为单位)。 + + - ``KeyRegenerationInterval`` + + 设置在多少秒之后自动重新生成服务器的密匙(如果使用密匙)。重新生成密匙是为了防止用盗用的密匙解密被截获的信息。 + + - ``PermitRootLogin`` + + 设置 \ ``root`` 能不能用 SSH 登录。这个选项一定不要设成“``yes``”。 + + - ``IgnoreRhosts`` + + 设置验证的时候是否使用“``rhosts``” 和“``shosts``”文件。 + + - ``IgnoreUserKnownHosts`` + + 设置 sshd 是否在进行 \ ``RhostsRSAAuthentication`` 安全验证的时候忽略用户的“``$HOME/.ssh/known_hosts``”。 + + - ``StrictModes`` + + 设置 SSH 在接收登录请求之前是否检查用户家目录和 \ ``rhosts`` 文件的权限和所有权。这通常是必要的,因为新手经常会把自己的目录和文件设成任何人都有写权限。 + + - ``X11Forwarding`` + + 设置是否允许 \ ``X11`` 转发。 + + - ``PrintMotd`` + + 设置 sshd 是否在用户登录的时候显示“``/etc/motd``”中的信息。 + + - ``SyslogFacility`` + + 设置在记录来自 sshd 的消息的时候,是否给出“``facility code``”。 + + - ``LogLevel`` + + 设置记录 sshd 日志消息的层次。\ ``INFO`` 是一个好的选择。查看 sshd 的 man 帮助页,已获取更多的信息。 + + - ``RhostsAuthentication`` + + 设置只用 \ ``rhosts`` 或“``/etc/hosts.equiv``”进行安全验证是否已经足够了。 + + - ``RhostsRSAAuthentication`` + + 设置是否允许用 \ ``rhosts`` 或“``/etc/hosts.equiv``”加上 \ ``RSA`` 进行安全验证。 + + - ``RSAAuthentication`` + + 设置是否允许只有 \ ``RSA`` 安全验证。 + + - ``PasswordAuthentication`` + + 设置是否允许口令验证。 + + - ``PermitEmptyPasswords`` + + 设置是否允许用口令为空的帐号登录。 + + - ``AllowUsers`` + + “``AllowUsers``”的后面可以跟着任意的数量的用户名的匹配串(patterns)或 user@host 这样的匹配串,这些字符串用空格隔开。主机名可以是 DNS 名或 IP 地址。 + + .. raw:: latex + + \vspace{1cm} + + 在默认的设置选项中需要注意的有: + + - ``PermitRootLogin`` + + 最好把这个选项设置成“``PermitRootLogin without-password``”,这样“root”用户就不能从没有密匙的计算机上登录。把这个选项设置成“``no``”将禁止“root”用户登录,只能用“``su``”命令从普通用户转成“root”。 + + - ``X11Forwarding`` + + 把这个选项设置成“``yes``”允许用户运行远程主机上的 X 程序。就算禁止这个选项也不能提高服务器的安全因为用户可以安装他们自己的转发器(forwarder),请参看“man + sshd”。 + + - ``PasswordAuthentication`` + + 把这个选项设置为“``no``”只允许用户用基于密匙的 mail。为 POP 加上“加密通道”可以防止 POP 的密码被网络监听器(sniffer)监听到。还有一个好处就是 SSH 的压缩方式可以让邮件传输得更快。 + +#. **配置客户端的软件** + + OpenSSH 有三种配置方式:命令行参数、用户配置文件和系统级的配置文件 \ ``/etc/ssh/ssh_config``\ 。命令行参数优先于配置文件,用户配置文件优先于系统配置文件。所有的命令行的参数都能在配置文件中设置。因为缺省设置时没有默认的用户配置文件,所以要把“``/etc/ssh/ssh_config``”拷贝并重新命名为“``~/.ssh/config``”。 + + 标准的配置文件: + + :: + + [lots of explanations and possible options listed] + # Be paranoid by default + Host * + ForwardAgent no + ForwardX11 no + FallBackToRsh no + + 还有很多选项的设置可以用“man ssh”查看“CONFIGURATION + FILES”这一章,配置文件是按顺序读取的。先设置的选项先生效。 + + 假定你在 www.foobar.com 上有一个名为“bilbo”的帐号。而且你要把“``ssh-agent``”和“``ssh-add``”结合起来使用并且使用数据压缩来加快传输速度。因为主机名太长了,不愿意得输入这么长的名字,用“fbc”作为“www.foobar.com”的简称。你的配置文件可以是这样的: + + :: + + Host *fbc + HostName www.foobar.com + User bilbo + ForwardAgent yes + Compression yes + # Be paranoid by default + Host * + ForwardAgent no + ForwardX11 no + FallBackToRsh no + + 输入“``ssh fbc``”之后,SSH 会自动地从配置文件中找到主机的全名,用你的用户名登录并且用“``ssh-agent``”管理的密匙进行安全验证。 + + 用 SSH 连接到其它远程计算机用的还是“``paranoid``\ (偏执)”默认设置。如果有些选项没有在配置文件或命令行中设置,那么还是使用默认的“``paranoid``”设置。 + + 在我们上面举的那个例子中,对于到 www.foobar.com 的 SSH 连接:“``ForwardAgent``”和“``Compression``”被设置为“``Yes``”; + 其它的设置选项(如果没有用命令行参数) + “``ForwardX11``”和“``FallBackToRsh``”都被设置成“``No``”。 + +#. **其它** + + 还有一些需要注意的设置选项: + + - ``CheckHostIP`` + + 这个选项用来进行 IP 地址的检查以防止 DNS 欺骗。 + + - ``CompressionLevel`` + + 压缩的级别从“1”(最快)到“9”(压缩率最高)。默认值为“6”。 + + - ``ForwardX11`` + + 为了在本地运行远程的 X程序必须设置这个选项。 + + - ``LogLevel`` + + 当 SSH 出现问题的时候,即可设置该选项。默认值为“``INFO``”。 + +DHCP +~~~~ + +.. _简介-4: + +简介 +^^^^ + +DHCP 是动态主机配置协议(Dynamic Host Configure +Protocol)的缩写,它能自动地为网络中的客户机的 TCP/IP 配置分配 IP 地址、子网掩码以及缺省网关、DNS 服务器和 WINS 服务器的 IP 地址。它能使网络管理员不用前往现场对每台计算机上的 TCP/IP 参数进行配置,一切设置的修改只需直接在服务器上即可完成。 + +利用 DHCP 服务,还可以最高效地利用有限的 IP 地址。因为,比如,网络管理员在进行网络安装的时候,已经配置好了 DHCP 服务器,则当客户端启动时,DHCP 服务器就自动临时发放包含 IP 地址的相关 TCP/IP 配置参数给它,从而使它能够正常连入网络;而客户端只需装上 TCP/IP 协议即可,不用再作其他任何设置。在使用过程中,如果 DHCP 服务器的相关资源(比如服务器的 IP 地址等)发生了变化,则只需修改它的 DHCP 设定后,就可以自动为客户端发送新的配置值。 + +.. _配置文件-4: + +配置文件 +^^^^^^^^ + +DHCP 服务的配置文件为 ``/etc/dhcpd.conf`` 。 + +租约文件为 ``/var/lib/dhcp/dhcpd.leases`` 。 + +.. _配置文件参数-4: + +配置文件参数 +^^^^^^^^^^^^ + +#. **服务配置文件** + + 这是一个文本文件,dhcpd 里有一个语法分析器,能对这个文件进行语法分析,获得配置参数。 ``dhcpd.conf`` 格式是递归下降的,关键字大小写敏感,可以有注释,以 ``“ #”`` 开头为注释,一直到该行结束。这里给出一个简单的 ``dhcpd.conf`` 的例子,所服务的网络为 C 类保留网络192.168.1.0。 + + :: + + # examples + default-lease-time 28800; # 缺省租约时间 + max-lease-time 43200; # 最大租约时间 + option subnet-mask 255.255.255.0; # 子网掩码选项 + option broadcast-address 192.168.1.255; # 广播地址 + option routers 192.168.1.1; # 路由器地址 + option domain-name-servers 192.168.1.1; # DNS地址 + option domain-name "netreslab.org"; # 网域名称 + # 以上都是全局参数 + + subnet 192.168.1.0 netmask 255.255.255.0 { # 子网声明和掩码 + range 192.168.1.10 192.168.1.100; # 范围 + range 192.168.1.150 192.168.1.200; # 范围 + } + + 这段配置文件将允许 DHCP 服务器分配两段地址范围给 DHCP 客户,192.168.1.10-100 和 192.168.1.150-200。如果 DHCP 客户在申请租约时不请求一个特定租约失效时间,则以 ``default-lease-time`` (28800秒)为租约时间,如果有请求一个特定的租约失效时间,则采用 ``max-lease-time`` (432000秒)。 + + 服务器发送下面的参数给 DHCP 客户机: + + - 子网掩码是255.255.255.0; + + - 广播地址是192.168.1.255; + + - 默认网关是192.168.1.1; + + - DNS 是192.168.1.1。 + + 如果要为一台叫做 hotdog 的机器指定固定的 IP 地址,可以在 ``dhcpd.conf`` 文件加一条 + + :: + + host hotdog { + hardware ethernet 08:00:00:4c:58:23; # hotdog客户端上网卡的硬件地址 + fixed-address 192.168.1.210; # 固定IP + } + +#. **租约文件** + + dhcpd 将客户的租用信息保存在 ``/var/lib/dhcp/dhcpd.leases`` 文件中,该文件不断被更新,从这里面可以查到 IP 地址分配的情况。 + + ``dhcpd.leases`` 是 DHCP 客户租约的数据库文件,默认目录在 ``/var/lib/dhcp/`` ,文件包含租约声明,每次一个租约被获取,更新或释放,它的新值就被记录到文件的的末尾。在 dhcpd 第一次安装后,并不会生成这个文件。但 dhcpd 的运行需要这个文件,所以可以建立一个空的文件。 + + ``$ touch /var/lib/dhcp/dhcpd.leases`` + + dhcpd 记录这个文件的格式是: + + ``lease ip-address { statements... }`` + + 每个记录包含一个提供给客户的 IP 地址,在花括号里的语句包含一些租约信息。具体的租约信息因客户发出不同的 DHCP 请求而稍有差别。 + +.. _日志-3: + +日志 +^^^^ + +DHCP 服务的日志文件存放于 ``/var/log/`` ,其日志文件分为两部分,一部分为存储 DHCP 服务信息文件,其存放位置为 ``/var/log/message`` ,另一部分为 DHCP 服务出错信息文件,其存放位置为 ``/var/log/errors`` ,通过这两个文件,我们就可以清楚的了解 DHCP 服务的各种动态,以及各种出错信息,以便我们更加有效的配置 DHCP 服务。 + +.. _参考信息-3: + +参考信息 +^^^^^^^^ + +有关 **DHCP** 的详细信息,请参见位于 http://www.dhcp.org/ 的官方主页。 + +bonding +------- + +Linux +bonding驱动提供了一种可以将多个网络接口设备捆绑为一个逻辑“bonded”接口的方法,用于网络负载均衡及网络冗余。 + +- 网络负载均衡 + + bonding的网络负载均衡是在文件服务器中常用到的,可以把多块网卡当一块来用。解决一个IP地址,流量过大,服务器网络压力过大的问题。bonding是在有限资源的情况下实现网络负载均衡的最好方法。 + +- 网络冗余 + + 对于服务器来说,网络设备的稳定也是很重要的,特别是网卡。在生产型的系统中,大多通过硬件设备的冗余来提供服务器的可靠性和安全性,比如电源。bonding也能为网卡提供冗余支持。把多块网卡绑定到一个IP地址,当一块网卡发生物理性损坏时,另一块网卡自动启动,并提供正常服务,即:默认情况下只有一块网卡工作,其他网卡做备份。 + +参数说明 +~~~~~~~~ + +参数列表 +^^^^^^^^ + +#. primay + + 指定哪个slave成为主设备(primary + device),取值为字符串,如eth0,eth1等。只要指定的设备可用,它将一直是激活的slave。只有在主设备(primary + device)断线时才会切换设备。这在希望某个slave设备优先使用的情形下很有用,比如,某个slave设备有更高的吞吐率。 + + .. attention:: + primary 选项只对 active-backup 模式有效。 + +#. updelay + + 指定当发现一个链路恢复时,在激活该链路之前的等待时间,以毫秒计算。该选项只对miimon链路侦听有效。updelay应该是miimon值的整数倍,如果不是,它将会被向下取整到最近的整数。缺省值为0。 + +#. arp_interval + + 指定ARP链路监控频率,单位是毫秒(ms)。如果APR监控工作于以太兼容模式(模式0和模式2)下,需要把switch(交换机)配置为在所有链路上均匀的分发网络包。如果switch(交换机)被配置为以XOR方式分发网络包,所有来自ARP目标的应答将会被同一个链路上的其他设备收到,这将会导致其他设备的失败。ARP监控不应该和miimon同时使用。设定为0将禁止ARP监控。缺省值为0。 + +#. arp_ip_target + + 指定一组IP地址用于ARP监控的目标,它只在 arp_intetval > 0 时有效。这些IP地址是ARP请求发送的目标,用于判定到目标地址的链路是否工作正常。该设定值为ddd.ddd.ddd.ddd格式。多个IP地址通过逗号分隔。至少指定一个IP地址。最多可以指定16个IP地址。缺省值是没有IP地址。 + +#. downdelay + + 指定一个时间,用于在发现链路故障后,等待一段时间然后禁止一个slave,单位是毫秒(ms)。该选项只对miimon监控有效。downdelay值应该是miimon值的整数倍,否则它将会被取整到最接近的整数倍。缺省值为0。 + +#. lacp_rate + + 指定在802.3ad模式下,我们希望的链接对端传输LACPDU包的速率。可能的选项 + + - slow或者0 + + 请求对端每30s传输LACPDU + + - fast或者1 + + 请求对端每1s传输LACPDU + + - 缺省值是slow + +#. max_bonds + + 为bonding驱动指定创建bonding设备的数量。比如:如果max_bonds为3,而且bonding驱动还没有加载,那么bond0,bond1,bond2将会被创建。缺省值为1。 + +#. miimon + + 指定MII链路监控频率,单位是毫秒(ms)。这将决定驱动检查每个slave链路状态频率。 + + 0表示禁止MII链路监控。100可以作为一个很好的初始参考值。下面的use_carrier选项将会影响如果检测链路状态。更多的信息可以参考“高可靠性”章节。缺省值为0。 + +#. mode + + 指定bonding的模式。缺省是6 (balance-alb) Adaptive load balancing(适配器适应性负载均衡)。可选的mode包括:0,1,2,3,4,5,6。 + +bonding模式 +~~~~~~~~~~~ + +linux操作系统下双网卡绑定有七种模式(由mode来配置)。 + +- mode=0 + + 即:(balance-rr) Round-robin policy(平衡抡循环模式) + + 特点:此模式需要switch(交换机)支持及设定才能发挥效果,其特点是需要传输数据包顺序是依次传输(即:第1个包走eth0,下一个包就走eth1....一直循环下去,直到最后一个传输完毕),此模式提供负载平衡和容错能力;但是我们知道如果一个连接或者会话的数据包从不同的接口发出的话,中途再经过不同的链路,在客户端很有可能会出现数据包无序到达的问题,而无序到达的数据包需要重新要求被发送,这样网络的吞吐量就会下降。 + +- mode=1 + + 即: (active-backup) Active-backup policy(主-备份模式) + + 特点:只有一个设备处于活动状态,当一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见得,从外面看来,bond的MAC地址是唯一的,以避免switch(交换机)发生混乱。此模式只提供了容错能力;由此可见此算法的优点是可以提供高网络连接的可用性,但是它的资源利用率较低,只有一个接口处于工作状态,在有N 个网络接口的情况下,资源利用率为1/N。 + +- mode=2 + + 即:(balance-xor) XOR policy(平衡模式) + + 特点:基于指定的传输HASH策略传输数据包。缺省的策略是:(源MAC地址 XOR目标MAC地址) %slave数量。其他的传输策略可以通过xmit_hash_policy选项指定,此模式提供负载平衡和容错能力。 + +- mode=3 + + 即:broadcast(广播模式) + + 特点:在每个slave接口上传输每个数据包,此模式提供了容错能力。 + +- mode=4 + + 即:(802.3ad) IEEE 802.3ad Dynamic link aggregation(IEEE 802.3ad动态链接聚合模式) + + 特点:创建一个聚合组,它们共享同样的速率和双工设定。根据802.3ad规范将多个slave工作在同一个激活的聚合体下。 + + 外出流量的slave选举是基于传输hash策略,该策略可以通过xmit_hash_policy选项从缺省的XOR策略改变到其他策略。需要注意的是,并不是所有的传输策略都是802.3ad适应的,尤其考虑到在802.3ad标准43.2.4章节提及的包乱序问题。不同的实现可能会有不同的适应性。 + + 必要条件: + + - 条件1:ethtool支持获取每个slave的速率和双工设定 + + - 条件2:switch(交换机)支持IEEE 802.3ad Dynamic link aggregation + + - 条件3:大多数switch(交换机)需要经过特定配置才能支持802.3ad模式 + +- mod=5 + + 即:(balance-tlb) Adaptive transmit load + balancing(适配器传输负载均衡模式) + + 特点:不需要任何特别的switch(交换机)支持的通道bonding。在每个slave上根据当前的负载(根据速度计算)分配外出流量。如果正在接受数据的slave出故障了,另一个slave接管失败的slave的MAC地址。 + + 该模式的必要条件:ethtool支持获取每个slave的速率。 + +- mod=6 + + 即:(balance-alb) Adaptive load balancing(适配器适应性负载均衡模式) + + 特点:该模式包含了balance-tlb模式,同时加上针对IPV4流量的接收负载均衡(receiveload balance,rlb),而且不需要任何switch(交换机)的支持。接收负载均衡是通过ARP协商实现的。bonding驱动截获本机发送的ARP应答,并把源硬件地址改写为bond中某个slave的唯一硬件地址,从而使得不同的对端使用不同的硬件地址进行通信。 + +配置bonding +~~~~~~~~~~~ + +操作系统及环境 +^^^^^^^^^^^^^^ + +操作系统为:凝思安全操作系统V6.0(系统中默认安装了ifenslave)。 + +需启用两块或两块以上网卡设备。 + +#. 查看内核支持:(示例) + + :: + + root@Linx:~# modprobe -l bond* + kernel/drivers/net/bonding/bonding.ko + root@Linx:~# modinfo bonding + filename: /lib/modules/2.6.32-5-linx-amd64/kernel/drivers/net/ + bonding/bonding.ko + author: Thomas Davis, tadavis@lbl.gov and many others + description: Ethernet Channel Bonding Driver, v3.5.0 + version: 3.5.0 + license: GPL + srcversion: C0EFCD8CB4AC214A8146EC2 + depends: + vermagic: 2.6.32-5-linx-amd64 SMP mod_unload modversions + parm: max_bonds:Max number of bonded devices (int) + parm: num_grat_arp:Number of gratuitous ARP packets to send + on failover event (int) + parm: num_unsol_na:Number of unsolicited IPv6 Neighbor + Advertisements packets to send on failover event (int) + parm: miimon:Link check interval in milliseconds (int) + parm: updelay:Delay before considering link up, in + milliseconds (int) + parm: downdelay:Delay before considering link down, in + milliseconds (int) + parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in + miimon; 0 for off, 1 for on (default) (int) + parm: mode:Mode of operation : 0 for balance-rr, 1 for + active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 + for balance-tlb, 6 for balance-alb (charp) + parm: primary:Primary network device to use (charp) + parm: lacp_rate:LACPDU tx rate to request from 802.3ad + partner (slow/fast) (charp) + parm: ad_select:803.ad aggregation selection logic: stable + (0, default), bandwidth (1), count (2) (charp) + parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 + (default), 1 for layer 3+4 (charp) + parm: arp_interval:arp interval in milliseconds (int) + parm: arp_ip_target:arp targets in n.n.n.n form (array of + charp) + parm: arp_validate:validate src/dst of ARP probes: none + (default), active, backup or all (charp) + parm: fail_over_mac:For active-backup, do not set all slaves + to the same MAC. none (default), active or follow (charp) + +#. 加载模块 + + 加载模块实现分为手动加载和开机启动自动加载。 + + - 手动加载 + + 先卸载bonding模块。 + + :: + + root@Linx:~# rmmod bonding + + 示例选模式为6;允许最大绑定数为1,加载bonding。 + + :: + + root@Linx:~# modprobe bonding mode=6 max_bonds=1 + + 注意:手动加载bonding需重启网络,即:修改完配置文件 ``/etc/network/interfaces`` 后重启网络。 + + :: + + root@Linx:~# /etc/init.d/networking restart + + - 开机启动自动加载 + + 修改配置文件 ``/etc/network/interfaces`` 如下一节中所示:配置文件中添加了bonding的相关配置,开机重启可自动加载bonding模块。 + + .. rubric:: 配置文件 + :name: s4 + + 编辑网络接口配置文件,指定IP。 + + :: + + root@Linx:~# vim /etc/network/interfaces + + 查看示例文件: + + :: + + root@Linx:~# cat /etc/network/interfaces + # This file describes the network interfaces available on your system + # and how to activate them. For more information, see interfaces(5). + auto bond0 + iface bond0 inet static + address 172.16.0.73 + network 255.255.255.0 + netmask 255.255.255.0 + gateway 172.16.0.254 + slaves eth0 eth1 + bond_mode active-backup + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + root@Linx:~# + + 查看网络信息: + + :: + + root@Linx:~# ifconfig + diff --git a/source/软件包管理.rst b/source/软件包管理.rst new file mode 100644 index 0000000..470203f --- /dev/null +++ b/source/软件包管理.rst @@ -0,0 +1,259 @@ +软件包管理 +========== + +软件包管理机制 +-------------- + +软件包概述 +~~~~~~~~~~ + +软件包通常包含了实现一系列相关命令或特性所必须的所有的文件。有两种类型的 Deb 软件包: + +- Binary + packages(二进制软件包),包含可执行文件、配置文件、man/info 页面、版权声明和其它文档。它们通常使用 .deb 的扩展名以示区别。这种二进制软件包可使用工具 dpkg 解包。 + +- Source + packages(源码包),包含一个 .dsc 文件它用于描述源码包(包括下列文件的名称),一个 .orig.tar.gz 文件它是未经修改的原始源代码压缩文件,以及一个 .diff.gz 件它包含了该软件包 Debian 化时所做的修改。 + +软件包命名约定 +~~~~~~~~~~~~~~ + +软件包命名遵循下列约定: + +:: + + foo_ver-rev_arch.deb + +一般这里的 foo 是软件包的名称,ver 是软件本身的版本号,rev 是修订版本号,arch 是目标架构名称。修订版本号由开发者或创建这个软件包的人指定。通常,包被修改过之后,会把修改版本号加一。 + +维护脚本 +~~~~~~~~ + +维护脚本是一种可执行脚本,它在软件包安装之前或之后自动运行。它和一个名叫 control 的文件一起组成 Deb 包文件的“管理”部分。这些文件包括: + +- preinst + + 在软件包(.deb)文件解包之前,运行这个脚本。许多“preinst”脚本的任务是停止作用于待升级软件包的服务,直到软件包安装或升级完成。 + +- postinst + + 该脚本的任务是完成软件包(.deb)文件解包文件的配置工作。通常,“postinst”脚本等待用户输入,或提醒用户,如果他接受当前默认值,要记得软件包安装完后返回重新配置。许多“postinst”脚本负责执行有关命令为新安装或升级的软件重启服务。 + +- prerm + + 该脚本负责停止与软件包关联的 daemon 服务。它在删除软件包关联文件之前执行。 + +- postrm + + 该脚本负责修改软件包链接或文件关联,或删除由它创建的文件。 + +软件包优先级 +~~~~~~~~~~~~ + +每个软件包均被发布者指定了一个优先级,作为软件包管理系统的一个辅助参数,优先级的值有: + +- Required(必须) + + 该级别软件包是保证系统正常运行必须的。 + +- Important(重要) + + 在任何类 Unix 系统上均安装有该级别软件包。 + +- Standard(基本) + + 该级别软件包是任何 Linux 系统的标准件,它们组成一个小而精的字符模式的系统。 + +- Optional(推荐) + + 该级别软件包包括那些你可能想安装的软件,即使对它们并不熟悉,但对它们没有特殊的要求。 + +- Extra(额外) + + 该级别软件包可能与其它高级别软件包冲突,仅当你知道其用途时才会使用它们,或者有运行它们有专门要求。 + +软件包依赖关系 +~~~~~~~~~~~~~~ + +软件包管理系统依赖声明,它描述了这一事实:一些软件包需要其它软件包被安装才能正常运行或运行得更好。 + +- 软件包 A 依赖(depends)软件包 B:要运行 A 必须安装 B。在有些情况下,A 不仅依赖 B,还要求 B 的特定版本。版本依赖通常有最低版本限制,A 更依赖于 B 的最新版本而非某个特定版本。 + +- 软件包 A 推荐(recommends)软件包 B:软件包维护者认为所有用户都不会喜欢缺少某些功能的 A,而这些功能需要 B 来提供。 + +- 软件包 A 建议(suggests)软件包 B:B 中某些文件与 A 的功能相关,并能够增强 A 的功能。这种关系通过声明软件包 B 增强软件包 A 来表示。 + +- 软件包 A 与软件包 B 冲突(conflicts):如果系统中安装了 B 那么 A 无法运行。“conflicts”常和“replaces”同时出现。 + +- 软件包 A 替换(replaces)软件包 B:B 安装的文件被 A 中的文件移除和覆盖了。 + +- 软件包 A 提供(provides)软件包 B:A 包含了 B 中的所有文件和功能。 + +软件包管理工具 +-------------- + +常用的包管理工具 +~~~~~~~~~~~~~~~~ + +- ``dpkg`` 底层软件包管理工具 + +- ``apt`` 高级软件包管理工具集 + +- ``aptitude`` apt 命令行前端 + +dpkg +~~~~ + +dpkg 是软件包管理器的基础,被用于安装、卸载和查看 .deb 软件包相关的信息。 + +常用的dpkg命令参数如下: + +- ``dpkg -i `` 安装软件包 + +- ``dpkg -r [--purge] `` 卸载软件包 + +- ``dpkg -l `` 列出软件包名称和安装状态 + +- ``dpkg -s `` 查看软件包详细状态 + +- ``dpkg -L `` 软件包安装文件列表 + +- ``dpkg -c `` 列出软件包文件 .deb 内容 + +- ``dpkg -x `` 解压软件包文件到目录 + +apt +~~~ + +apt 是一个软件包管理工具集合,是 dpkg 的高级前端,可以解决软件包依赖问题。apt 工具集使用时通常需要通过网络访问软件源,最常用的工具包括 apt-get 和 apt-cache。 + +设置软件源 +^^^^^^^^^^ + +软件源指的是提供各种软件包下载的服务器。apt 从指定的软件源获取软件包列表( ``/var/lib/apt/lists/*`` ),在需要时下载安装。 + +您可以修改  ``/etc/apt/sources.list`` 来设置软件源,例如: + +:: + + deb http://ftp.debian.org/debian/squeeze main non-free contrib + +apt-get +^^^^^^^ + +apt-get 是一个命令行方式的软件包处理工具,常用的命令参数如下: + +- ``apt-get update`` 更新软件包列表 + +- ``apt-get install `` 安装软件包 + +- ``apt-get install --reinstall`` 重新安装软件包 + +- ``apt-get remove `` 卸载软件包 + +- ``apt-get remove --purge`` 卸载软件包(删除配置文件) + +- ``apt-get upgrade`` 升级所有软件包 + +- ``apt-get build-dep `` 安装软件包编译环境 + +- ``apt-get source `` 下载源码包 + +- ``apt-get clean`` 清理软件包缓存 + +- ``apt-get check`` 检查是否有损坏的依赖 + +apt-cache +^^^^^^^^^ + +apt-cache 用于查询软件包的相关信息,常用的命令参数如下: + +- ``apt-cache search `` 搜索软件包 + +- ``apt-cache show `` 显示软件包相关信息 + +- ``apt-cache showsrc `` 显示源码包相关信息 + +- ``apt-cache depends `` 显示软件包的依赖信息 + +- ``apt-cache rdepends `` 显示依赖  的软件包的信息 + +aptitude +~~~~~~~~ + +aptitude 与 apt-get 一样,是功能强大的包管理工具。与 apt-get 不同的是,aptitude 在处理依赖问题上更佳一些。举例来说,aptitude 在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。 + +常用 aptitude 命令如下: + +- ``aptitude update`` 更新可用的软件包列表 + +- ``aptitude upgrade`` 升级可用的软件包 + +- ``aptitude dist-upgrade`` 将系统升级到新的发行版 + +- ``aptitude install `` 安装软件包 + +- ``aptitude remove `` 删除软件包 + +- ``aptitude purge `` 删除软件包及其配置文件 + +- ``aptitude search `` 搜索名称中包含该字符串的软件包 + +- ``aptitude show `` 显示软件包的详细信息 + +- ``aptitude clean`` 删除下载的软件包文件 + +- ``aptitude autoclean`` 仅删除过期的软件包文件 + +除此之外,您还可以执行命令  ``aptitude`` 在文本界面模式中使用 aptitude,如 :numref:`Remote_8_1` 所示。 + +.. _Remote_8_1: +.. figure:: ./pic/aptitude.png + :width: 75% + :alt: aptitude 文本界面模式 + + aptitude 文本界面模式 + +.. raw:: latex + + \newpage + +安装软件包 +~~~~~~~~~~ + +请先确认系统中有 dpkg、apt、aptitude 等包管理工具,并且已将软件源写入到  ``/etc/apt/sources.list`` 文件中。 + +然后执行以下命令: + +:: + + apt-get update + +或 + +:: + + aptitude update + +更新源信息将写到  ``/var/lib/apt/lists/`` 目录下。至少包括以 ``Packages`` 、  ``Release`` 、  ``Release.gpg`` 为结尾的三个文件。 + +再执行以下命令: + +:: + + apt-get install 或 aptitude install + +安装或更新指定软件包。 + +或者 + +:: + + apt-get upgrade 或 aptitude upgrade + +更新所有已安装的软件包。 + +更新软件包将被下载到  ``/var/cache/apt/archives/`` 中暂存,然后再进行安装。 + +升级的记录会写在日志文件  ``/var/log/dpkg.log`` 、  ``/var/log/apt/term.log`` 中。 +