手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网站运营>建站经验>列表

利用BusyBox定制Linux Live CD

来源:互联网 作者:west263.com 时间:2008-04-16
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!
  mkdir -p /v1

The VolGroup would be mounted as ext3, most likely by doing the following after creating a mount point "/v1", then, "mount -t ext3 /dev/VolGroup00/LogVol01 /v1". But, would require the proper device drivers to be loaded in the kernel module, and the needed configuration in "/etc/rc.sysinit", notably the section under "# LVM2 initializtion". All of this will be discussed in a future update of this article.


STEP 5: Needed Files and Directories (files and directories in "etc" and "var")

Create the necessary files in "etc". Exit out of root at this point, so that there is no chance of over-writing you system "/etc" -- note disaster is only a "/" away. WARNING: Never copy anything into a directory that starts with "/", since that is your current running system.

  [Exit out of root]

The "etc/passwd" file is shown below. Since the ssh daemon will run, an account will be created for it. Note for sshd that login is set to "/bin/false"

  [etc/passwd]

root:x:0:0:Linux User,,,:/root:/bin/sh

sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/bin/false

Below "root" and "sshd" have been added to the group.

  [etc/group]

root:x:0:root

sshd:x:74:

Note below that there is a password for the account root. This encrypted password is "root". You could create your own password here by copying an existing account password from "/etc/shadow" and "/etc/shadow-". The account "sshd" should have "*" for the password.

  [etc/shadow]

root:$1$$oCLuEVgI1iAqOA8pwkzAg1:12439:0:99999:7:::

sshd:*:11880:0:99999:7:-1:-1:0

[etc/shadown-]

root:$1$$hCYnkWaG0VVCE9xJiIJwU/:12439:0:99999:7:::

sshd:*:11880:0:99999:7:-1:-1:0

Interesting question regarding sshd: Why is "/dev/pts" necessary when sshing into this computer? If you are uncertain, remove this line and observe the results of the command "ps aux", when attempting to ssh in.

  [etc/fstab]

/dev/ram0 /      ext2    defaults     0      0

proc  /proc      proc    defaults     0      0

sysfs /sys       sysfs   defaults     0      0

none  /dev/pts   devpts  gid=5,mode=620 0    0

The file "etc/inittab" is called by the init program. There are no run levels with BusyBox. The lines "tty2::respawn:/sbin/getty 38400 tty2" allow you to enter "ctl-alt-F2" and get a login screen.

  [etc/inittab]

# This is run first except when booting in single-user mode.

#

::sysinit:/etc/init.d/rcS

#

#

::respawn:/sbin/getty 38400 tty1

#

# /sbin/getty invocations for selected ttys

#

#tty1::respawn:/sbin/getty 38400 tty1

tty2::respawn:/sbin/getty 38400 tty2

tty3::respawn:/sbin/getty 38400 tty3

tty4::respawn:/sbin/getty 38400 tty4

tty5::respawn:/sbin/getty 38400 tty5

tty6::respawn:/sbin/getty 38400 tty6

tty7::respawn:/sbin/getty 38400 tty7

tty8::respawn:/sbin/getty 38400 tty8

tty9::respawn:/sbin/getty 38400 tty9

#

#

# Example of how to put a getty on a serial line (for a terminal)

#

#::respawn:/sbin/getty -L ttyS0 9600 vt100

#::respawn:/sbin/getty -L ttyS1 9600 vt100

#

# Example how to put a getty on a modem line.

#::respawn:/sbin/getty 57600 ttyS2

#

# Stuff to do when restarting the init process

::restart:/sbin/init

#

# Stuff to do before rebooting

::ctrlaltdel:/sbin/reboot

::shutdown:/bin/umount -a -r

::shutdown:/sbin/swapoff -a

Note above, "inittab" calls "etc/init.d/rcS". The ram drive must be remounted; otherwise, it will be read only. Also, when the system boots, DHCP will be enabled. If the computer is not going to be connected to the network, comment this out, since it will repeatedly attempt to acquire an IP address. Also, if the proper NIC (Network Interface Card) is not found, you will inundated with messages.

  [etc/init.d/rcS]

#!/bin/sh

/bin/mount -a

# below getting rid of ram being mounted ro

/bin/mount -o remount /

#

# The following is for dhcp

#

ifconfig eth0 0.0.0.0

/sbin/udhcpc

#

# Instead, if you want static IP address

#

#ifconfig eth0 192.168.1.13  netmask 255.255.252.0

#route add default gw 192.168.1.1

#

# Run ssh daemon

/sbin/sshd

The file below, along with libraries /lib/libnss_* are necessary for password authentication, since the recent version of GNU Libc (glibc) uses Name Service Switch (NSS). This file can probably be copied from your system's "/etc/nsswitch.conf" file. If you don't have this file on your system, take the necessary files from "proj1.tar.gz".

  [etc/nsswitch.conf]

#

# /etc/nsswitch.conf

#

# An example Name Service Switch config file. This file should be

# sorted with the most-used services at the beginning.

#

# The entry '[NOTFOUND=return]' means that the search for an

# entry should stop if the search in the previous entry turned

# up nothing. Note that if the search failed due to some other reason

# (like no NIS server responding) then the search continues with the

# next entry.

#

# Legal entries are:

#

#       nisplus or nis          Use NIS  (NIS version 3)

#       nis or yp               Use NIS (NIS version 2), also called YP

#       dns                     Use DNS (Domain Name Service)

#       files                   Use the local files

#       db                      Use the local database (.db) files

#       compat                  Use NIS on compat mode

#       hesiod                  Use Hesiod for user lookups

#       [NOTFOUND=return]       Stop searching if not found so far

#

# To use db, put the "db" in front of "files" for entries you want to be

# looked up first in the databases

#

# Example:

#passwd:    db files nisplus nis

#shadow:    db files nisplus nis

#group:     db files nisplus nis

passwd:     files

shadow:     files

group:      files

#hosts:     db files nisplus nis dns

hosts:      files dns

# Example - obey only what nisplus tells us...

#services:   nisplus [NOTFOUND=return] files

#networks:   nisplus [NOTFOUND=return] files

#protocols:  nisplus [NOTFOUND=return] files

#rpc:        nisplus [NOTFOUND=return] files

#ethers:     nisplus [NOTFOUND=return] files

#netmasks:   nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers:     files

netmasks:   files

networks:   files

protocols:  files

rpc:        files

services:   files

netgroup:   files

publickey:  nisplus

automount:  files

aliases:    files nisplus


文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!