feed-image  ISSN 1836-5930

linux

Linux eBooks FREE Download

A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide


Poll

Do you care about your privacy when using a FACEBOOK?
 


Partner Linux Sites: TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux
Install debian server in a linux chroot environment
Article Index
1. Install chroot environment
2. Configuration
3. Install chroot ssh daemon
3.1. Configure ssh
4. Login remotely to chroot
5. Fine tune chroot

Running Linux system inside a chroot environment allows a system admin to decrease an impact on a production server when the server gets compromised.  Change root will change root directory to all current running processes and its children to a chroot jail. Testing of various package installations and server configuration in a chrooted environment can be another handy way how to utilize a chroot jail.

This tutorial will provide a reader with step by step guide on how to install Debian with ssh daemon inside chroot environment using debootstrap.

1. Install chroot environment

In the first step we will create a directory in which new chroot environment will reside. For convenience during the installation we also declare temporary bash shell variable CHROOT to hold a path to chroot environment.

# mkdir -p /mnt/chroot/squeeze
# CHROOT=/mnt/chroot/squeeze

When new chroot directory is ready we will use debootstrap to install new Debian system within chroot environment. Change the architecture and debian version according to your needs. The installation may take some time as debootstrap will use your specified mirror to download and install core packages. Choose the closest mirror as it will rapidly reduce the installation time.

# debootstrap --arch i386 squeeze \
$CHROOT <URL OF DEBIAN MIRROR>

At the end of the installation you should seed output similar to the one below:

I: Configuring debian-archive-keyring...
I: Configuring apt...
I: Configuring libept0...
I: Configuring apt-utils...
I: Configuring aptitude...
I: Configuring tasksel-data...
I: Configuring tasksel...
I: Base system installed successfully.

Connect your host proc system with chroot environment by mounting within chroot directory. This allows chroot access a hardware of your host system.

# mount -t proc proc $CHROOT/proc
# mount -t devpts devpts $CHROOT/dev/pts

2. Configuration

Now, we are ready to login into chroot and do some basic configuration. To not let aour selfs confuse with host and chroot environment we first change a root's PS1 variable to change a shell prompt to "CHROOT-squeeze:~#" . This step is optional but recommended: First login to chroot:

# chroot $CHROOT /bin/bash --login

execute a following command to permanently change root's shell prompt and exit:

CHROOT-squeeze:~# echo 'PS1="CHROOT-squeeze:\w# "' >> ~/.bashrc
CHROOT-squeeze:~# exit

Next time you enter chroot environment you will have a new shell prompt:

# chroot $CHROOT /bin/bash --login

From this point on all commands which should be executes within chroot environment will have a prefix:

CHROOT-squeeze:~#

Next we will install and reconfigure locales.

CHROOT-squeeze:~# apt-get install locales

Now reconfigure your locales. For example if you are form Australia you add - en_AU ISO-8859-1 - en_AU.UTF-8 UTF-8 and choose : en_AU

# dpkg-reconfigure locales

3. Install chroot ssh daemon

Now we are ready to install any service within chroot environment. Let's start with ssh as this will allow us to login to chroot using ssh connection from LAN or WAN.:
NOTE: installation of vim is optional

CHROOT-squeeze:~# apt-get install vim ssh

Configure chrooted ssh service to listen on different port than 22 as it is most likely already occupied by your host system.

3.1. Configure ssh

Edit a sshd_config file:

CHROOT-squeeze:~# vi /etc/ssh/sshd_config

and change line Port 22 to:

Port 2222 

Restart a chroot sshd:

CHROOT-squeeze:~# /etc/init.d/ssh restart

Change a password for a chrooted root user:

CHROOT-squeeze:~# passwd

4. Login remotely to chroot

If all went well we now should be able to login to new chroot environment using ssh:

ssh root@localhost -p 2222

5. Fine tune chroot

chroot ssh daemon will not start automatically when you turn on your host operation system. Therefore,  create a simple shell script to do that task:

/etc/init.d/chroot-squeeze :

#!/bin/bash

CHROOT=/mnt/chroot/squeeze # change
mount -t devpts devpts $CHROOT/dev/pts
mount -t proc proc $CHROOT/proc
chroot  $CHROOT /etc/init.d/ssh start

and as a last step make a simbolic link to /etc/rc2.d/:

# ln -s /etc/init.d/chroot-squeeze /etc/rc2.d/S98chroot-squeeze

Now you should have a fully functional chroot environment. Feel free to explore and install additional services.


Linux eBooks FREE Download

The GNU/Linux Advanced Administration
The GNU/Linux systems have reached an important level of maturity, allowing to integrate them in almost any kind of work environment, from a desktop PC to the sever facilities of a big company.

In this ebook "The GNU/Linux Operating System", the main contents are related with system administration. You will learn how to install and configure several computer services, and how to optimize and synchronize the resources using GNU/Linux.

The topics covered in this 500+ page eBook include Linux network, server and data administration, Linux kernel, security, clustering, configuration, tuning, optimization, migration and coexistence with non-Linux systems. A must read for any serious Linux system admin.

A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.

You've probably heard about Linux, the free, open-source operating system that's been pushing up against Microsoft. It's way cheaper, faster, safer, and has a far bigger active community than Windows, so why aren't you on it? Don't worry, Makeuseof.com understands. Like many things, venturing off into a completely unknown world can seem rather scary, and also be pretty difficult in the beginning. It's while adapting to the unknown, that one needs a guiding, and caring hand. This guide will tell you all you need to know in 20 illustrated pages, helping you to take your first steps. Let your curiosity take you hostage and start discovering Linux today, with this manual as your guide! Don't let Makeuseof.com keep you any longer, and download the Newbie's Initiation to Linux. With this free guide you will also receive daily updates on new cool websites and programs in your email for free courtesy of MakeUseOf.

Linux from Scratch
Linux from Scratch describes the process of creating your own Linux system from scratch from an already installed Linux distribution, using nothing but the source code of software that you need.

This 318 page eBook provides readers with the background and instruction to design and build custom Linux systems. This eBook highlights the Linux from Scratch project and the benefits of using this system. Users can dictate all aspects of their system, including directory layout, script setup, and security. The resulting system will be compiled completely from the source code, and the user will be able to specify where, why, and how programs are installed. This eBook allows readers to fully customize Linux systems to their own needs and allows users more control over their system.

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)
Getting Started with Ubuntu 10.04 (Lucid Lynx) is a comprehensive beginners guide for the Ubuntu operating system; it features comprehensive guides, How Tos and information on anything you need to know after first installing Ubuntu.

Designed to be as user-friendly and easy to follow as possible, it should provide the first point of reference to any Ubuntu newcomer with lots of information. The manual has step by step instructions and includes lots of screenshots to show you how to do tasks. It also includes a Troubleshooting section to help you solve common Ubuntu problems quickly. Download this 160+ page manual today.

Securing & Optimizing Linux: The Hacking Solution (v.3.0)
A comprehensive collection of Linux security products and explanations in the most simple and structured manner on how to safely and easily configure and run many popular Linux-based applications and services.

This book is intended for a technical audience and system administrators who manage Linux servers, but it also includes material for home users and others. It discusses how to install and setup a Linux server with all the necessary security and optimization for a high performance Linux specific machine. It can also be applied with some minor changes to other Linux variants without difficulty.

Comments (0)
Write comment
NOTE: To unsubscribe enter your email, select "do not dotify" with title: UNSUBSCRIBE and Send.
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
Security
Please input the anti-spam code that you can read in the image.