Build a mini Linux from scratch (6)

Source: Internet
Author: User
Tags openssl



26. Further increase the function (boot auto-load NIC driver, set host name)

27.11th Test Start

28. Create/etc/sysconfig/network and/etc/issue files

29. Set Up Login authentication

30.12th Test Start




26. Further increase the function (boot auto-load NIC driver, set host name)

[[email protected] ~]# cd /mnt/sysroot/[[email  protected] sysroot]# vim etc/rc.d/rc.sysinit echo -e  "\tWelcome to +++ + \033[32mmini\033[0m linux "mount -n -t proc proc /procmount -n - t sysfs sysfs /sysecho  "Scan /sys and to populate to /dev ..." mdev -smount -o remount,rw /dev/sda2 /echo  "Mounting all filesystems ... "mount -aecho " load driver for e1000 "insmod /lib/modules/e1000.koecho " Initializing ehternet card ... "ifconfig eth0 192.168.139.200 up[ -f /etc/ sysconfig/network ] && . /etc/sysconfig/network[ -z  "$HOSTNAME"  -o   "$HOSTNAME"  ==  ' (none) '  ] && hostname= ' miniover ' hostname  $HOSTNAME 



27.11th Test Start


650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/77/wKioL1hPQlSgXY3DAAAif0yKhtE427.png-wh_500x0-wm_3 -wmp_4-s_2235777527.png "style=" Float:none; "title=" 1.png "alt=" Wkiol1hpqlsgxy3daaaif0ykhte427.png-wh_50 "/>


650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8B/77/wKioL1hPQlSQtT6NAAAlcsVazwk548.png-wh_500x0-wm_3 -wmp_4-s_3720670809.png "style=" Float:none; "title=" 2.png "alt=" Wkiol1hpqlsqtt6naaalcsvazwk548.png-wh_50 "/>



28. Create/etc/sysconfig/network and/etc/issue files


Set host name [[email protected] ~]# cd/mnt/sysroot/[[email protected] sysroot]# mkdir etc/sysconfig[[email protected] sysroot]# Vim etc/sysconfig/networkhostname=minilinux.com Print Welcome message [[email protected] sysroot]# vim etc/issuewelcome to My Minilinux (URL) Kernel \ r



29. Set Up Login authentication

[[email protected] sysroot]# touch etc/passwd[[email protected] sysroot]#  Touch etc/shadow[[email protected] sysroot]# touch etc/group[[email protected]  sysroot]# vim etc/inittab::sysinit:/etc/rc.d/rc.sysinit::respawn:/sbin/getty 9600  tty1::respawn:/sbin/getty 9600 tty2  -->  automatically calls the login program::respawn:/sbin/getty  9600 tty3::ctrlaltdel:/sbin/reboot::shutdown:/bin/umount -a -r[[email protected] ~]#  ./copycmd.sh  (Porting bash program) [[EMAIL PROTECTED] SYSROOT]# HEAD -1 /ETC/PASSWD  > etc/passwd  //establishing an administrator user [[email protected] sysroot]# head -1 / Etc/shadow > etc/shadow[[email protected] sysroot]# head -1 /etc/group  > etc/group Note: At this time our host password is sha512, the target system can not understand, all we use MD5 to encrypt the target host on the root user (1) Generate MD5 password string [[email  Protected] ~]# openssl passwd -1 -salt $ (openssl rand -hex 4) Password:  (enter password manually) $1$ 6642c636$d3gnkpmq1nrt9kyxvp8u8/(2) Replaces the encrypted password field of the original Etc/shadow with the generated string [[email protected] sysroot]#  Vim etc/shadowroot:$1$6642c636$d3gnkpmq1nrt9kyxvp8u8/:17002:0:99999:7::: Note: Use the sha512 password encryption directly, also can (that is, do not replace the target system is also applicable )



30.12th Test Start


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8B/77/wKioL1hPQ4aQ7z4rAAARIRFM-Hc056.png-wh_500x0-wm_3 -wmp_4-s_3596182691.png "style=" Float:none; "title=" 1.png "alt=" Wkiol1hpq4aq7z4raaarirfm-hc056.png-wh_50 "/>



650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8B/77/wKioL1hPQ4byH50LAAAoWxLbPAk025.png-wh_500x0-wm_3 -wmp_4-s_3503379121.png "style=" Float:none; "title=" 2.png "alt=" Wkiol1hpq4byh50laaaowxlbpak025.png-wh_50 "/>



650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8B/7B/wKiom1hPQ4bAHAMpAAAakRSCi64380.png-wh_500x0-wm_3 -wmp_4-s_4205252803.png "style=" Float:none; "title=" 3.png "alt=" Wkiom1hpq4bahampaaaakrsci64380.png-wh_50 "/>



This article is from the "Homecoming" blog, make sure to keep this source http://sixijie123.blog.51cto.com/11880770/1882119

Build a mini Linux from scratch (6)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.