?? 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 + -