linux系统安全基础笔记之一

 系统和用户管理基础
一、用户安全
/etc/securetty 文件
       列出了root登陆时使用的tty设备。应该仅包括本地控制台。
示例文件(已经修改过了):
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console

# for people with serial port consoles
ttyS0

# for devfs
tts/0

# Standard consoles
tty1
tty2
tty3

# Same as above, but these only occur with devfs devices
vc/1
vc/2
vc/3

   如果文件内容为空,则在多用户级别下,只能通过su命令使用root权限。

/etc/skel/.bash_logout
    在该文件中加入一行:
        /usr/bin/clear
    这样用户在退出自己的shell是可以清除屏幕显示的内容。
   
/etc/shells
    将文件中只留下下面一行作为用户缺省shell:
    /bin/bash

SysV初始化进程

    1、系统启动进程的/etc/inittab文件:
       示例文件如下:
        l0:0:wait:/etc/init.d/rc 0
        l1:1:wait:/etc/init.d/rc 1
        l2:2:wait:/etc/init.d/rc 2
        l3:3:wait:/etc/init.d/rc 3
        l4:4:wait:/etc/init.d/rc 4
        l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

    运行级别即前两个冒号中间的数字,每个运行级别都将调用一个脚本,即 
/etc/init.d/rc,并且运行级别将作为参数传递给该脚本。
        脚本目录或许是/etc/rc.d/rc0.d到/etc/rc.d/rc6.d。某些linux可能放在
/etc/rc0.d到/etc/rc6.d中。

禁止不需要的服务:
        cd /etc/init.d/rc2.d
        mkdir disable
    mv S91Apache disable
        reboot
重启系统后上述修改才生效。

激活被禁止的服务:
       cd /etc/init.d/rc2.d
   Mv disable/S91Apache ./


安全的创建用户账号

确定系统支持shadow passwd
        检查/etc/shadow是否存在
/etc/shadow应该只对root可读
如果/etc/shadow文件不存在或者普通用户可读该文件则系统没有安装shadow
或者安装不正确。

添加用户
        (1)、创建组
            查看目前使用的最大的组号码:
            cat /etc/group |cut -d:-f3 |sort -n
            建组:
            /usr/sbin/groupadd -g 6001 username

        (2)、创建用户
           
/usr/sbin/useradd -u 6001 -g username /
-d /home/username -m username

、修改密码passwd并使用chage命令设置策略
            passwd username
            chage -m 0 -M 90 -d 0 -I 0 -E 0 -W 10 username
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值