
tar cjvf C.tar.bz2 B # 默认是在当前文件夹下的
OK后会在/A文件夹下有个名为“C.tar.bz2”的tar压缩文件
tar tvf C.tar.bz2 # 列出里面的文件
会用了吧? 呵呵 再把文档粘给你 比较长 别哭哦 学习之路还很远的
TAR(1)tar TAR(1)
NAME
tar - The GNU version of the tar archiving utility
SYNOPSIS
tar <operation>[options]
Operations:
[-]A --catenate --concatenate
[-]c --create
[-]d --diff --compare
[-]r --append
[-]t --list
[-]u --update
[-]x --extract --get
--delete
Common Options:
-C, --directory DIR
-f, --file F
-j, --bzip2
-p, --preserve-permissions
-v, --verbose
-z, --gzip
All Options:
[ --atime-preserve ] [ -b, --blocking-factor N ] [ -B, --read-full-
records ] [ --backup BACKUP-TYPE ] [ --block-compress ] [ -C, --direc-
tory DIR ] [ --check-links ] [ --checkpoint ] [ -f, --file [HOSTNAME:]F
] [ -F, --info-script F --new-volume-script F ] [ --force-local] [
--format FORMAT ] [ -g, --listed-incremental F ] [ -G, --incremental ]
[ --group GROUP ] [ -h, --dereference ] [ --help ] [ -i, --ignore-zeros
] [ --ignore-case ] [ --ignore-failed-read ] [ --index-file FILE ] [
-j, --bzip2 ] [ -k, --keep-old-files ] [ -K, --starting-file F ] [
--keep-newer-files ] [ -l, --one-file-system ] [ -L, --tape-length N ]
[ -m, --touch, --modification-time ] [ -M, --multi-volume ] [ --mode
PERMISSIONS ] [ -N, --after-date DATE, --newer DATE ] [ --newer-mtime
DATE ] [ --no-anchored ] [ --no-ignore-case ] [ --no-recursion ] [
--no-same-permissions ] [ --no-wildcards ] [ --no-wildcards-match-slash
] [ --null ] [ --numeric-owner ] [ -o, --old-archive, --portabil-
ity, --no-same-owner ] [ -O, --to-stdout ] [ --occurrence NUM ] [
--overwrite ] [ --overwrite-dir ] [ --owner USER ] [ -p, --same-permis-
sions, --preserve-permissions ] [ -P, --absolute-names ] [ --pax-option
KEYWORD-LIST ] [ --posix ] [ --preserve ] [ --acls ] [ --selinux ] [
--xattrs ] [ --no-acls ] [ --no-selinux ] [ --no-xattrs ] [ -R,
--block-number ] [ --record-size SIZE ] [ --recursion ] [ --recursive-
unlink ] [ --remove-files ] [ --rmt-command CMD ] [ --rsh-command CMD ]
[ -s, --same-order, --preserve-order ] [ -S, --sparse ] [ --same-owner
] [ --show-defaults ] [ --show-omitted-dirs ] [ --strip-components NUM-
BER, --strip-path NUMBER (1) ] [ --suffix SUFFIX ] [ -T, --files-from F
] [ --totals ] [ -U, --unlink-first ] [ --use-compress-program PROG ]
[ --utc ] [ -v, --verbose ] [ -V, --label NAME ] [ --version ] [
--volno-file F ] [ -w, --interactive, --confirmation ] [ -W, --verify ]
[ --wildcards ] [ --wildcards-match-slash ] [ --exclude PATTERN ] [ -X,
--exclude-from FILE ] [ -Z, --compress, --uncompress ] [ -z, --gzip,
--gunzip, --ungzip ] [ -[0-7][lmh] ]
(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
DESCRIPTION
This manual page documents the GNU version of tar, an archiving program
designed to store and extract files from an archive file known as a
tarfile. A tarfile may be made on a tape drive, however, it is also
common to write a tarfile to a normal file. The first argument to tar
must be one of the options Acdrtux, followed by any optional functions.
The final arguments to tar are the names of the files or directories
which should be archived. The use of a directory name always implies
that the subdirectories below should be included in the archive.
EXAMPLES
tar -xvf foo.tar
verbosely extract foo.tar
tar -xzf foo.tar.gz
extract gzipped foo.tar.gz
tar -cjf foo.tar.bz2 bar/
create bzipped tar archive of the directory bar called
foo.tar.bz2
tar -xjf foo.tar.bz2 -C bar/
extract bzipped foo.tar.bz2 after changing directory to bar
tar -xzf foo.tar.gz blah.txt
extract the file blah.txt from foo.tar.gz
FUNCTION LETTERS
One of the following options must be used:
-A, --catenate, --concatenate
append tar files to an archive
-c, --create
create a new archive
-d, --diff, --compare
find differences between archive and file system
-r, --append
append files to the end of an archive
-t, --list
list the contents of an archive
-u, --update
only append files that are newer than the existing in archive
-x, --extract, --get
extract files from an archive
--delete
delete from the archive (not for use on mag tapes!)
COMMON OPTIONS
-C, --directory DIR
change to directory DIR
-f, --file [HOSTNAME:]F
use archive file or device F (default "-", meaning stdin/stdout)
-j, --bzip2
filter archive through bzip2, use to decompress .bz2 files
-p, --preserve-permissions
extract all protection information
-v, --verbose
verbosely list files processed
-z, --gzip, --ungzip
filter the archive through gzip
ALL OPTIONS
--atime-preserve
don't change access times on dumped files
-b, --blocking-factor N
block size of Nx512 bytes (default N=20)
-B, --read-full-blocks
reblock as we read (for reading 4.2BSD pipes)
--backup BACKUP-TYPE
backup files instead of deleting them using BACKUP-TYPE simple
or numbered
--block-compress
block the output of compression program for tapes
-C, --directory DIR
change to directory DIR
--check-links
warn if number of hard links to the file on the filesystem mis-
match the number of links recorded in the archive
--checkpoint
print directory names while reading the archive
-f, --file [HOSTNAME:]F
use archive file or device F (default "-", meaning stdin/stdout)
-F, --info-script F --new-volume-script F
run script at end of each tape (implies --multi-volume)
--force-local
archive file is local even if has a colon
--format FORMAT
selects output archive format
v7 - Unix V7
oldgnu - GNU tar <=1.12
gnu - GNU tar 1.13
ustar - POSIX.1-1988
posix - POSIX.1-2001
-g, --listed-incremental F
create/list/extract new GNU-format incremental backup
-G, --incremental
create/list/extract old GNU-format incremental backup
-h, --dereference
don't dump symlinksdump the files they point to
--help like this manpage, but not as cool
-i, --ignore-zeros
ignore blocks of zeros in archive (normally mean EOF)
--ignore-case
ignore case when excluding files
--ignore-failed-read
don't exit with non-zero status on unreadable files
--index-file FILE
send verbose output to FILE instead of stdout
-j, --bzip2
filter archive through bzip2, use to decompress .bz2 files
-k, --keep-old-files
keep existing filesdon't overwrite them from archive
-K, --starting-file F
begin at file F in the archive
--keep-newer-files
do not overwrite files which are newer than the archive
-l, --one-file-system
stay in local file system when creating an archive
-L, --tape-length N
change tapes after writing N*1024 bytes
-m, --touch, --modification-time
don't extract file modified time
-M, --multi-volume
create/list/extract multi-volume archive
--mode PERMISSIONS
apply PERMISSIONS while adding files (see chmod(1))
-N, --after-date DATE, --newer DATE
only store files newer than DATE
--newer-mtime DATE
like --newer, but with a DATE
--no-anchored
match any subsequenceof the name's components with --exclude
--no-ignore-case
use case-sensitive matching with --exclude
--no-recursion
don't recurse into directories
--no-same-permissions
apply user's umask when extracting files instead of recorded
permissions
--no-wildcards
don't use wildcards with --exclude
--no-wildcards-match-slash
wildcards do not match slashes (/) with --exclude
--null --files-from reads null-terminated names, disable --directory
--numeric-owner
always use numbers for user/group names
-o, --old-archive, --portability
like --format=v7 -o exhibits this behavior when creating an
archive (deprecated behavior)
-o, --no-same-owner
do not attempt to restore ownership when extracting-o exhibits
this behavior when extracting an archive
-O, --to-stdout
extract files to standard output
--occurrence NUM
process only NUM occurrences of each named fileused with
--delete, --diff, --extract, or --list
--overwrite
overwrite existing files and directory metadata when extracting
--overwrite-dir
overwrite directory metadata when extracting
--owner USER
change owner of extraced files to USER
-p, --same-permissions, --preserve-permissions
extract all protection information
-P, --absolute-names
don't strip leading '/'s from file names
--pax-option KEYWORD-LIST
used only with POSIX.1-2001 archives to modify the way tar han-
dles extended header keywords
--posix
like --format=posix
--preserve
like --preserve-permissions --same-order
--acls this option causes tar to store each file's ACLs in the archive.
--selinux
this option causes tar to store each file's SELinux security
context information in the archive.
--xattrs
this option causes tar to store each file's extended attributes
in the archive. This option also enables --acls and--selinux if
they haven't been set already, due to the fact that the data for
those are stored in special xattrs.
--no-acls
This option causes tar not to store each file's ACLs in the
archive and not to extract any ACL information in an archive.
--no-selinux
this option causes tar not to store each file's SELinux security
context information in the archive and not to extract any
SELinux information in an archive.
--no-xattrs
this option causes tar not to store each file's extended
attributes in the archive and not to extract any extended
attributes in an archive. This option also enables --no-acls and
--no-selinux if they haven't been set already.
-R, --record-number
show record number within archive with each message
--record-size SIZE
use SIZE bytes per record when accessing archives
--recursion
recurse into directories
--recursive-unlink
remove existing directories before extracting directories of the
same name
--remove-files
remove files after adding them to the archive
--rmt-command CMD
use CMD instead of the default /usr/sbin/rmt
--rsh-command CMD
use remote CMD instead of rsh(1)
-s, --same-order, --preserve-order
list of names to extract is sorted to match archive
-S, --sparse
handle sparse files efficiently
--same-owner
create extracted files with the same ownership
--show-defaults
display the default options used by tar
--show-omitted-dirs
print directories tar skips while operating on an archive
--strip-components NUMBER, --strip-path NUMBER
strip NUMBER of leading components from file names before
extraction
(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-compo-
nents
--suffix SUFFIX
use SUFFIX instead of default '~' when backing up files
-T, --files-from F
get names to extract or create from file F
--totals
print total bytes written with --create
-U, --unlink-first
remove existing files before extracting files of the same name
--use-compress-program PROG
access the archive through PROG which is generally a compression
program
--utc display file modification dates in UTC
-v, --verbose
verbosely list files processed
-V, --label NAME
create archive with volume name NAME
--version
print tar program version number
--volno-file F
keep track of which volume of a multi-volume archive its working
in FILEused with --multi-volume
-w, --interactive, --confirmation
ask for confirmation for every action
-W, --verify
attempt to verify the archive after writing it
--wildcards
use wildcards with --exclude
--wildcards-match-slash
wildcards match slashes (/) with --exclude
--exclude PATTERN
exclude files based upon PATTERN
-X, --exclude-from FILE
exclude files listed in FILE
-Z, --compress, --uncompress
filter the archive through compress
-z, --gzip, --gunzip, --ungzip
filter the archive through gzip
--use-compress-program PROG
filter the archive through PROG (which must accept -d)
-[0-7][lmh]
specify drive and density
BUGS
The GNU folks, in general, abhor man pages, and create info documents
instead. The maintainer of tar falls into this category. Thus this
man page may not be complete, nor current, and was included in the Red
Hat CVS tree because man is a great tool :). This man page was first
taken from Debian Linux and has since been loving updated here.
REPORTING BUGS
Please report bugs via https://bugzilla.redhat.com
SEE ALSO
The full documentation for tar is maintained as a Texinfo manual. If
the info and tar programs are properly installed at your site, the com-
mand
info tar
should give you access to the complete manual.
AUTHORS
Debian Linux http://www.debian.org/
Mike Frysinger <vapier@gentoo.org>
GNUOct 2004 TAR(1)
Linux运维人员必会的120个命令来自《跟老男孩学Linux运维:核心系统命令实战》一书
前言
第1章 Linux命令行简介 / 1
1.1Linux命令行概述 / 1
1.2在Linux命令行下查看命令帮助 / 4
1.3Linux shutdown reboot halt / 9
关机:
shutdown -h now
halt
init 0
第2章 文件和目录 *** 作命令 / 13
2.1pwd:显示当前所在的位置 / 13
2.2cd:切换目录 / 16
2.3tree:以树形结构显示目录下的内容 / 18
2.4mkdir:创建目录 / 22
2.5touch:创建空文件或改变文件的时间戳属性 / 27
2.6ls:显示目录下的内容及相关属性信息 / 30
2.7cp:复制文件或目录 / 39
2.8mv:移动或重命名文件 / 42
2.9rm:删除文件或目录 / 45
2.10rmdir:删除空目录 / 48
2.11ln:硬链接与软链接 / 49
2.12readlink:查看符号链接文件的内容 / 54
2.13find:查找目录下的文件 / 55
2.14xargs:将标准输入转换成命令行参数 / 68
2.15rename:重命名文件 / 71
2.16basename:显示文件名或目录名 / 72
2.17dirname:显示文件或目录路径 / 72
2.18chattr:改变文件的扩展属性 / 73
2.19lsattr:查看文件扩展属性 / 75
2.20file:显示文件的类型 / 76
2.21md5sum:计算和校验文件的MD5值 / 77
2.22chown:改变文件或目录的用户和用户组 / 80
2.23chmod:改变文件或目录权限 / 81
2.24chgrp:更改文件用户组 / 85
2.25umask:显示或设置权限掩码 / 86
2.26老男孩从新手成为技术大牛的心法 / 90
第3章 文件过滤及内容编辑处理命令 / 91
3.1cat:合并文件或查看文件内容 / 91
3.2tac:反向显示文件内容 / 103
3.3more:分页显示文件内容 / 104
3.4less:分页显示文件内容 / 107
3.5head:显示文件内容头部 / 109
3.6tail:显示文件内容尾部 / 111
3.7tailf:跟踪日志文件 / 114
3.8cut:从文本中提取一段文字并输出 / 115
3.9split:分割文件 / 117
3.10paste:合并文件 / 118
3.11sort:文本排序 / 123
3.12join:按两个文件的相同字段合并 / 127
3.13uniq:去除重复行 / 129
3.14wc:统计文件的行数、单词数或字节数 / 131
3.15iconv:转换文件的编码格式 / 133
3.16dos2unix:将DOS格式文件转换成UNIX格式 / 134
3.17diff:比较两个文件的不同 / 135
3.18vimdiff:可视化比较工具 / 138
3.19rev:反向输出文件内容 / 139
3.20tr:替换或删除字符 / 140
3.21od:按不同进制显示文件 / 143
3.22tee:多重定向 / 145
3.23vi/vim:纯文本编辑器 / 147
3.24老男孩逆袭思想:做Linux运维的多个好处 / 152
第4章 文本处理三剑客 / 153
4.1grep:文本过滤工具 / 153
4.2sed:字符流编辑器 / 159
4.3awk基础入门 / 165
第5章 Linux信息显示与搜索文件命令 / 176
5.1uname:显示系统信息 / 176
5.2hostname:显示或设置系统的主机名 / 178
5.3dmesg:系统启动异常诊断 / 179
5.4stat:显示文件或文件系统状态 / 181
5.5du:统计磁盘空间使用情况 / 183
5.6date:显示与设置系统时间 / 186
5.7echo:显示一行文本 / 190
5.8watch:监视命令执行情况 / 193
5.9which:显示命令的全路径 / 195
5.10whereis:显示命令及其相关文件全路径 / 196
5.11locate:快速定位文件路径 / 197
5.12updatedb:更新mlocate数据库 / 199
5.13老男孩逆袭思想:新手在工作中如何问问题不会被鄙视 / 200
第6章 文件备份与压缩命令 / 201
6.1tar:打包备份 / 201
6.2gzip:压缩或解压文件 / 208
6.3zip:打包和压缩文件 / 211
6.4unzip:解压zip文件 / 212
6.5scp:远程文件复制 / 214
6.6rsync:文件同步工具 / 216
6.7老男孩逆袭思想:新手如何高效地提问 / 220
第7章 Linux用户管理及用户信息查询命令 / 222
7.1 useradd:创建用户 / 222
7.2usermod:修改用户信息 / 227
7.3userdel:删除用户 / 229
7.4groupadd:创建新的用户组 / 230
7.5groupdel:删除用户组 / 231
7.6passwd:修改用户密码 / 232
7.7chage:修改用户密码有效期 / 237
7.8chpasswd:批量更新用户密码 / 238
7.9su:切换用户 / 240
7.10visudo:编辑sudoers文件 / 242
7.11sudo:以另一个用户身份执行命令 / 244
7.12id:显示用户与用户组的信息 / 248
7.13w:显示已登录用户信息 / 249
7.14who:显示已登录用户信息 / 250
7.15users:显示已登录用户 / 252
7.16whoami:显示当前登录的用户名 / 253
7.17last:显示用户登录列表 / 253
7.18lastb:显示用户登录失败的记录 / 254
7.19lastlog:显示所有用户的最近登录记录 / 255
第8章 Linux磁盘与文件系统管理命令 / 257
8.1fdisk:磁盘分区工具 / 257
8.2partprobe:更新内核的硬盘分区表信息 / 265
8.3tune2fs:调整ext2/ext3/ext4文件系统参数 / 266
8.4parted:磁盘分区工具 / 268
8.5mkfs:创建Linux文件系统 / 272
8.6dumpe2fs:导出ext2/ext3/ext4文件系统信息 / 274
8.7resize2fs:调整ext2/ext3/ext4文件系统大小 / 275
8.8fsck:检查并修复Linux文件系统 / 278
8.9dd:转换或复制文件 / 281
8.10mount:挂载文件系统 / 284
8.11umount:卸载文件系统 / 288
8.12df:报告文件系统磁盘空间的使用情况 / 289
8.13mkswap:创建交换分区 / 293
8.14swapon:激活交换分区 / 294
8.15swapoff:关闭交换分区 / 295
8.16sync:刷新文件系统缓冲区 / 296
第9章 Linux进程管理命令 / 298
9.1ps:查看进程 / 298
9.2pstree:显示进程状态树 / 305
9.3pgrep:查找匹配条件的进程 / 306
9.4kill:终止进程 / 307
9.5killall:通过进程名终止进程 / 310
9.6pkill:通过进程名终止进程 / 311
9.7top:实时显示系统中各个进程的资源占用状况 / 313
9.8nice:调整程序运行时的优先级 / 320
9.9renice:调整运行中的进程的优先级 / 323
9.10nohup:用户退出系统进程继续工作 / 324
9.11strace:跟踪进程的系统调用 / 325
9.12ltrace:跟踪进程调用库函数 / 332
9.13runlevel:输出当前运行级别 / 334
9.14init:初始化Linux进程 / 335
9.15service:管理系统服务 / 335
第10章 Linux网络管理命令 / 338
10.1ifconfig:配置或显示网络接口信息 / 338
10.2ifup:激活网络接口 / 343
ifup eth0
10.3ifdown:禁用网络接口 / 343
ifdown eth0
service network restart(/etc/init.d/network restart) 激活整个网络,所有网卡。
10.4route:显示或管理路由表 / 344
10.5arp:管理系统的arp缓存 / 350
10.6ip:网络配置工具 / 351
10.7netstat:查看网络状态 / 358
10.8ss:查看网络状态 / 362
10.9ping:测试主机之间网络的连通性 / 363
10.10traceroute:追踪数据传输路由状况 / 366
10.11arping:发送arp请求 / 367
10.12telnet:远程登录主机 / 369
10.13nc:多功能网络工具 / 370
10.14ssh:安全地远程登录主机 / 373
10.15wget:命令行下载工具 / 376
10.16mailq:显示邮件传输队列 / 379
10.17mail:发送和接收邮件 / 381
10.18nslookup:域名查询工具 / 386
10.19dig:域名查询工具 / 389
10.20host:域名查询工具 / 393
10.21nmap:网络探测工具和安全/端口扫描器 / 394
10.22tcpdump:监听网络流量 / 398
第11章 Linux系统管理命令 / 407
11.1lsof:查看进程打开的文件 / 407
11.2uptime:显示系统的运行时间及负载 / 411
11.3free:查看系统内存信息 / 411
11.4iftop:动态显示网络接口流量信息 / 413
11.5vmstat:虚拟内存统计 / 415
11.6mpstat:CPU信息统计 / 419
11.7iostat:I/O信息统计 / 420
11.8iotop:动态显示磁盘I/O统计信息 / 423
11.9sar:收集系统信息 / 425
11.10chkconfig:管理开机服务 / 430
11.11ntsysv:管理开机服务 / 433
11.12 setup:系统管理工具 / 434
11.13ethtool:查询网卡参数 / 436
11.14mii-tool:管理网络接口的状态 / 437
11.19rpm:RPM包管理器 / 443
11.20yum:自动化RPM包管理工具 / 446
top命令
第12章 Linux系统常用内置命令 / 450
12.1Linux内置命令概述 / 450
12.2Linux内置命令简介 / 450
12.3Linux常用内置命令实例 / 452
1,Linux下架FTP!!Linux下一般最常用的工具wu-ftpd.
wu-ftpd的安装非常容易,大多数版本的Linux中都包含了wu-ftpd的rpm软件包,你可以在安装Linux时指定装入。如果你想自行编译源代码,也可以到ftp://ftp.wu-ftpd.org下载最新版本的源代码包。
安装好以后,可以用ckconfig命令来检查是否已经正确安装。在/etc/passwd中可以指定ftp用户的登入目录。
wu-ftpd主要有以下6个配置文件:
ftpaccess(主要配置文件,控制存取权限)
ftpconvertions(配置文件压缩/解压缩转换)
ftpgroups(设定ftp自己定义的群组)
ftphosts(设定个别的用户权限)
ftpservers(设定不同IP/Domain Name以对应到不同的虚拟主机)
ftpusers(设定哪些帐号不能用ftp连线)
下面我们来一一介绍。
⒈/etc/ftpaccess(wu-ftpd的主要配置文件)
class--定义群组,用法如下:
class<种类><用户地址>[<用户地址>……]
由class定义的群组用户才可以连线进来,可以使用多层式的class来规范哪些群组的用户能够从哪些地方上来。这里有三个重要的种类,real、anonymous个guest。real如果没有列在定义中,那么这台机器中任何真实的一般用户都无法用自己的帐号连上来。anonymous如果没有在定义,就表示不让没有帐号的的人连上来。如果有定义guest,那么guest群组的人就可以上来。另外<用户地址>是指ftp上来的用户会用到的IP地址,则可自行设定。以下是一些例子:
class all real,guest,anonymous *
定义了一个名为all的class,包含三种人,所有IP的连线用户(也就是所有人都包括了)
class local real localhost loopback
local这个class说,只有real的用户可以从本机机器连上来
class remote guest,anonymous *
remote这个class包含了从任何地方上来的guest和anonymous用户,但是real用户不算
class rmtuser real !*.example.com
rmtuser这个class包含了从外面来的(除了example.com)真实用户
autogroup--自动对应群组,用法如下:
autogroup[……]
当你定义好的那些同属于一个class的用户,一旦连线上来就会被对应到一个相应的群组下面,这样你就可以用Unix的文件权限对某一群人做限制。
deny--拒绝某些地址连线,用法如下:
deny<拒绝连线的地址><信息文件>
禁止某些机器连线,并显示<信息文件>。例如:
deny 210.62.146.*:255.255.255.254 /etc/reject.msg
guestgroup--设定访客群
guestuser--设定访客帐号
realgroup--设定真实群组
realuser--设定真实帐号
nice--设定给某些class多少优先权,用法如下:
nice
在Linux中,nice的值是-20(最优先)到19(最后处理),这里你可以指定负的值来提高某class的优先顺序。
defumask--设定某class的umask,用法如下:
defumask[]
umask是建立文件时该文件的的权限掩码
tcpwindow--设定tcpwindow的大小
keepalive--设定是否使用TCP SO_KEEPALIVE来控制断线情形
timeout--设定连线超时,用法如下:
timeout accept<秒>
接受连线超时,预设120秒
timeout connect<秒>
连线建立超时,预设120秒
timeout data<秒>
数据传送超时,预设1200秒
timeout idle<秒>
用户发呆超时,预设900秒
file-limit--限制某class只能传几个文件,用法如下:
file-limit[][]
对某个class限制存取文件的数目,包含了in(上传)、out(下载),total raw代表整个传输的结果,不光是数据文件。例如:
file-limit out 20 lvfour
限制lvfour这个class的用户最多只能下载20个文件
byte-limit--限制某class只能传几个字节,用法跟file-limit相似
limit-time--限制一个连线只能持续多久,用法如下:
limit-time{*|anonymous|guest}<分钟>
为了避免有人挂在站上不下来,可以用这个方法限制用户的上线时间,例如:
limit-time guest 5
让guest帐号的用户只能用5分钟
limit--限制某class能同时几人上线,用法如下:
limit<连线数目><时间区段><额满信息文件>
设定某个class在某一时间区段内最多能够几人同时上线,后面是当超过连线数目时要显示的信息。例如:
limit all 32 Any /home/ftp/etc/toomanyuser.msg
限制所有连线在任何时间只能有32个用户,超过则拒绝连线并显示信息
limit levellone 5 Any2300-0600 /home/ftp/etc/toomanyuser.msg
限制levellone这个class的用户在23:00到6:00这段时间内只能有5人连线
noretrieve--设定哪些文件不可下载
noretrieve[absolute/relative][class=]…[-][<文件名>…]
absolute或relative指文件是用绝对路径还是相对路径
allow=retrieve--设定哪些文件可以下载
allow[absolute/relative][class=]…[-][<文件名>…]
loginfails--设置登入错误可尝试的次数
当用户连线时可能打错ID或密码,这个设定可以让他打错几次以后就断线,避免有人用穷举法猜测密码。
private--设定线上是否可以执行SITE GROUP/SITE GPASS
当开放SITE GROUP与SITE GPASS指令时,可以用这两个指令切换到/etc/ftpgroup的群组。一般而言我们不会用到这个功能,以避免安全漏洞。
greeting--显示Server的版本信息,用法如下:
greeting
当用户登入画面显示的server信息,full是预设值,包含版本号以及hostname,brief只有hostname,而terse只有“FTP server ready”的信息。
barnner--设定未进入Login画面之前用户看到的信息,用法如下:
banner<文件路径>
这里叙述了在用户登入时,在还没打ID/Password之前要出现的信息。文件路径指的是相对于真实的路径,而不是相对于ftp的根目录。
host--设定ftp主机名
email--指定ftp管理者的email地址
message--信息文件的设定,用法如下:
message<文件>{<何时>{……}}
这里的文件的路径是相对于ftp的根目录的,“何时”是指当你做了什么动作之后的反应,有几个选择:
login(登入时)
cwd=<目录>(进入某目录时)
class 名称是前面已经定义过的,允许你的信息只对哪些人发出。
而信息文件的内容除了文字以外,还可以使用以下一些事先定义好的代号:
%T(本机时间)
%F(目前分区所剩余的空间)
%C(目前所在的目录)
%E(管理者的E-mail)
%R(客户端主机名称)
%L(本机主机名称)
%U(用户名称)
%M(与我相同class用户允许多少人连线)
%N(与我相同class用户目前有多少人连线)
%B(绝对磁盘限制大小,目前分区(单位blocks))
%b(preferred磁盘限制大小,目前分区(单位blocks))
%Q(目前已使用的blocks)
%I(最大可使用的inodes(+1))
%i(Preferred inodes限制)
%q(目前使用的indoes)
%H(超量使用磁盘空间的时间限制)
%h(超量使用文件数目的时间限制)
readme--通知用户哪些README文件已经更新
log commands--记录用户所使用过的命令,用法如下:
log commands<用户种类>
log transfers--记录用户所传输的文件,用法如下:
log transfers<用户种类><传输方向>
设定有哪些类型的用户传输文件需要记录,包含了inbound(用户上传)和outbound(用户下载),例如:
log transfers anonymous,guest inbound,outbound
log security--记录安全性,用法如下:
log security<用户种类>
特别用于记录某类用户关于noretrive、notar等有关安全性的记录
log syslog--记录到系统的syslog文件
alias--设定目录别名,用法如下:
alias<别名字符串><目录>
cdpath--设定cd更换目录搜索顺序
compress,tar--设定是否自动压缩,用法如下:
compress[……]
tar[……]
定义哪些人可以执行压缩以及tar
shutdown--通知用户要关站了
shutdown<信息文件>
如果信息文件存在的话,当这个文件指定的某时间以后,就会拒绝连线并切断已有的连线,等时间一到就关机。这个信息文件的格式如下:
<年><月><日><时><分><拒绝倒数><断线倒数><文字>
daemon address--指定只监听某个IP地址,用法如下:
daemon address
当你有许多IP的时候,使用这个选项将会取消其它任何虚拟FTP主机的设定。不设定的话,监听所有IP。
virtual--设定虚拟FTP站台
wu-ftpd提供了虚拟主机的功能,也就是说,在同一台机器上提供了不同FTP站台,以主机名称或IP来区分;当然你要用名称的话,还需要跟DNS配合才行。virtual有很多个设定:
virtual
<路径>
可以是主机名或IP地址
root指的是ftp的根目录,banner是欢迎信息,logfile指的是这个虚拟站台的log文件
以下是一些例子:
virtual virtual.com.bj root /home/ftp2
virtual virtual.com.bj banner /etc/vftpbanner.2
virtual virtual.com.bj logfile /etc/viftplog.2
virtual
<字母>
用户可以查到hostname跟管理者email,以下是一些例子:
virtual 210.62.146.50 hostname virtual.site.com.bj
virtual vritual.site.com.bj email ftpown@virtual.site.com.bj
virtual
allow<用户>[<用户>……]
virtual
deny<用户>[<用户>……]
很明显,以上两个选项是设定是否允许连线的,以下是一些例子:
virtual virtual.site.com.bj allow *
virtual virtual.site.com.bj deny badman
virtual
private
本虚拟站台拒绝anonymous用户
defaultserver deny <用户>[<用户>……]
defaultserver allow <用户>[<用户>……]
当我们使用了虚拟主机,原先的deny,allow设定不知道要设哪个server,所以会无效,用defaultserver代表原来的主机
defaultserver private
主站台拒绝anonymous用户
passive address--转换IP数值
passive address<外部IP>/cidr
passive ports--passive的ports范围
passive ports
pasv-allow--允许使用pasv
pasv-allow[<地址>……]
port-allow--允许使用port
port-allow[<地址>……]
mailserver--指定Upload通知的mail服务器
incmail--指定anonymous upload的email通知地址
virtual incmail--指定虚拟主机anonymous upload的email通知地址
defaultserver incmail--指定预设主机anonymous upload的email通知地址
mailfrom--通知的寄信人upload
virtual mailfrom--虚拟主机upload通知的寄信人
defaultserver mailfrom--预设主机upload通知的寄信人
chmod--设定是否可以改变文件权限
delete--设定是否可以删除文件
overwrite--覆盖文件
rename--重命名文件
umask--允许设定umask
passwd-check--设定anonymous FTP的密码检查程度,用法如下:
passwd-check()
设定对anonymous ftp用户的密码是否检查,none表示不检查,trivial为包含@的任意密码,rfc822则表示密码要遵循RFC822格式,enforce表示密码检查不过不允许进入,warn表示密码检查不过只出现警告信息。
deny=email--拒绝特定的email当密码
path-filer--摄定哪些文件名不可使用
path-filer<错误信息文件><允许字符><不允许字符>
upload--设定upload权限
upload[absloute/relative][class=]…[-]<设定的目录>>[dirs/nodirs][d_mode]
用来对我们要设定的目录做权限设定:
absoulte/relative使用绝对路径或是相对路径
class=指定某个class
root-dir指的是对哪些root-dir的人,也就是chroot后的登入目录,应用这个规则
设定的目录指的就是我们要限制的目录
yes/no指得是能否在此目录下开新文件
owner,group指出是开出来的文件拥有者及群组
Mode指的是文件权限
dirs/nodirs指的是能否开新目录
d_mode设定建立新目录时目录的权限,如果不设定会根据mode来设定
thoughput--控制下载速度
thoughput<子目录列表><文件><远端地址列表>
对远端的地址,控制他抓某个子目录下的某些文件时的速度,例如:
thoughput /e/ftp * * oo - *
thoughput /e/ftp /sw* * 1024 0.5 *
thoughput /e/ftp sw* readme oo - *
thoughput /e/ftp sw* * oo - *.foo.com
以上的设定你是否能够看出来呢?“oo”表示不限制bytes/sec,“-”或是“1.0”都是代表一倍。第一行的意思是说,在/e/ftp下面的文件不限制下载速度;第二行说,在/sw*下面的任何文件限速为1024bytes/sec*
0.5=512bytes/sec;第三行又把readme文件的限速取消;最后一行则对*.foo.com开放全速。
anonymous-root--对某class设定匿名用户的根目录
anonymous-root[]
guest-root--预设一个guest用户根目录
guest-root[]
其中用于指定uid的范围
deny-uid,deny-gid--拒绝某段UID(GID)范围
allow-uid,allow-gid--允许某段UID(GID)范围
restricted-uid,restricted-gid--限制用户不能离开他的登录目录
unrestricted-uid,unrestricted-gid--用户可以离开他的登录目录
dns refuse_mismatch--设定DNS查到名称与用户设定不符的动作
dns refuse_mismatch<信息文件>[override]
当用户使用未注册IP时,拒绝他的连线,override则是不理会错误而让他连线,信息文件则是我们要给用户看的。
dns refuse_no_reverse--设定无反查记录拒绝连线
dns refuse_no_reverse<信息文件>[override]
当用户的IP反查无记录时,拒绝他的连线
dns resolveoptions--设定DNS解析选项
dns resolveoptions[options]
这里可以设定DNS解析选项
⒉/etc/ftphosts
ftphosts文件其实跟ftpaccess里面的access,deny很像,它是特别用来设定某些ID的连线,它没有class定义,所以必须是真实用户。
allow|deny<用户><地址>[<地址>……]
以下是一些例子:
allow rose 140.0.0/8
deny jack 140.123.0.0:255.255.0.0
允许rose从140.*.*.*进来,拒绝jack从140.123.*.*上来
⒊/etc/ftpservers
这个文件控制了当你有不同的IP/hostname的时候,进来的连线使用哪一个配置文件。例如:
10.196.145.10 /etc/ftpd/ftpaccess.somedomain/
10.196.145.200 /etc/ftpd/ftpaccess.someotherdomain/
some.domain internal
10.196.145.20 /etc/ftpd/config/faqs.org/
ftp.some.domain /etc/ftpd/config/faqs.org/
⒋/etc/ftpusers
在这个文件里记录的用户禁止使用FTP
⒌/etc/ftpgroups
给SITE GROUP指令使用,线上切换group。SITE EXEC容易造成安全漏洞,一般我们都不开放。
⒍/etc/ftpconversions
用来做tar、compress、gzip等动作指令配置文件,只要用预设即可,如果你不开放即时压缩打包,也可以把内容清除。
2,Linux *** 作系统近几年有了蓬勃的发展,在整个世界范围内得到了越来越多公司和团体的支持,尤其是最近IBM公司的鼎力支持,更是使Linux服务器如虎添翼,更上一层楼
Linux *** 作系统近几年有了蓬勃的发展,在整个世界范围内得到了越来越多公司和团体的支持,尤其是最近IBM公司的鼎力支持,更是使Linux服务器如虎添翼,更上一层楼。而在国内,Linux的应用也是方兴未艾,众多公司已经投入到Linux系统的研发和推广工作中。一些优秀的Linux *** 作系统相继出现,比如红旗Linux等。但是我国的Linux应用水平还很低,熟悉Linux的人员严重缺乏,Linux专业人才的缺乏已成为Linux在国内应用和普及的瓶颈问题。据《开放系统世界》2003年第八期介绍,中国五年内Linux人才需求量将会超过120万。而“1+1+1”工程的实施,也是间接地告诉我们这个问题的严重性。如此大好时机,我们干吗还愣着不动呢!如果你是一位Linux爱好者,你可能已经掌握了基本的Linux的知识与 *** 作,毫无疑问,你并不会去满足这样小小的成就。Linux为何如此的流行?其最大的特点莫过于功能强大,性能稳定的服务器应用了。像WWW,MAIL,FTP,DNS和SMB等。在这篇文章中,我将以Redhat Linux 9为蓝本,从Web服务器的一些最基本的 *** 作入手,从初学者使用的态度,让读者正确充分的认识Apache。好,现在就让我们一起踏上征服Apache的自由之路吧。
Apache的主要特征是:
. 可以运行上所有计算机平台;
. 支持最新的HTTP 1.1协议;
. 简单而强有力的基于文件的配置;
. 支持通用网关接口CGI;
. 支持虚拟主机;
. 支持HTTP认证;
. 集成Perl脚本编程语言;
. 集成的代理服务器;
. 具有可定制的服务器日志;
. 支持服务器端包含命令(SSI)
. 支持安全Socket层(SSL)
. 用户会话过程的跟踪能力;
. 支持FastCGI;
. 支持Java Servlets。
安装Apache
下面我们就开始漫漫征服Apache之旅,通过循序渐进的需求实例,一步步地学习使用Apache,从入门到精通。
系统需求
运行Apache不需要太多的计算资源。它在有6-10MB硬盘空间和8MB RAM的Linux系统上运行得很好。然而,只运行Apache可能不是你想做的事情。更可能的是,你想运行Apache来提供WWW服务、启动CGI进程以及充分利用所有WWW能够提供的令人惊奇的功能。在这种情况下,你需要提供反映负载要求的额外的磁盘空间和内存空间。也就是说,如果仅仅是启动WWW服务并不需要太多的系统资源,但是想要能为大量的客户提供服务就需要更多的系统资源。
获取软件
你可以在http://www.apache.org中获得Apache的最新版。而几乎所有的Linux发行版中均包含有Apache软件包,你也可以直接使用它。
需要注意的是,Apache软件包有两种:一种是源代码,下载后需要自己重新编译;另一种是可执行文件,下载后只需解压就可以使用。
安装软件
你可以通过以下三种方法安装Apache服务器。
1.如果你安装的Linux版本中带用Apache的话,就在选择所要安装的服务器的时候,将httpd这个服务选上,Linux安装程序将自动完成Apache的安装工作,并做好基本的配置。
2.使用可执行文件软件包,这比较适合那些对编译工作不是太熟悉的初级用户,因为它相对比较简单。
下载软件包apache_1.2.4.e.tar.gz
tar xvzf apache_1.2.4.e.tar.gz
这就完成了安装工作,简单吧!
如果你使用的是RedHat Linux的话,你也可以下载apache_1.2.4.rpm软件安装包,然后使用rpm -ivh apache_1.2.4.rpm命令安装。
3.如果你想把Apache服务器充分利用起来的话,就一定要自己编译Apache定制其功能。
下载包含Apache源代码的软件包apache_1.2.4.tar.gz; 然后用tar命令将它解开; 将当前目录改变为Apache源代码发行版的src目录; 将配置样本文件(Configuration.tmpl)复制为Configuration文件;
编辑Configuration文件中的配置选项:
Makefile配置选项:一些编译选项:
. "CC="一行指定用什么编译软件编译,一般为"CC=gcc";
. 如果需要将额外的标志(参数)指定给C编译软件,可以使用:
EXTRA_CFLAGS=
EXTRA_LFLAGS=
. 如果系统需要特殊的库和包含文件,可以在这里指定它们:
EXTRA_LIBS=
EXTRA_INCLUDES=
. 如果你要改变代码优化设置的话,你须将下面一句去掉注释,然
后改成你所需要的值:
#OPTIM=-O2
Rule配置选项:用来决定需要什么功能,一般情况下无需改变。
模块配置:模块是Apache的组成部分,它为Apache内核增加新功能。通过使用模块配置,可以自定义在Apache服务器中需要什么功能,这个部分也是Apache灵活性的表现。模块配置行如下所示:
AddModule modules/standard/mod_env.o
如果你需要Apache服务器具备什么功能,就将那个模块用AddModule语句加到配置文件Configuration中去。
3,一、 MYSQL的基本概念
1、MYSQL的定义
MYSQL一种多用户、多任务的数据库服务器软件
2、MYSQL的特点
支持多平台,没有内存漏洞,分布式处理
支持JAVA、PHP、PERL、支持数据类型
支持ODBC,支持SQL查询
二、 安装MYSQL的服务器
1、 RPM方式MYSQL
#RPM –ivh MYSQL-3。23-3.i386.rpm
#RPM –ivh MYSQL-client-3.23-33.i386.rpm
#RPM-ivh MYSQL-Shared.3.23-33.i386.rpm
#Tpm -ivh MYSQL –server.3.23-33.i386.rpm
2.编译安装方式
#tar -xvzf mysql 3.23.tar.gz
# cdmysql-3.23
#/configure --prdfix=/usr/local
#make
#malke install
# cd/usr/local/bin/
#/mysql-install-db 初始数据库系统。
系统库作用:记录服务器的设置参数,存放用户库信息
安全选项
#safe-mysqld
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)