Linux System clipping note three user

Source: Internet
Author: User

Linux system cropping notes

1. What is cut?

The main purpose of this article is to give the author and readers a deeper understanding of how the Linux system works, the general content is to take Linux apart from the components to assemble, and then complete a micro Linux system. Let's do it now. Please advise me where the writing is not good.

2. Principle

As we all know, the operating system start-up process is (mainly Linux):P Ost->bios->mbr-kernel-->initrd-->sbin/init,

Post,bios is not our tube, so here we start from the MBR, Linux system boot is mainly used grub this software, Grub boot system, and then start the kernel, the kernel calls INITRD to achieve the most basic operating system,

3. Experiments (all operations are implemented on the virtual machine and the IDE is selected when the hard drive is defined)

Environment: 1). Install a red Hat Linux5.4 on the host and install the operating systemon the/DEV/SDA ;

2). Create a new hard disk on the host :/dev/hda, and the partition is 20M sdb1,512M sdb2;

3). Create another test virtual machine, delete the original hard drive, and then add the hard disk /dev/hda to the test virtual machine;

4). When the system service starts, the display is turned on;

5). New Start-up network module;

6). New kernel control module;

7). User Login


Login: User Login Verification

Nsswitch: Network Service Switch

Frame:/etc/passwd,/etc/shadow,/etc/group

Library: LibNSS_file.so,libNSS_nis.so, LibNSSs_ldap.so

Configuration file:/etc/nsswitch.conf


[[email protected] sysroot]# cat /etc/nsswitch.conf # View configuration file
Passwd:files
Shadow:files
Group:files
Hosts:files DNS

...

[[email protected] sysroot.5]# CP -D /lib/libnss_files*/mnt/sysroot/lib/ # Copy library file

[[email protected] sysroot]# ll lib/libnss_files* # Verification
-rwxr-xr-x 1 root root 46680 Nov 13:55 lib/libnss_files-2.5.so
lrwxrwxrwx 1 root root 13:55 lib/libnss_files.so.2-libnss_files-2.5.so

[Email protected] sysroot.5]# CP -D /usr/lib/libnss3.so/usr/lib/libnssckbi.so/usr/lib/ Libnssutil3.so/mnt/sysroot/usr/lib

[Email protected] lib]# ln -sv. /.. /lib/libnss_files.so.2 libnss_files.so

[[email protected] sysroot]# ll /mnt/sysroot/usr/lib/ # Verification

-rwxr-xr-x 1 root root 1188804 Nov 14:41 libnss3.so
-rwxr-xr-x 1 root root 373992 Nov 14:41 libnssckbi.so
lrwxrwxrwx 1 root root 14:42 libnss_files.so. /.. /lib/libnss_files.so.2
-rwxr-xr-x 1 root root 98532 Nov 14:41 libnssutil3.so
...

[[email protected] sysroot]# vim /mnt/sysroot/etc/nsswitch.conf # New library file
Passwd:files
Shadow:files
Group:files
Hosts:files DNS

[Email protected] sysroot]# grep-e "Root|hadoop"/etc/passwd #新建用户相关文件
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
Hadoop:x:500:500::/home/hadoop:/bin/bash
[Email protected] sysroot]# grep-e "Root|hadoop"/etc/passwd >/mnt/sysroot/etc/passwd

[Email protected] sysroot]# grep-e "Root|hadoop"/etc/shadow
Root:$1$u2o9sj7z$xz8stp0grpk5pg3vq0l0d.:17130:0:99999:7:::
Hadoop:$1$nwkmjg/4$aec.i.tpunrfg5q8zb/4i.:17132:0:99999:7:::
[Email protected] sysroot]# grep-e "Root|hadoop"/etc/shadow >/mnt/sysroot/etc/shadow

[[email protected] sysroot]# grep-e "^ (root|hadoop)"/etc/group
Root:x:0:root
HADOOP:X:500:
[[email protected] sysroot]# grep-e "^ (root|hadoop)"/etc/group >/mnt/sysroot/etc/group


[[email protected] sysroot]# vim etc/inittab # Modify login Command Mingetty

Id:3:initdefault:
Si::sysinit:/etc/rc.d/rc.sysinit
L0:0:WAIT:/ETC/RC.D/RC 0

L1:1:WAIT:/ETC/RC.D/RC 1

L3:3:WAIT:/ETC/RC.D/RC 3
L6:6:WAIT:/ETC/RC.D/RC 6
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty Tty2
3:2345:respawn:/sbin/mingetty Tty3


[email protected] bin]# CP login/mnt/sysroot/bin/
[Email protected] bin]# ldd Login #关联的库文件
Linux-gate.so.1 = (0x00eac000)
Libcrypt.so.1 =/lib/libcrypt.so.1 (0x024cd000)
libm.so.6 =/lib/libm.so.6 (0x00d63000)
libc.so.6 =/lib/libc.so.6 (0x00c1b000)
/lib/ld-linux.so.2 (0x00bfd000)


[Email protected] rc.d]# mkdir rc1.d
[Email protected] rc.d]# CD rc1.d/
[Email protected] rc1.d]# LN-SV. /init.d/network K
K33tserver K90network
[Email protected] rc1.d]# LN-SV. /init.d/network K90network
[Email protected] rc1.d]# LN-SV. /init.d/tserver K33tserver
[Email protected] etc]# vim rc.d/init.d/single
#!/bin/bash
#
#chkconfig:
# Description:
#
Case $ in
Start
;;
*)
echo "Usage:single start."
;;
Esac

Exec/sbin/init S

[Email protected] etc]# chmod +x rc.d/init.d/single

[Email protected] etc]# CD RC.D/RC1.D

[Email protected] rc1.d]# ln -sv. /init.d/single S99single

[Email protected] etc]# ll rc.d/rc1.d/
Total 0
lrwxrwxrwx 1 root root 20:06 k33tserver. /init.d/tserver
lrwxrwxrwx 1 root root 20:05 k90network. /init.d/network
lrwxrwxrwx 1 root root 20:13 s99single. /init.d/single


650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8A/C6/wKioL1g76EGx7PdQAACz8RMY_1w037.png-wh_500x0-wm_3 -wmp_4-s_4004867032.png "style=" Float:none; "title=" Single.png "alt=" wkiol1g76egx7pdqaacz8rmy_1w037.png-wh_50 "/ >


650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8A/C6/wKioL1g76ELTYZJ7AAEgNsN2oVM116.png-wh_500x0-wm_3 -wmp_4-s_2019652294.png "style=" Float:none; "title=" Single1.png "alt=" wkiol1g76eltyzj7aaegnsn2ovm116.png-wh_50 "/ >


---end---

Linux System clipping note three user

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.