📄 00000003.htm
字号:
/bin/ifconfig eth0 192.168.0.254 <BR>/bin/ifconfig eth1 211.69.207.21 <BR>/bin/ip route add default via 211.69.207.254 dev eth1 <BR>/bin/ip route replace 192.168.0.0/24 dev eth0 scope link <BR>/bin/ip route replace 211.69.207.0/24 dev eth1 scope link <BR> <BR>前两行设置ip地址,第三行设置缺省网关,后面两行更改本网路由。 <BR> <BR>rc.firewall的写法大家可以自己参照iptables的HOWTO去完成 <BR> <BR>/etc/passwd,/etc/shadow,/etc/group记录有系统帐号信息,在最小系统上, <BR>我只留了root组(用户)的信息。 <BR> <BR> 裁减Linux(12) <BR>裁减Linux过程中,PAM是一个很关键的部分,由于资料不多,很多人束手无策。 <BR> <BR>如果仅仅要使用最小系统,从console登陆需要修改/etc/pam.d/login,从ssh <BR>上来修改/etc/pam.d/sshd,不妨复制系统原来的配置文件略作修改 <BR>/etc/pam.d/login为 <BR> <BR>#%PAM-1.0 <BR>auth required /lib/security/pam_stack.so service=system-auth <BR>account required /lib/security/pam_stack.so service=system-auth <BR>password required /lib/security/pam_stack.so service=system-auth <BR>session required /lib/security/pam_stack.so service=system-auth <BR> <BR>/etc/pam.d/sshd和login的内容一样。从其可知它们调用了system-auth这个服务, <BR>则还需要/etc/pam.d/system-auth,内容为: <BR> <BR>#%PAM-1.0 <BR># This file is auto-generated. <BR># User changes will be destroyed the next time authconfig is run. <BR> <BR>auth sufficient /lib/security/pam_unix.so likeauth nullok <BR>account required /lib/security/pam_unix.so <BR>password sufficient /lib/security/pam_unix.so nullok use_authtok md5 s <BR>hadow <BR>session required /lib/security/pam_unix.so <BR> <BR>排版原因,第三行应该是完整的。 <BR> <BR>裁减Linux(13) <BR>关机和重启 <BR> <BR>关机和重启在完整的Linux下面是有很长的脚本支持的,就像启动脚本/etc/rc.sysinit <BR>等等。但是在最小系统上面,这些都需要自己来写,复制原有系统的肯定不行。 <BR> <BR>不过从前面/etc/inittab里面可以知道,最小系统上面reboot执行的是/etc/rc6, <BR>关机是/etc/rc0,如果不需要“善后”,则很简单,rc6如下: <BR> <BR>[root@MiniLinux etc]# cat rc6 <BR>/sbin/reboot -i -d <BR> <BR>rc0则为: <BR>[root@MiniLinux etc]# cat rc0 <BR>/sbin/halt -i -d -p <BR> <BR>整个etc目录下的东西列表大致为: <BR>[root@MiniLinux etc]# ll <BR>total 891 <BR>-rw-r--r-- 1 root root 6639 Apr 19 2002 fonts.cgz <BR>-rw-r--r-- 1 root root 109 Dec 30 06:19 fstab <BR>-rw-r--r-- 1 root root 14 Dec 14 00:10 group <BR>-rw-r--r-- 1 root root 146 Dec 27 15:41 inittab <BR>-rw------- 1 root root 60 Jan 6 15:14 ioctl.save <BR>-rw-r--r-- 1 root root 57 Dec 12 01:26 issue <BR>-rw-r--r-- 1 root root 28436 Apr 19 2002 keymaps.gz <BR>-rw-r--r-- 1 root root 3758 Apr 19 2002 kon.cfg <BR>-rw-r--r-- 1 root root 1281 Apr 19 2002 lang-table <BR>-rw-r--r-- 1 root root 1320 Dec 30 06:55 ld.so.cache <BR>-rw-r--r-- 1 root root 18 Dec 12 07:53 ld.so.conf <BR>-rw-r--r-- 1 root root 54692 Apr 19 2002 loader.tr <BR>-rw-r--r-- 1 root root 1180 Dec 23 09:07 login.defs <BR>-rw-r--r-- 1 root root 30303 Apr 19 2002 minikon.fnt <BR>-rw-r--r-- 1 root root 0 Dec 13 23:39 mtab <BR>-rw-r--r-- 1 root root 270 Dec 23 04:03 nsswitch.conf <BR>drwxr-xr-x 2 root root 1024 Dec 30 04:48 pam.d <BR>-rw-r--r-- 1 root root 28 Dec 30 06:29 passwd <BR>-rwxr-xr-x 1 root root 401 Dec 30 07:43 profile <BR>-rw-r--r-- 1 root root 12359 Apr 19 2002 ramfs.img <BR>lrwxrwxrwx 1 root root 7 Dec 26 03:03 rc -> rc.d/rc <BR>drwxr-xr-x 2 root root 1024 Dec 27 15:33 rc.d <BR>-rwxr-xr-x 1 root root 2631 Jan 6 02:18 rc.firewall <BR>-rwxr-xr-x 1 root root 246 Jan 6 02:17 rc.network <BR>-rwxr-xr-x 1 root root 20 Dec 27 15:38 rc0 <BR>-rwxr-xr-x 1 root root 19 Dec 27 15:39 rc6 <BR>-r-------- 1 root root 59 Dec 30 06:20 shadow <BR>drwxr-xr-x 2 root root 1024 Dec 26 06:37 ssh <BR>-rw-r--r-- 1 root root 737535 Dec 23 10:18 termcap <BR> <BR>其中目录ssh为sshd的配置文件,复制原来机器上的即可 <BR>其他的大部分文件都是按照HOWTO上面提到的一些必备文件复制的。 <BR> <BR>nsswitch.conf是系统寻找一些配置文件的配置文件,呵呵,很拗口, <BR>man nsswitch.conf看看吧,稍作修改为: <BR>[root@MiniLinux /]# cat etc/nsswitch.conf <BR>passwd: files <BR>shadow: files <BR>group: files <BR>hosts: files <BR>services: files <BR>networks: files <BR>protocols: files <BR>rpc: files <BR>ethers: files <BR>netmasks: files <BR>bootparams: files <BR>automount: files <BR>aliases: files <BR>netgroup: files <BR>publickey: files <BR> <BR> <BR>profile文件是bash shell的登陆脚本,主要为了限制历史命令记录大小 <BR> <BR>[root@MiniLinux etc]# cat profile <BR># /etc/profile <BR># System wide environment and startup programs, for login setup <BR># Functions and aliases go in /etc/bashrc <BR>HISTSIZE=1000 <BR>HISTFILESIZE=20 <BR>PATH=/bin <BR>PS1='[\u@\h \W]\$ ' <BR>HOSTNAME='/bin/hostname' <BR>export PATH HISTSIZE HISTFILESIZE HOSTNAME PS1 <BR>alias l.='ls -d .[a-zA-Z]* --color=tty' <BR> <BR>alias ll='ls -l --color=tty' <BR>alias ls='ls --color=tty' <BR>alias rm='rm -i' <BR>alias cp='cp -i' <BR>alias mv='mv -i' <BR> <BR>裁减Linux(14) <BR>关于/dev目录 <BR> <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -