EasyManua.ls Logo

Linux Pocket Linux Guide User Manual

Default Icon
67 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #42 background imageLoading...
Page #42 background image
7.2.3.3. /etc/passwd
The format of /etc/passwd can be obtained by reading the passwd(5) manpage. We can easily create a
user account by adding a line like "root::0:0:superuser:/root:/bin/sh" to the file.
Maintaining passwords will be somewhat challenging because of the system being loaded into ramdisk. Any
changes to /etc/passwd will be lost when the system is shutdown. So to make things easy, we will create
all users with null passwords.
7.2.3.4. /etc/group
The structure of /etc/group is available from the group(5) manpage. A line of "root::0:root" would define
a group called "root" with no password, a group id of zero and the user root assigned to it as the only member.
7.2.3.5. Conventions
User and group names and id's are generally not chosen at random. Most Linux systems have very similar
looking /etc/passwd and /etc/group files. Definitions for commonly used user id and group id
assignments may be found in one of several places:
The /etc/passwd and /etc/group files on any popular GNU/Linux distribution.
The Debian Policy Manual −− available online at http://www.debian.org/doc/debian−policy.
The Linux Standard Base specification −− downloadable in many formats from
http://www.linuxbase.org/spec/index.shtml.
Essential System Administration, 3rd Edition by Aeleen Frisch −− available at libraries, bookstores or
directly from O'Reilly Publishing at http://www.oreilly.com/.
7.2.4. Dependencies
Running ldd on the login program from util−linux will reveal that it is linked to the libraries
libcrypt.so.1, libc.so.6 and ld−linux.so.2. In addition to these libraries there is another,
unseen dependency on libnss_files.so.2 and the configuration file /etc/nsswitch.conf.
The name service switch library libnss_files.so.2 and nsswitch.conf are required for
libc.so.6, and consequently the login program, to access the /etc/passwd file. Without libnss and
its configuration file, all logins will mysteriously fail. More information about glibc's use of the name service
switch libraries can be found at
http://www.gnu.org/software/libc/manual/html_node/Name−Service−Switch.html.
7.2.5. Assigning ownership and permissions
Previously, with the single user system, there was no need to worry about permissions when installing
directories, files and device nodes. The shell was effectively operating as root, so everything was accessible.
Things become more complex with the addition of multiple user capability. Now we need to make sure that
every user has access to what they need and at the same time gets blocked from what they do not need.
A good guideline for assigning ownership and permissions would be to give the minimum level of access
required. Take the /bin directory as an example. The Filesystem Hierarchy (FHS) document says, "/bin
Pocket Linux Guide
Chapter 7. Enabling Multiple Users 36

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Linux Pocket Linux Guide and is the answer not in the manual?

Linux Pocket Linux Guide Specifications

General IconGeneral
TitleLinux Pocket Guide
AuthorDaniel J. Barrett
PublisherO'Reilly Media
FormatPaperback
LanguageEnglish

Summary

Legal Information

Copyright and License

Legal text regarding document usage and permissions.

Disclaimer

Legal text disclaiming warranties and responsibilities for document use.

Introduction

About Pocket Linux

Overview of the guide's purpose and target audience.

Prerequisite Skills

Lists necessary skills for following the guide.

Project Format

Explains the chapter structure: Analysis, Design, Construction, Implementation.

Chapter 1: Project Initiation

The Goal of Pocket Linux

Outlines the objectives and constraints of the Pocket Linux project.

Working Within The Constraints

Discusses the limitations and advantages of the project's design.

Chapter 2: A Simple Prototype

2.1. Analysis

Defines the goals for the initial minimal working system.

2.2. Design

Outlines the components needed for a basic boot/root disk set.

2.2.1. Simplification

Focuses on essential components, ignoring complexity.

2.2.2. Boot Disk

Details requirements for the boot disk, including GRUB and kernel.

2.2.3. Root Disk

Describes requirements for the root disk, including BASH and /dev files.

2.3. Construction

Steps for building the boot and root disk floppies.

2.3.1. Prepare the boot disk media

Instructions for formatting and mounting the boot diskette.

2.3.5. Build the Linux kernel

Steps for configuring and compiling the Linux kernel.

2.3.9. Build BASH

Compiling and stripping the BASH shell for the root disk.

2.4. Implementation

Steps to start and test the prototype system.

2.4.1. System startup

Detailed instructions to boot the Pocket Linux system.

Chapter 3: Saving Space

3.1. Analysis

Discusses limitations of the prototype and goals for space saving.

3.2. Design

Outlines techniques for space saving: shared libraries, stripped binaries, compressed filesystem.

3.2.1. Shared Libraries

Rebuilding BASH to use shared libraries.

3.2.3. Compressed Root Filesystem

Using a ramdisk approach for a compressed filesystem.

3.3. Construction

Steps for building the compressed root filesystem using a ramdisk.

3.3.2. Rebuild the BASH shell

Reconfiguring BASH without static linking.

3.3.6. Compress the ramdisk image

Unmounting, dumping, and compressing the ramdisk.

3.4. Implementation

Steps to boot and test the space-optimized system.

3.4.1. System startup

Booting the system with the compressed root disk.

Chapter 4: Some Basic Utilities

4.1. Analysis

Discusses the need to add more utilities to the root disk.

4.2. Design

Plans for adding common external commands like cat, ls, mkdir, rm.

4.2.1. Determining Required Commands

Using FHS to identify necessary commands.

4.2.4. Downloading Source Code

Instructions for downloading package source code.

4.3. Construction

Steps for building and installing new utilities.

4.3.1. Create a staging area

Setting up a temporary directory for building.

4.3.3. Install binaries from GNU coreutils

Compiling and installing core utilities.

4.3.6. Create a compressed root disk image

Compressing the updated root filesystem.

4.4. Implementation

Steps to boot and test the system with new utilities.

4.4.1. System startup

Booting the system with a read-write root filesystem.

4.4.2. Testing new commands

Verifying the functionality of newly added utilities.

Chapter 5: Checking and Mounting Disks

5.1. Analysis

Discusses the need for disk mounting and checking capabilities.

5.2. Design

Planning to implement fsck and mount utilities.

5.2.1. Determining necessary utilities

Identifying fsck, mount, umount based on FHS.

5.2.3. Automating fsck and mount

Designing a script to check and mount filesystems.

5.2.4. File dependencies

Identifying necessary files like /etc/fstab and /dev entries.

5.2.4.1. /etc/fstab

Creating the fstab file for filesystem configuration.

5.3. Construction

Steps for installing utilities and creating configuration files.

5.3.1. Install utilities from e2fsprogs

Compiling and installing fsck and mke2fs.

5.3.2. Install utilities from util-linux

Compiling and installing mount, umount, and others.

5.3.6. Create the fstab and mtab files

Setting up filesystem configuration and tracking files.

5.3.7. Write a script to check and mount local filesystems

Creating the `local_fs` startup script.

5.3.8. Create a compressed root disk image

Compressing the updated root filesystem.

5.4. Implementation

Steps to boot and test the system with mounting capabilities.

5.4.1. System startup

Booting the system and checking startup scripts.

5.4.2. Test the local_fs script

Verifying the automated filesystem mounting script.

Chapter 6: Automating Startup & Shutdown

6.1. Analysis

Discusses improving system startup, shutdown, and manual processes.

6.2. Design

Planning to automate boot parameters, use init daemon, and implement graceful shutdown.

6.2.1. Determining necessary utilities

Identifying init daemon, shutdown, halt, reboot.

6.2.4. Designing a simple GRUB configuration file

Creating `menu.lst` for automated booting.

6.2.5. Outlining start-up scripts

Planning System V style init scripts.

6.3. Construction

Steps for creating startup scripts and configuring the system.

6.3.1. Create a GRUB configuration file

Writing the `menu.lst` file.

6.3.3. Create /etc/inittab file

Configuring the init daemon's behavior.

6.3.4. Create /etc/init.d/rc script

Creating the main runlevel script.

6.3.5. Modify /etc/init.d/local_fs script

Adapting the mounting script for start/stop.

6.3.8. Create rcN.d directories and links

Organizing startup scripts into runlevel directories.

6.4. Implementation

Steps to boot and verify automated startup/shutdown.

6.4.1. System Startup

Booting the system with automated configuration.

6.4.2. Verify success of startup scripts

Checking if filesystems are mounted and hostname is set.

6.4.3. System shutdown

Performing a graceful system shutdown.

Chapter 7: Enabling Multiple Users

7.1. Analysis

Discusses moving from single-user to multi-user mode.

7.2. Design

Planning for multi-user capability and virtual consoles.

7.2.1. The login process

Outlining the steps for user login.

7.2.3. Creating support files

Preparing necessary configuration files and device nodes.

7.2.3.1. Device nodes

Creating /dev entries for virtual consoles.

7.2.3.3. /etc/passwd

Creating a minimal passwd file for users.

7.2.3.5. Conventions

Guidelines for user/group naming and ID assignment.

7.2.4. Dependencies

Identifying libraries required for login, like libnss_files.

7.3. Construction

Steps for implementing multi-user support.

7.3.2. Modify inittab for multi-user mode

Configuring `inittab` for multiple virtual terminals.

7.3.3. Create tty devices

Creating device nodes for virtual terminals.

7.3.4. Create support files in /etc

Creating essential configuration files like `nsswitch.conf`.

7.3.6. Set directory and file permissions

Applying appropriate permissions for multi-user security.

7.3.7. Create the root disk image

Compressing the system with multi-user support.

7.4. Implementation

Steps to boot and test multi-user features.

7.4.2. Add a new user to the system

Creating a new user account and group.

Chapter 8: Filling in the Gaps

8.1. Analysis

Identifying missing commands according to FHS, like `more`, `ps`, `sed`, `ed`.

8.2. Design

Planning to add the missing commands, including a custom `more` script.

8.2.1. more

Designing a simple shell script to emulate the `more` command.

8.2.3. ps, sed & ed

Identifying sources for `ps`, `sed`, and `ed` packages.

8.3. Construction

Steps for implementing the missing utilities.

8.3.1. Write a "more" script

Creating the shell script for the `more` command.

8.3.3. Install ps

Compiling and installing the `ps` utility.

8.3.4. Install sed

Compiling and installing the `sed` utility.

8.3.5. Install ed

Compiling and installing the `ed` editor.

8.3.7. Ensure proper permissions

Setting permissions for the new utilities.

8.3.8. Create the root disk image

Compressing the system with the new utilities.

8.4.2. Test the "more" script

Using the custom `more` script with `dmesg` and `local_fs`.

8.4.3. Use ps to show running processes

Demonstrating the `ps` command.

8.4.4. Run a simple sed script

Using `sed` to modify `/etc/passwd`.

Chapter 9: Project Wrap Up

9.1. Celebrating Accomplishments

Summarizes the achievements of the project.

9.2. Planning Next Steps

Discusses future expansion possibilities for Pocket Linux.

Appendix A: Hosting Applications

A.1. Analysis

Discusses expanding Pocket Linux to run applications like mp3blaster.

A.2. Design

Planning for audio hardware support, mp3blaster space, and audio file access.

A.2.1. Support for audio hardware

Kernel and /dev configuration for sound cards.

A.2.1.1. Kernel support for audio

Building a kernel with built-in audio support.

A.2.2. Creating space for the program

Strategies for adding mp3blaster, including compressed floppies.

A.2.2.1. Mounting additional compressed floppies

Loading compressed images from floppy to ramdisk.

A.2.3. Accessing audio files

Handling audio files and potential CD-ROM support.

A.2.4. Other required files

Identifying libraries and terminfo for mp3blaster.

A.3. Construction

Steps to build the enhanced system.

A.3.1. Create an enhanced boot disk

Building a new kernel with additional hardware support.

A.3.1.1. Build a new kernel

Configuring kernel options for audio and CD-ROM.

A.3.2.2. Install the gunzip binary

Compiling and installing gunzip.

A.3.2.3. Write a startup script to mount a compressed floppy

Creating a script to load the /usr image.

A.3.3. Create a compressed /usr disk for mp3blaster

Building the /usr disk with mp3blaster.

A.3.3.1. Create a staging area

Setting up a staging directory for the /usr disk.

A.3.3.2. Install the mp3blaster program

Downloading and compiling mp3blaster.

A.3.4. Create a data diskette for testing

Creating a floppy for sample audio files.

A.4. Implementation

Steps to test the hosted application.

A.4.1. System Startup

Booting the system with the enhanced diskettes.

A.4.5. Play a sample file

Using mp3blaster to play an audio file.

Appendix B: GNU Free Documentation License

B.1. PREAMBLE

Explains the purpose and freedoms granted by the license.

B.2. APPLICABILITY AND DEFINITIONS

Defines terms and scope of the license.

B.3. VERBATIM COPYING

Conditions for copying and distributing the document verbatim.

B.5. MODIFICATIONS

Guidelines for creating and distributing modified versions.

B.6. COMBINING DOCUMENTS

Rules for combining this document with others.

B.7. COLLECTIONS OF DOCUMENTS

Procedures for creating document collections.

B.9. TRANSLATION

Guidelines for distributing translated versions.

B.10. TERMINATION

Conditions under which the license can be terminated.

B.11. FUTURE REVISIONS OF THIS LICENSE

Information on future license versions.