Single-user mode, rescue mode, clone virtual machine, and Linux machine log in to each other

Source: Internet
Author: User

Single-User mode

Single-user equivalent to Windows security mode

First reboot Linux, a few common commands:

Reboot Init 6 Shutdown-r now

Shutdown command:

Init 0 Poweroff

Right > Power > Restart Client

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/08/D0/wKiom1nnWADiVt2WAADP8RPwJMw413.jpg-wh_500x0-wm_ 3-wmp_4-s_3618313222.jpg "title=" qq20171018205638.jpg "alt=" Wkiom1nnwadivt2waadp8rpwjmw413.jpg-wh_50 "/>


Grub interface, GRUB is a startup tool to find the system boot disk

Press the direction key to select the above

Press E to enter edit

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/08/D0/wKiom1nnWBLxTK-uAACVPQgMt7s138.jpg-wh_500x0-wm_ 3-wmp_4-s_544008250.jpg "title=" qq20171018210435.jpg "alt=" Wkiom1nnwblxtk-uaacvpqgmt7s138.jpg-wh_50 "/>


Find linux16 this line

Find RO (read-only) to RW (read-write) and add init=/sysroot/bin/sh

Sysroot is the directory where the original system resides

Ctrl+x

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/08/D0/wKiom1nnWCXxUny9AAEEYEQxqYM828.jpg-wh_500x0-wm_ 3-wmp_4-s_1775112608.jpg "title=" qq20171018210512.jpg "alt=" Wkiom1nnwcxxuny9aaeeyeqxqym828.jpg-wh_50 "/>


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/A7/7F/wKioL1nnVYfzGJBzAADyKl_L0LM765.jpg-wh_500x0-wm_ 3-wmp_4-s_1792601180.jpg "title=" qq20171018210653.jpg "alt=" Wkiol1nnvyfzgjbzaadykl_l0lm765.jpg-wh_50 "/>

This interface is equivalent to entering the "Safe Mode"


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/A7/7F/wKioL1nnVZngFbeSAACzVfg5_lg846.jpg-wh_500x0-wm_ 3-wmp_4-s_2783273813.jpg "title=" qq20171018210740.jpg "alt=" Wkiol1nnvzngfbesaaczvfg5_lg846.jpg-wh_50 "/>

Can see

ls/sysroot/boot/

ls/sysroot/tmp/

It's temporarily empty.

Cat/sysroot/root/.ssh/authorized_keys

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/08/D0/wKiom1nnWK7RApY8AAGG4Q5ZhC0834.jpg-wh_500x0-wm_ 3-wmp_4-s_2822687208.jpg "title=" qq20171018211518.jpg "alt=" Wkiom1nnwk7rapy8aagg4q5zhc0834.jpg-wh_50 "/>


chroot/sysroot/

Cat/root/.ssh/authorized_keys can use the original system command at this time.

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/A7/7F/wKioL1nnVhLQP8GVAADmSXvVFBU175.jpg-wh_500x0-wm_ 3-wmp_4-s_3583414106.jpg "title=" qq20171018211756.jpg "alt=" Wkiol1nnvhlqp8gvaadmsxvvfbu175.jpg-wh_50 "/>


passwd Root

Found garbled

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A7/7F/wKioL1nnVivRpXkWAAAQuvtLJVY976.jpg-wh_500x0-wm_ 3-wmp_4-s_4100282021.jpg "title=" qq20171018211927.jpg "alt=" Wkiol1nnvivrpxkwaaaquvtljvy976.jpg-wh_50 "/>

Ctrl +c cancel the currently running command

Execution: lang=en

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/08/D0/wKiom1nnWPbRKhHeAAAbDniDz3M756.jpg-wh_500x0-wm_ 3-wmp_4-s_3558185711.jpg "title=" qq20171018212455.jpg "alt=" Wkiom1nnwpbrkhheaaabdnidz3m756.jpg-wh_50 "/>



Run passwd Root again


650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/A7/7F/wKioL1nnVlORef2dAAA-NLDdlg8554.jpg-wh_500x0-wm_ 3-wmp_4-s_709310776.jpg "style=" Float:none; "title=" Qq20171018212550.jpg "alt=" Wkiol1nnvloref2daaa-nlddlg8554.jpg-wh_50 "/>



To run after the change:

Touch/.autorelabel

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/08/D0/wKiom1nnWQnxd0mGAAAquU3SkP8509.jpg-wh_500x0-wm_ 3-wmp_4-s_1977082428.jpg "title=" qq20171018212632.jpg "style=" Float:none; "alt=" Wkiom1nnwqnxd0mgaaaquu3skp8509.jpg-wh_50 "/>

After power > Restart client

Login successful

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/A7/7F/wKioL1nnVlOQ82ixAAA3LLTm4Bk667.jpg-wh_500x0-wm_ 3-wmp_4-s_2983022688.jpg "title=" qq20171018212850.jpg "style=" Float:none; "alt=" Wkiol1nnvloq82ixaaa3lltm4bk667.jpg-wh_50 "/>




If you forget your Grup password, you should use rescue mode

Run level from 0-6 total 7 levels

0: Turn off the machine

1: Single User

2 3 4: Multi-user mode

5: Graphical interface

6:reboot

Ls-l/usr/lib/systemd/system/runlevel*target

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/fce976b09e947873791019c6a33df3b0.jpg-wh_500x0-wm_3 -wmp_4-s_4129031417.jpg "title=" qq20171019162719.jpg "alt=" Fce976b09e947873791019c6a33df3b0.jpg-wh_ "/>


First shutdown: Init 0

To edit the virtual machine again

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/76a5843eff44fde41412cb63ff632244.jpg-wh_500x0-wm_3 -wmp_4-s_300394212.jpg "style=" Float:none; "title=" Qq20171019163112.jpg "alt=" 76a5843eff44fde41412cb63ff632244.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/ce43753ae19d40d47659693fd9d6277e.jpg-wh_500x0-wm_3 -wmp_4-s_2983089949.jpg "style=" Float:none; "title=" Qq20171019163152.jpg "alt=" Ce43753ae19d40d47659693fd9d6277e.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/cc42780dcf080633cded6213152c96f9.jpg-wh_500x0-wm_3 -wmp_4-s_3062728890.jpg "style=" Float:none; "title=" Qq20171019163543.jpg "alt=" Cc42780dcf080633cded6213152c96f9.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/24cc93729752d704a67dc451cfd1ebb6.jpg-wh_500x0-wm_3 -wmp_4-s_4224242244.jpg "title=" qq20171019163646.jpg "alt=" 24cc93729752d704a67dc451cfd1ebb6.jpg-wh_ "/>650" this.width=650; "Src=" https://s2.51cto.com/oss/201710/19/2193a42a8a922c1038e6abd153368726.jpg-wh_500x0-wm_3-wmp _4-s_855322639.jpg "style=" Float:none; "title=" qq20171019163701.jpg "alt=" 2193a42a8a922c1038e6abd153368726.jpg-wh _ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/6a80ae2cacb13e58d9b1bb279389d0ae.jpg-wh_500x0-wm_3 -wmp_4-s_2155349385.jpg "style=" Float:none; "title=" Qq20171019163728.jpg "alt=" 6a80ae2cacb13e58d9b1bb279389d0ae.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/000865b557fdb1c1bbcd810648823abf.jpg-wh_500x0-wm_3 -wmp_4-s_3616248961.jpg "style=" Float:none; "title=" Qq20171019163804.jpg "alt=" 000865b557fdb1c1bbcd810648823abf.jpg-wh_ "/>


650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/19/69cef9791a920d246ca5c8207b3fdfd0.jpg "title=" Qq20171019163958.jpg "alt=" 69cef9791a920d246ca5c8207b3fdfd0.jpg "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/272b52a3e09a6737200258c1d93f8614.jpg-wh_500x0-wm_3 -wmp_4-s_2066800322.jpg "style=" Float:none; "title=" Qq20171019164059.jpg "alt=" 272b52a3e09a6737200258c1d93f8614.jpg-wh_ "/>



Ls/mnt/sysimage/root/.ssh/authorized_keys

Cat/mnt/sysimage/root/.ssh/authorized_keys


650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/50a1592cb04553c69d1e65fea81c05af.jpg-wh_500x0-wm_3 -wmp_4-s_2132272267.jpg "style=" Float:none; "title=" Qq20171019165037.jpg "alt=" 50a1592cb04553c69d1e65fea81c05af.jpg-wh_ "/>


Chroot/mnt/sysimage

passwd Root

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/6b825b3ce2dcdd2adaa53c8849272960.jpg-wh_500x0-wm_3 -wmp_4-s_3703319809.jpg "style=" Float:none; "title=" Qq20171019165354.jpg "alt=" 6b825b3ce2dcdd2adaa53c8849272960.jpg-wh_ "/>

After changing the password, go to Settings,

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/19/4a87031b8e52818c05ebb840ab586d81.jpg-wh_500x0-wm_3 -wmp_4-s_1890347462.jpg "title=" qq20171019165444.jpg "alt=" 4a87031b8e52818c05ebb840ab586d81.jpg-wh_ "/>


Restart:

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/19/6d7b91879311ab3fef4f4b599477a791.jpg-wh_500x0-wm_3 -wmp_4-s_286017241.jpg "style=" Float:none; "title=" Qq20171019165652.jpg "alt=" 6d7b91879311ab3fef4f4b599477a791.jpg-wh_ "/>


Login Test


650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/19/a7262553b28612099a2eea8d207ae9fe.jpg-wh_500x0-wm_3 -wmp_4-s_3409501737.jpg "style=" Float:none; "title=" Qq20171019172627.jpg "alt=" A7262553b28612099a2eea8d207ae9fe.jpg-wh_ "/>

Landing success


Cloning a virtual machine


650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/7099f69c7fbf55da449a253cb61595d3.jpg-wh_500x0-wm_3 -wmp_4-s_595486077.jpg "style=" Float:none; "title=" Qq20171019172350.jpg "alt=" 7099f69c7fbf55da449a253cb61595d3.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/cbf7218bd289cf9fc99b43e9289fdb6a.jpg-wh_500x0-wm_3 -wmp_4-s_1292283454.jpg "style=" Float:none; "title=" Qq20171019172411.jpg "alt=" Cbf7218bd289cf9fc99b43e9289fdb6a.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/c828bbb56914ceb3dced0f6fa1c9f76d.jpg-wh_500x0-wm_3 -wmp_4-s_960679933.jpg "style=" Float:none; "title=" Qq20171019172424.jpg "alt=" C828bbb56914ceb3dced0f6fa1c9f76d.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/e45cedfd9e9eaafc98b703049408c6b1.jpg-wh_500x0-wm_3 -wmp_4-s_869282545.jpg "style=" Float:none; "title=" Qq20171019172435.jpg "alt=" E45cedfd9e9eaafc98b703049408c6b1.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/af1ce0146061070be63a4a867aa7cc74.jpg-wh_500x0-wm_3 -wmp_4-s_659245308.jpg "style=" Float:none; "title=" Qq20171019172449.jpg "alt=" Af1ce0146061070be63a4a867aa7cc74.jpg-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/42d146ec08fe85a596e80634304b2d0a.jpg-wh_500x0-wm_3 -wmp_4-s_4093734199.jpg "style=" Float:none; "title=" Qq20171019172459.jpg "alt=" 42d146ec08fe85a596e80634304b2d0a.jpg-wh_ "/>


Login serverlooker-02

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/6fa2447187cbe3e10c983c850dde546e.jpg-wh_500x0-wm_3 -wmp_4-s_3496729641.jpg "style=" Float:none; "title=" Qq20171019172627.jpg "alt=" 6fa2447187cbe3e10c983c850dde546e.jpg-wh_ "/>



Change the IP of serverlooker-02

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/eb1e3fb2709c86e2ff2cc2c87722240e.jpg-wh_500x0-wm_3 -wmp_4-s_850433282.jpg "style=" Float:none; "title=" Qq20171019172958.jpg "alt=" Eb1e3fb2709c86e2ff2cc2c87722240e.jpg-wh_ "/>

Restart

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/7cd2acc03baa5f0bdee6195a0f8f1519.jpg-wh_500x0-wm_3 -wmp_4-s_2572568351.jpg "style=" Float:none; "title=" Qq20171019173157.jpg "alt=" 7cd2acc03baa5f0bdee6195a0f8f1519.jpg-wh_ "/>

Test the external network, can ping through

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/e67fc9250fbcce5d69a87bface4638d5.jpg-wh_500x0-wm_3 -wmp_4-s_2476939225.jpg "style=" Float:none; "title=" Qq20171019173603.jpg "alt=" E67fc9250fbcce5d69a87bface4638d5.jpg-wh_ "/>


Change the host name of aminglinux-02: serverlooker-02

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/4e50b0c3a9bc9b3545535a09547ad091.jpg-wh_500x0-wm_3 -wmp_4-s_3731360035.jpg "style=" Float:none; "title=" Qq20171019174053.jpg "alt=" 4e50b0c3a9bc9b3545535a09547ad091.jpg-wh_ "/>

Change the host name of aminglinux-01: serverlooker-01

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/19/1f15820ce15c2d1b9d46f2e19b29d7d2.jpg-wh_500x0-wm_3 -wmp_4-s_394576323.jpg "style=" Float:none; "title=" Qq20171019174219.jpg "alt=" 1f15820ce15c2d1b9d46f2e19b29d7d2.jpg-wh_ "/>


Add serverlooker-02 to Xshell

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/19/edb80238e5717080e3b99fa951359f44.jpg-wh_500x0-wm_3 -wmp_4-s_1124775858.jpg "style=" Float:none; "title=" Qq20171019174411.jpg "alt=" Edb80238e5717080e3b99fa951359f44.jpg-wh_ "/>


650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/19/e4e371f1fd060f606658ec78a7cdd82d.jpg-wh_500x0-wm_3 -wmp_4-s_3485894133.jpg "style=" Float:none; "title=" Qq20171019174546.jpg "alt=" E4e371f1fd060f606658ec78a7cdd82d.jpg-wh_ "/>


Clone the aminglinux-02, spare.

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/19/d98edbcdf0b133f112be95a3672f4778.jpg-wh_500x0-wm_3 -wmp_4-s_1401600969.jpg "style=" Float:none; "title=" Qq20171019174715.jpg "alt=" D98edbcdf0b133f112be95a3672f4778.jpg-wh_ "/>


Linux machines log in to each other


Use the W command to view the terminals connected to the SERVERLOOKER-01

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/51f65c4b4c82505152dae4cf837a41d7.jpg-wh_500x0-wm_3 -wmp_4-s_3551752732.jpg "style=" Float:none; "title=" Qq20171019175838.jpg "alt=" 51f65c4b4c82505152dae4cf837a41d7.jpg-wh_ "/>

Use serverlooker-02 to connect 01

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/c5f16ab9b7649e0a7bc0cecfafe890f1.jpg-wh_500x0-wm_3 -wmp_4-s_3640448285.jpg "title=" qq20171019180108.jpg "alt=" C5f16ab9b7649e0a7bc0cecfafe890f1.jpg-wh_ "/>


View current Login User WhoAmI

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/032c7090d954d98eed9b9f1d33df7d4a.jpg-wh_500x0-wm_3 -wmp_4-s_3713319561.jpg "style=" Float:none; "title=" Qq20171019180243.jpg "alt=" 032c7090d954d98eed9b9f1d33df7d4a.jpg-wh_ "/>


Connect by specifying a port:

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/f7fff1ca0a5fc8a03589a9355e44f72d.jpg-wh_500x0-wm_3 -wmp_4-s_2207832927.jpg "style=" Float:none; "title=" Qq20171019180544.jpg "alt=" F7fff1ca0a5fc8a03589a9355e44f72d.jpg-wh_ "/>


Key authentication between two Linux implementations

Use 02 to connect 01

Tool: Ssh-keygen generate key pair

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/11c7a5969ac1bd0921f60d0fdba4defc.jpg-wh_500x0-wm_3 -wmp_4-s_2226742052.jpg "style=" Float:none; "title=" Qq20171019180839.jpg "alt=" 11c7a5969ac1bd0921f60d0fdba4defc.jpg-wh_ "/>

Default carriage return, generating a key pair


650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/ab7fa5fb03b5169774b1cd3384077f47.jpg-wh_500x0-wm_3 -wmp_4-s_3724392237.jpg "style=" Float:none; "title=" Qq20171019180923.jpg "alt=" Ab7fa5fb03b5169774b1cd3384077f47.jpg-wh_ "/>

Copy 02 of the public key contents to 01

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/d968ac7a3048b1ca875cc64679b49b5b.jpg-wh_500x0-wm_3 -wmp_4-s_3696092446.jpg "style=" Float:none; "title=" Qq20171019181025.jpg "alt=" D968ac7a3048b1ca875cc64679b49b5b.jpg-wh_ "/>

VI Write

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/19/f76101c5d281f9eee4bb6579f5af7376.jpg-wh_500x0-wm_3 -wmp_4-s_1862925420.jpg "title=" qq20171019181525.jpg "alt=" F76101c5d281f9eee4bb6579f5af7376.jpg-wh_ "/>

01 of SELinux Off

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/627063d0fa2ceaf3202b2b1866391fa1.jpg-wh_500x0-wm_3 -wmp_4-s_927172758.jpg "style=" Float:none; "title=" Qq20171019181729.jpg "alt=" 627063d0fa2ceaf3202b2b1866391fa1.jpg-wh_ "/>


Use 02 even 01 without entering a password.

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/19/81bd856ecea6f438b235234c426334b7.jpg-wh_500x0-wm_3 -wmp_4-s_2765169695.jpg "style=" Float:none; "title=" Qq20171019182246.jpg "alt=" 81bd856ecea6f438b235234c426334b7.jpg-wh_ "/>


The connection was successful.


This article is from the "Serverlooker" blog, make sure to keep this source http://13279218.blog.51cto.com/13269218/1974412

Single-user mode, rescue mode, clone virtual machine, and Linux machine log in to each other

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.