一:Linux登陆系统时启动脚本的次序
/etc/profile
/root/.bash_profile
/root/.bashrc
/etc/bashrc
二:给vim添加颜色
进入vi后输入ESC :syntax enable
三:进入单用户模式不用输入root密码reboot后进入grub画面输入a然后在append后面输入1就进入单用户模式了
以上的进入模式不安全,下面我们就用grub设定进入单用户模式的密码
首先打开/boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.EL.img
原始文件我们只要在splashimage=(hd0,0)/grub/splash.xpm.gz后面加入
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.EL.img
原始文件我们只要在splashimage=(hd0,0)/grub/splash.xpm.gz后面加入
passwd redhat就可以了最后别忘记修改文件属性其他人不能查看啊,不然白费。。
当然这里的密码是明文的,我们同时可以使用grub-md5-crypt使用加密的md5,就算有查看的权限也不能很顺利的知道密码了-。 -
但是这里和以前有不同的就是输入passwd --md5 加密的md5就ok了
四:/etc/rc.d/rc*.d/目录下的文件格式
lrwxrwxrwx 1 root root 13 Jan 2 19:23 K35smb -> ../init.d/smb
lrwxrwxrwx 1 root root 19 Jan 2 19:26 K35vncserver -> ../init.d/vncserver
lrwxrwxrwx 1 root root 17 Jan 2 19:54 K35winbind -> ../init.d/winbind
lrwxrwxrwx 1 root root 16 Jan 2 19:20 K50ibmasm -> ../init.d/ibmasm
lrwxrwxrwx 1 root root 17 Jan 2 19:21 K50netdump -> ../init.d/netdump
lrwxrwxrwx 1 root root 13 Jan 2 19:21 K50tux -> ../init.d/tux
lrwxrwxrwx 1 root root 16 Jan 2 19:54 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx 1 root root 14 Jan 2 19:54 K74nscd -> ../init.d/nscd
lrwxrwxrwx 1 root root 14 Jan 2 20:09 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 15 Jan 2 19:21 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx 1 root root 16 Jan 2 19:17 K87auditd -> ../init.d/auditd
lrwxrwxrwx 1 root root 14 Jan 2 20:27 K87ipmi -> ../init.d/ipmi
lrwxrwxrwx 1 root root 18 Jan 2 19:17 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx 1 root root 19 Jan 2 19:20 K90bluetooth -> ../init.d/bluetooth
lrwxrwxrwx 1 root root 18 Jan 2 19:20 K94diskdump -> ../init.d/diskdump
lrwxrwxrwx 1 root root 23 Jan 2 19:21 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 25 Jan 2 19:21 S04readahead_early -> ../init.d/readahead_early
lrwxrwxrwx 1 root root 15 Jan 2 19:18 S05kudzu -> ../init.d/kudzu
lrwxrwxrwx 1 root root 17 Jan 2 19:20 S05openibd -> ../init.d/openibd
lrwxrwxrwx 1 root root 18 Jan 2 19:21 S06cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx 1 root root 18 Jan 2 19:21 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 14 Jan 2 19:21 S09isdn -> ../init.d/isdn
lrwxrwxrwx 1 root root 19 Jan 2 19:26 K35vncserver -> ../init.d/vncserver
lrwxrwxrwx 1 root root 17 Jan 2 19:54 K35winbind -> ../init.d/winbind
lrwxrwxrwx 1 root root 16 Jan 2 19:20 K50ibmasm -> ../init.d/ibmasm
lrwxrwxrwx 1 root root 17 Jan 2 19:21 K50netdump -> ../init.d/netdump
lrwxrwxrwx 1 root root 13 Jan 2 19:21 K50tux -> ../init.d/tux
lrwxrwxrwx 1 root root 16 Jan 2 19:54 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx 1 root root 14 Jan 2 19:54 K74nscd -> ../init.d/nscd
lrwxrwxrwx 1 root root 14 Jan 2 20:09 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 15 Jan 2 19:21 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx 1 root root 16 Jan 2 19:17 K87auditd -> ../init.d/auditd
lrwxrwxrwx 1 root root 14 Jan 2 20:27 K87ipmi -> ../init.d/ipmi
lrwxrwxrwx 1 root root 18 Jan 2 19:17 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx 1 root root 19 Jan 2 19:20 K90bluetooth -> ../init.d/bluetooth
lrwxrwxrwx 1 root root 18 Jan 2 19:20 K94diskdump -> ../init.d/diskdump
lrwxrwxrwx 1 root root 23 Jan 2 19:21 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 25 Jan 2 19:21 S04readahead_early -> ../init.d/readahead_early
lrwxrwxrwx 1 root root 15 Jan 2 19:18 S05kudzu -> ../init.d/kudzu
lrwxrwxrwx 1 root root 17 Jan 2 19:20 S05openibd -> ../init.d/openibd
lrwxrwxrwx 1 root root 18 Jan 2 19:21 S06cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx 1 root root 18 Jan 2 19:21 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 14 Jan 2 19:21 S09isdn -> ../init.d/isdn
K表示kill,S表示Start表示对应启动级别时时候执行和不执行的
数字表示执行的先后词语,数字越小的越先执行先执行K后执行S。
五:服务控制
ntsysv直接执行的话只设定当前runlevel,如果想在其他runlevel设定的话需要输入参数ntsysv --level 35
chkconfig 服务名称 --level runlevel on|off就完成了
service 服务名称 start|restart|stop