1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-chroot-pwdgroup">
|
---|
9 | <?dbhtml filename="pwdgroup.html"?>
|
---|
10 |
|
---|
11 | <title>Creating the passwd and group Files</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
14 | <primary sortas="e-/etc/passwd">/etc/passwd</primary>
|
---|
15 | <secondary>chroot</secondary>
|
---|
16 | </indexterm>
|
---|
17 |
|
---|
18 | <indexterm zone="ch-chroot-pwdgroup">
|
---|
19 | <primary sortas="e-/etc/group">/etc/group</primary>
|
---|
20 | <secondary>chroot</secondary>
|
---|
21 | </indexterm>
|
---|
22 |
|
---|
23 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
24 | href="../../boot/common/pwdgroup.xml"
|
---|
25 | xpointer="xpointer(//*[@os='a'])"/>
|
---|
26 |
|
---|
27 | <para>Create the <filename>/etc/passwd</filename> file by running the
|
---|
28 | following command:</para>
|
---|
29 |
|
---|
30 | <screen><userinput>cat > /etc/passwd << "EOF"
|
---|
31 | <literal>root:x:&uid-root;:&gid-root;:root:/root:/bin/bash</literal>
|
---|
32 | <literal>bin:x:&uid-bin;:&gid-bin;:/bin:/bin/false</literal>
|
---|
33 | <literal>daemon:x:&uid-daemon;:&gid-daemon;:/sbin:/bin/false</literal>
|
---|
34 | <literal>messagebus:x:&uid-messagebus;:&gid-messagebus;:D-Bus Message Daemon User:/dev/null:/bin/false</literal>
|
---|
35 | <literal>systemd-bus-proxy:x:&uid-systemd-bus-proxy;:&gid-systemd-bus-proxy;:systemd Bus Proxy:/:/bin/false</literal>
|
---|
36 | <literal>systemd-journal-gateway:x:&uid-systemd-journal-gateway;:&gid-systemd-journal-gateway;:systemd Journal Gateway:/:/bin/false</literal>
|
---|
37 | <literal>systemd-journal-remote:x:&uid-systemd-journal-remote;:&gid-systemd-journal-remote;:systemd Journal Remote:/:/bin/false</literal>
|
---|
38 | <literal>systemd-journal-upload:x:&uid-systemd-journal-upload;:&gid-systemd-journal-upload;:systemd Journal Upload:/:/bin/false</literal>
|
---|
39 | <literal>systemd-network:x:&uid-systemd-network;:&gid-systemd-network;:systemd Network Management:/:/bin/false</literal>
|
---|
40 | <literal>systemd-resolve:x:&uid-systemd-resolve;:&gid-systemd-resolve;:systemd Resolver:/:/bin/false</literal>
|
---|
41 | <literal>systemd-timesync:x:&uid-systemd-timesync;:&gid-systemd-timesync;:systemd Time Synchronization:/:/bin/false</literal>
|
---|
42 | <literal>systemd-coredump:x:&uid-systemd-coredump;:&gid-systemd-coredump;:systemd Core Dumper:/:/bin/false</literal>
|
---|
43 | <literal>nobody:x:&uid-nobody;:&gid-nogroup;:Unprivileged User:/dev/null:/bin/false</literal>
|
---|
44 | EOF</userinput></screen>
|
---|
45 |
|
---|
46 | <para os="b">The actual password for
|
---|
47 | <systemitem class="username">root</systemitem> (the <quote>x</quote>
|
---|
48 | used here is just a placeholder) will be set later.</para>
|
---|
49 |
|
---|
50 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
51 | href="../../boot/common/pwdgroup.xml"
|
---|
52 | xpointer="xpointer(//*[@os='c'])"/>
|
---|
53 |
|
---|
54 | <para>Create the <filename>/etc/group</filename> file by running the
|
---|
55 | following command:</para>
|
---|
56 |
|
---|
57 | <screen><userinput>cat > /etc/group << "EOF"
|
---|
58 | <literal>root:x:0:
|
---|
59 | bin:x:&gid-bin;:
|
---|
60 | sys:x:&gid-sys;:
|
---|
61 | kmem:x:&gid-kmem;:
|
---|
62 | tty:x:&gid-tty;:
|
---|
63 | tape:x:&gid-tape;:
|
---|
64 | daemon:x:&gid-daemon;:
|
---|
65 | floppy:x:&gid-floppy;:
|
---|
66 | disk:x:&gid-disk;:
|
---|
67 | lp:x:&gid-lp;:
|
---|
68 | dialout:x:&gid-dialout;:
|
---|
69 | audio:x:&gid-audio;:
|
---|
70 | video:x:&gid-video;:
|
---|
71 | utmp:x:&gid-utmp;:
|
---|
72 | usb:x:&gid-usb;:
|
---|
73 | cdrom:x:&gid-cdrom;:
|
---|
74 | adm:x:&gid-adm;:
|
---|
75 | mail:x:&gid-mail;:
|
---|
76 | messagebus:x:&gid-messagebus;:
|
---|
77 | nogroup:x:&gid-nogroup;:
|
---|
78 | systemd-bus-proxy:x:&gid-systemd-bus-proxy;:
|
---|
79 | systemd-journal:x:&gid-systemd-journal;:
|
---|
80 | systemd-journal-gateway:x:&gid-systemd-journal-gateway;:
|
---|
81 | systemd-journal-remote:x:&gid-systemd-journal-remote;:
|
---|
82 | systemd-journal-upload:x:&gid-systemd-journal-upload;:
|
---|
83 | systemd-network:x:&gid-systemd-network;:
|
---|
84 | systemd-resolve:x:&gid-systemd-resolve;:
|
---|
85 | systemd-timesync:x:&gid-systemd-timesync;:
|
---|
86 | systemd-coredump:x:&gid-systemd-coredump;:
|
---|
87 | wheel:x:&gid-wheel;:</literal>
|
---|
88 | EOF</userinput></screen>
|
---|
89 |
|
---|
90 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
91 | href="../../boot/common/pwdgroup.xml"
|
---|
92 | xpointer="xpointer(//*[@os='d'])"/>
|
---|
93 |
|
---|
94 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
95 | href="../../boot/common/pwdgroup.xml"
|
---|
96 | xpointer="xpointer(//*[@os='e'])"/>
|
---|
97 |
|
---|
98 | <para>To remove the <quote>I have no name!</quote> prompt, start a
|
---|
99 | new shell. Since a full Glibc was installed in <xref
|
---|
100 | linkend="chapter-cross-tools"/> and the <filename>/etc/passwd</filename>
|
---|
101 | and <filename>/etc/group</filename> files have been created, user name
|
---|
102 | and group name resolution will now work.</para>
|
---|
103 |
|
---|
104 | <screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
105 |
|
---|
106 | <para>Note the use of the <parameter>+h</parameter> directive. This tells
|
---|
107 | <command>bash</command> not to use its internal path hashing. Without this
|
---|
108 | directive, <command>bash</command> would remember the paths to binaries it
|
---|
109 | has executed. To ensure the use of the newly compiled binaries as soon as
|
---|
110 | they are installed, the <parameter>+h</parameter> directive will be used
|
---|
111 | for the duration of the next chapters.</para>
|
---|
112 |
|
---|
113 | </sect1>
|
---|