from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

82712

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->net-misc->openssh

Create a chrooted ssh user

This tutorial explains how to install and configure a chroot enviroment for an ssh user. This setup enables you to give out ssh accounts without having to fear that this user can see all files on the system.

Installing ssh

First you need to have a patched version of the sshd server. Luckily these patches can be enabled with the use flag "chroot" in the sshd use flags.
#echo "net-misc/openssh chroot" >> /etc/portage/package.use
#emerge openssh

creating the chroot enviroment

We will create our chroot enviroment in /home/chroot.
To make the chroot work, run the following commands to make the needed directories and devices for the chrooted user.
mkdir /home/chroot/
mkdir /home/chroot/home/
cd /home/chroot
mkdir etc
mkdir bin
mkdir lib
mkdir usr
mkdir usr/bin
mkdir dev
mknod dev/null c 1 3
mknod dev/zero c 1 5

Now we need to populate the directories with some binaries.
copy the following script into a file. If you need more apps, add them
to the APPS line.

APPS="/bin/bash /bin/ls /bin/mkdir /bin/mv /bin/pwd /bin/rm /usr/bin/id /usr/bin/ssh /bin/ping /usr/bin/dircolors"
for prog in $APPS; do
cp $prog ./$prog

# obtain a list of related libraries
ldd $prog > /dev/null
if [ "$?" = 0 ] ; then
LIBS=`ldd $prog | awk '{ print $3 }'`
for l in $LIBS; do
mkdir ./`dirname $l` > /dev/null 2>&1
cp $l ./$l
done
fi
done

After you have run the script, your chroot enviroment is almost done.
run

cp /lib/libnss_compat.so.2 /lib/libnsl.so.1 /lib/libnss_files.so.2 ./lib/
echo '#!/bin/bash' > usr/bin/groups
echo "id -Gn" >> usr/bin/groups
touch etc/passwd
grep /etc/passwd -e "^root" > etc/passwd
to copy some libraries and user information into the chroot.
You should also copy the line of the group in which you will create new users from /etc/group to /home/chroot/etc/group. In this tutorial we will create users in the group users, so we do this:
grep /etc/group -e "^root" -e "^users" > etc/group

and restart SSH:
/etc/init.d/ssh restart

Creating chrooted users

ssh decides which user should be chrooted and which not by the "home directory" entry in the /etc/passwd.
Example for a non-chrooted user:
user_a:x:2002:100:User A:/home/user_a:/bin/bash
This user will be chrooted:
user_b:x:2003:100:User B:/home/chroot/./home/user_b:/bin/bash
Now lets add a testuser to the chrooted user list:
useradd -s /bin/bash -m -d /home/chroot/./home/testuser -c "testuser" -g users testuser

Then we give testuser a password:
passwd testuser

Finally, we have to copy the line for testuser in /etc/passwd to /home/chroot/etc/passwd:
grep /etc/passwd -e "^testuser" >> /home/chroot/etc/passwd


Now log in as testuser and see if everything worked.

Have fun
back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-01-03
awscli - 1.44.11
Ebuild name:

app-admin/awscli-1.44.11

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-03

bcachefs-tools - 1.34.0
Ebuild name:

sys-fs/bcachefs-tools-1.34.0

Description

Tools for bcachefs

Added to portage

2026-01-03

boto3 - 1.42.21
Ebuild name:

dev-python/boto3-1.42.21

Description

The AWS SDK for Python

Added to portage

2026-01-03

botocore - 1.42.21
Ebuild name:

dev-python/botocore-1.42.21

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-03

cargo-nextest - 0.9.117
Ebuild name:

dev-util/cargo-nextest-0.9.117

Description

Next-generation test runner for Rust

Added to portage

2026-01-03

elementary-xfce-icon-theme - 0.22
Ebuild name:

x11-themes/elementary-xfce-icon-theme-0.22

Description

Elementary icons forked from upstream, extended and main

Added to portage

2026-01-03

filelock - 3.20.2
Ebuild name:

dev-python/filelock-3.20.2

Description

A platform independent file lock for Python

Added to portage

2026-01-03

gentoo-sources - 6.18.3
Ebuild name:

sys-kernel/gentoo-sources-6.18.3

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-03

geolith-jg - 0.3.0
Ebuild name:

games-emulation/geolith-jg-0.3.0

Description

Jolly Good Neo Geo AES/MVS Emulator

Added to portage

2026-01-03

git - 4.1.0
Ebuild name:

dev-ruby/git-4.1.0

Description

Library for using Git in Ruby

Added to portage

2026-01-03

glycin-loaders - 2.1_alpha
Ebuild name:

media-libs/glycin-loaders-2.1_alpha

Description

Loaders for glycin clients (glycin crate or libglycin)

Added to portage

2026-01-03

highs - 1.12.0
Ebuild name:

sci-mathematics/highs-1.12.0

Description

Modern solver for linear, quadratic, and mixed-integer programs

Added to portage

2026-01-03

hoe - 4.5.1
Ebuild name:

dev-ruby/hoe-4.5.1

Description

Hoe extends rake to provide full project automation

Added to portage

2026-01-03

mgba - 0.11.0_pre20260101
Ebuild name:

games-emulation/mgba-0.11.0_pre20260101

Description

Game Boy Advance Emulator

Added to portage

2026-01-03

mpmath - 1.4.0_beta3
Ebuild name:

dev-python/mpmath-1.4.0_beta3

Description

Python library for arbitrary-precision floating-point arithmetic

Added to portage

2026-01-03

openpgp-keys-gentoo-developers - 20251229
Ebuild name:

sec-keys/openpgp-keys-gentoo-developers-20251229

Description

Gentoo Authority Keys (GLEP 79)

Added to portage

2026-01-03

openttd - 15.0
Ebuild name:

games-simulation/openttd-15.0

Description

A clone of Transport Tycoon Deluxe

Added to portage

2026-01-03

patatt - 0.7.0
Ebuild name:

dev-python/patatt-0.7.0

Description

A simple library to add cryptographic attestation to patches sent via email

Added to portage

2026-01-03

pillow - 12.1.0
Ebuild name:

dev-python/pillow-12.1.0

Description

Python Imaging Library (fork)

Added to portage

2026-01-03

pkgcheck - 0.10.37-r1
Ebuild name:

dev-util/pkgcheck-0.10.37-r1

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2026-01-03

pkgcheck - 0.10.38
Ebuild name:

dev-util/pkgcheck-0.10.38

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2026-01-03

pkgcore - 0.12.30-r1
Ebuild name:

sys-apps/pkgcore-0.12.30-r1

Description

a framework for package management

Added to portage

2026-01-03

pkgcore - 0.12.31
Ebuild name:

sys-apps/pkgcore-0.12.31

Description

a framework for package management

Added to portage

2026-01-03

portage-utils - 0.99
Ebuild name:

app-portage/portage-utils-0.99

Description

Small and fast Portage helper tools written in C

Added to portage

2026-01-03

pyside - 6.10.1-r3
Ebuild name:

dev-python/pyside-6.10.1-r3

Description

Python bindings for the Qt framework

Added to portage

2026-01-03

qemu - 10.2.0-r1
Ebuild name:

app-emulation/qemu-10.2.0-r1

Description

QEMU + Kernel-based Virtual Machine userland tools

Added to portage

2026-01-03

rgbds - 1.0.1
Ebuild name:

dev-util/rgbds-1.0.1

Description

Rednex Game Boy Development System

Added to portage

2026-01-03

rhash - 1.4.6-r1
Ebuild name:

app-crypt/rhash-1.4.6-r1

Description

Console utility and library for computing and verifying file hash sums

Added to portage

2026-01-03

rmg - 0.8.8
Ebuild name:

games-emulation/rmg-0.8.8

Description

Rosalie's Mupen GUI

Added to portage

2026-01-03

rotix - 0.83-r3
Ebuild name:

app-crypt/rotix-0.83-r3

Description

Rotix allows you to generate rotational obfuscations

Added to portage

2026-01-03

rpm-sequoia - 1.10.0
Ebuild name:

app-crypt/rpm-sequoia-1.10.0

Description

Implementation of the RPM PGP interface using Sequoia

Added to portage

2026-01-03

rpm-sequoia - 1.9.0
Ebuild name:

app-crypt/rpm-sequoia-1.9.0

Description

Implementation of the RPM PGP interface using Sequoia

Added to portage

2026-01-03

ruamel-yaml - 0.19.1
Ebuild name:

dev-python/ruamel-yaml-0.19.1

Description

YAML parser/emitter that supports roundtrip comment preservation

Added to portage

2026-01-03

ruamel-yaml-clibz - 0.3.7
Ebuild name:

dev-python/ruamel-yaml-clibz-0.3.7

Description

C-based reader/scanner and emitter for dev-python/ruamel-yaml

Added to portage

2026-01-03

sbctl - 0.15.4
Ebuild name:

app-crypt/sbctl-0.15.4

Description

Secure Boot key manager

Added to portage

2026-01-03

sbctl - 0.16
Ebuild name:

app-crypt/sbctl-0.16

Description

Secure Boot key manager

Added to portage

2026-01-03

sbctl - 0.18
Ebuild name:

app-crypt/sbctl-0.18

Description

Secure Boot key manager

Added to portage

2026-01-03

sbsigntools - 0.9.5
Ebuild name:

app-crypt/sbsigntools-0.9.5

Description

Utilities for signing and verifying files for UEFI Secure Boot

Added to portage

2026-01-03

snakeoil - 0.11.0
Ebuild name:

dev-python/snakeoil-0.11.0

Description

misc common functionality and useful optimizations

Added to portage

2026-01-03

sphinx-autodoc-typehints - 3.6.2
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.6.2

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-01-03

sus-fixtures-console - 0.5.0
Ebuild name:

dev-ruby/sus-fixtures-console-0.5.0

Description

Test fixtures for capturing Console output

Added to portage

2026-01-03

tox - 4.33.0
Ebuild name:

dev-python/tox-4.33.0

Description

virtualenv-based automation of test activities

Added to portage

2026-01-03

vanilla-sources - 6.18.3
Ebuild name:

sys-kernel/vanilla-sources-6.18.3

Description

Full sources for the Linux kernel

Added to portage

2026-01-03

2026-01-02
ROPgadget - 7.6-r2
Ebuild name:

dev-util/ROPgadget-7.6-r2

Description

Search for gadgets in binaries to facilitate your ROP exploitation

Added to portage

2026-01-02

ROPgadget - 7.7-r1
Ebuild name:

dev-util/ROPgadget-7.7-r1

Description

Search for gadgets in binaries to facilitate your ROP exploitation

Added to portage

2026-01-02

amf-headers - 1.4.36-r2
Ebuild name:

media-libs/amf-headers-1.4.36-r2

Description

The Advanced Media Framework (AMF) SDK

Added to portage

2026-01-02

capstone - 5.0.6-r1
Ebuild name:

dev-libs/capstone-5.0.6-r1

Description

disassembly/disassembler framework + bindings

Added to portage

2026-01-02

capstone - 6.0.0_alpha4-r1
Ebuild name:

dev-libs/capstone-6.0.0_alpha4-r1

Description

disassembly/disassembler framework + bindings

Added to portage

2026-01-02

capstone - 6.0.0_alpha5-r1
Ebuild name:

dev-libs/capstone-6.0.0_alpha5-r1

Description

disassembly/disassembler framework + bindings

Added to portage

2026-01-02

cosign - 3.0.3
Ebuild name:

app-containers/cosign-3.0.3

Description

container signing utility

Added to portage

2026-01-02

dist-kernel - 6.18.3
Ebuild name:

virtual/dist-kernel-6.18.3

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-01-02

django-polymorphic - 4.5.2
Ebuild name:

dev-python/django-polymorphic-4.5.2

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-01-02

docker-compose - 2.40.3
Ebuild name:

app-containers/docker-compose-2.40.3

Description

Multi-container orchestration for Docker

Added to portage

2026-01-02

docker-compose - 5.0.1
Ebuild name:

app-containers/docker-compose-5.0.1

Description

Multi-container orchestration for Docker

Added to portage

2026-01-02

eisl - 5.62
Ebuild name:

dev-lang/eisl-5.62

Description

Interpreter and compiler compatible with the ISLisp standard

Added to portage

2026-01-02

erofs-utils - 1.8.10-r1
Ebuild name:

sys-fs/erofs-utils-1.8.10-r1

Description

Userspace tools for EROFS

Added to portage

2026-01-02

file-tail - 1.4.0
Ebuild name:

dev-ruby/file-tail-1.4.0

Description

A small ruby library that allows it to 'tail' files in Ruby

Added to portage

2026-01-02

gentoo-kernel - 6.18.3
Ebuild name:

sys-kernel/gentoo-kernel-6.18.3

Description

Linux kernel built with Gentoo patches

Added to portage

2026-01-02

gentoo-kernel-bin - 6.18.3
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.3

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-01-02

gitpython - 3.1.46
Ebuild name:

dev-python/gitpython-3.1.46

Description

Library used to interact with Git repositories

Added to portage

2026-01-02

gnatformat - 26.0.0-r1
Ebuild name:

dev-ada/gnatformat-26.0.0-r1

Description

Opinionated code formatter for the Ada language

Added to portage

2026-01-02

gopass - 1.16.1-r1
Ebuild name:

app-admin/gopass-1.16.1-r1

Description

a simple but powerful password manager for the terminal

Added to portage

2026-01-02

hypothesis - 6.148.9
Ebuild name:

dev-python/hypothesis-6.148.9

Description

A library for property based testing

Added to portage

2026-01-02

json5 - 0.13.0
Ebuild name:

dev-python/json5-0.13.0

Description

A Python implementation of the JSON5 data format

Added to portage

2026-01-02

libmilter - 1.0.2_p5
Ebuild name:

mail-filter/libmilter-1.0.2_p5

Description

Added to portage

2026-01-02

librt - 0.7.7
Ebuild name:

dev-python/librt-0.7.7

Description

Mypyc runtime library

Added to portage

2026-01-02

noto - 20260101
Ebuild name:

media-fonts/noto-20260101

Description

Google's font family that aims to support all the world's languages

Added to portage

2026-01-02

nprolog - 4.78
Ebuild name:

dev-lang/nprolog-4.78

Description

Interpreter and compiler to be compatible with Arity/Prolog32

Added to portage

2026-01-02

nvidia-ml-py - 13.590.44
Ebuild name:

dev-python/nvidia-ml-py-13.590.44

Description

Python bindings to the NVIDIA Management Library

Added to portage

2026-01-02

onlyoffice-bin - 9.2.1
Ebuild name:

app-office/onlyoffice-bin-9.2.1

Description

A free and open source office and productivity suite (binary versio

Added to portage

2026-01-02

opencascade - 7.8.1-r1
Ebuild name:

sci-libs/opencascade-7.8.1-r1

Description

Development platform for CAD/CAE, 3D surface/solid modeling and data

Added to portage

2026-01-02

pf-sources - 6.18_p4
Ebuild name:

sys-kernel/pf-sources-6.18_p4

Description

Added to portage

2026-01-02

portage - 3.0.74
Ebuild name:

sys-apps/portage-3.0.74

Description

The package management and distribution system for Gentoo

Added to portage

2026-01-02

postfix - 3.11.0_rc3-r1
Ebuild name:

mail-mta/postfix-3.11.0_rc3-r1

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-01-02

postfix - 3.12_pre20251231-r1
Ebuild name:

mail-mta/postfix-3.12_pre20251231-r1

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-01-02

prettier-ada - 25.0.0-r4
Ebuild name:

dev-ada/prettier-ada-25.0.0-r4

Description

Port of the Prettier formatter to the Ada programming language

Added to portage

2026-01-02

pwndbg - 20250530-r3
Ebuild name:

dev-debug/pwndbg-20250530-r3

Description

A GDB plug-in that makes debugging with GDB suck less

Added to portage

2026-01-02

pwndbg - 20251010-r3
Ebuild name:

dev-debug/pwndbg-20251010-r3

Description

A GDB plug-in that makes debugging with GDB suck less

Added to portage

2026-01-02

pwndbg - 20251020-r3
Ebuild name:

dev-debug/pwndbg-20251020-r3

Description

A GDB plug-in that makes debugging with GDB suck less

Added to portage

2026-01-02

pycares - 5.0.1
Ebuild name:

dev-python/pycares-5.0.1

Description

Python interface for c-ares

Added to portage

2026-01-02

pykka - 4.4.1
Ebuild name:

dev-python/pykka-4.4.1

Description

A Python implementation of the actor model

Added to portage

2026-01-02

pynacl - 1.6.2
Ebuild name:

dev-python/pynacl-1.6.2

Description

Python binding to the Networking and Cryptography (NaCl) library

Added to portage

2026-01-02

rpm-sequoia - 1.10.0
Ebuild name:

app-crypt/rpm-sequoia-1.10.0

Description

Implementation of the RPM PGP interface using Sequoia

Added to portage

2026-01-02

sendmail - 8.18.2
Ebuild name:

mail-mta/sendmail-8.18.2

Description

Widely-used Mail Transport Agent (MTA)

Added to portage

2026-01-02

sequel - 5.100.0
Ebuild name:

dev-ruby/sequel-5.100.0

Description

A lightweight database toolkit for Ruby

Added to portage

2026-01-02

siril - 1.4.0-r1
Ebuild name:

sci-astronomy/siril-1.4.0-r1

Description

A free astronomical image processing software

Added to portage

2026-01-02

smrsh - 8.18.2
Ebuild name:

app-shells/smrsh-8.18.2

Description

Sendmail restricted shell, for use with MTAs other than Sendmail

Added to portage

2026-01-02

sqlmap - 1.10
Ebuild name:

dev-db/sqlmap-1.10

Description

An automatic SQL injection and database takeover tool

Added to portage

2026-01-02

test-unit - 3.7.7
Ebuild name:

dev-ruby/test-unit-3.7.7

Description

An xUnit family unit testing framework for Ruby

Added to portage

2026-01-02

vanilla-kernel - 6.18.3
Ebuild name:

sys-kernel/vanilla-kernel-6.18.3

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-01-02

vlc - 3.0.23
Ebuild name:

media-video/vlc-3.0.23

Description

Media player and framework with support for most multimedia files and stream

Added to portage

2026-01-02

yara-x - 1.10.0-r1
Ebuild name:

app-forensics/yara-x-1.10.0-r1

Description

A malware identification and classification tool

Added to portage

2026-01-02

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 100.8 ms