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:

84418

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-04-15
perf - 6.19.12
Ebuild name:

dev-util/perf-6.19.12

Description

Userland tools for Linux Performance Counters

Added to portage

2026-04-15

2026-04-14
android-studio - 2025.3.3.7
Ebuild name:

dev-util/android-studio-2025.3.3.7

Description

Android development environment based on IntelliJ IDEA

Added to portage

2026-04-14

authlib - 1.6.10
Ebuild name:

dev-python/authlib-1.6.10

Description

A Python library in building OAuth and OpenID Connect servers and clients

Added to portage

2026-04-14

awscli - 1.44.79
Ebuild name:

app-admin/awscli-1.44.79

Description

Universal Command Line Environment for AWS

Added to portage

2026-04-14

boto3 - 1.42.89
Ebuild name:

dev-python/boto3-1.42.89

Description

The AWS SDK for Python

Added to portage

2026-04-14

botocore - 1.42.89
Ebuild name:

dev-python/botocore-1.42.89

Description

Low-level, data-driven core of boto 3

Added to portage

2026-04-14

chromium - 149.0.7779.3
Ebuild name:

www-client/chromium-149.0.7779.3

Description

Open-source version of Google Chrome web browser

Added to portage

2026-04-14

clang - 23.0.0_pre20260413
Ebuild name:

dev-python/clang-23.0.0_pre20260413

Description

Python bindings for llvm-core/clang

Added to portage

2026-04-14

clang - 23.0.0_pre20260413
Ebuild name:

llvm-core/clang-23.0.0_pre20260413

Description

C language family frontend for LLVM

Added to portage

2026-04-14

clang-common - 23.0.0_pre20260413
Ebuild name:

llvm-core/clang-common-23.0.0_pre20260413

Description

Common files shared between multiple slots of clang

Added to portage

2026-04-14

cli-helpers - 2.14.0
Ebuild name:

dev-python/cli-helpers-2.14.0

Description

Python helpers for common CLI tasks

Added to portage

2026-04-14

cmd2 - 3.5.0
Ebuild name:

dev-python/cmd2-3.5.0

Description

Extra features for standard library's cmd module

Added to portage

2026-04-14

compiler-rt - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/compiler-rt-23.0.0_pre20260413

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-04-14

compiler-rt-sanitizers - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-23.0.0_pre20260413

Description

Compiler runtime libraries for clang (sanit

Added to portage

2026-04-14

cramjam - 2.12.0_rc1
Ebuild name:

dev-python/cramjam-2.12.0_rc1

Description

Thin Python bindings to de/compression algorithms in Rust

Added to portage

2026-04-14

django-tables2 - 3.0.0
Ebuild name:

dev-python/django-tables2-3.0.0

Description

Table/data-grid framework for Django

Added to portage

2026-04-14

dotnet-sdk - 9.0.111-r1
Ebuild name:

dev-dotnet/dotnet-sdk-9.0.111-r1

Description

Added to portage

2026-04-14

exo - 1.94.0
Ebuild name:

app-admin/exo-1.94.0

Description

Command-line tool for everything at Exoscale compute, storage, dns

Added to portage

2026-04-14

ffmpeg-chromium - 149
Ebuild name:

media-video/ffmpeg-chromium-149

Description

FFmpeg built specifically for codec support in Chromium-based brows

Added to portage

2026-04-14

flang - 23.0.0_pre20260413
Ebuild name:

llvm-core/flang-23.0.0_pre20260413

Description

LLVM's Fortran frontend

Added to portage

2026-04-14

flang-rt - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/flang-rt-23.0.0_pre20260413

Description

LLVM's Fortran runtime

Added to portage

2026-04-14

gaupol - 1.16
Ebuild name:

media-video/gaupol-1.16

Description

Editor for text-based subtitle files

Added to portage

2026-04-14

getuto - 1.16
Ebuild name:

app-portage/getuto-1.16

Description

Standalone Gentoo gpg trust anchor generation tool for binpkgs

Added to portage

2026-04-14

hypothesis - 6.151.14
Ebuild name:

dev-python/hypothesis-6.151.14

Description

A library for property based testing

Added to portage

2026-04-14

keepass - 2.61
Ebuild name:

app-admin/keepass-2.61

Description

A free, open source, light-weight and easy-to-use password manager

Added to portage

2026-04-14

kicad - 10.0.0
Ebuild name:

sci-electronics/kicad-10.0.0

Description

Electronic Schematic and PCB design tools

Added to portage

2026-04-14

kicad - 9.0.8
Ebuild name:

sci-electronics/kicad-9.0.8

Description

Electronic Schematic and PCB design tools

Added to portage

2026-04-14

kicad-footprints - 10.0.0
Ebuild name:

sci-electronics/kicad-footprints-10.0.0

Description

Electronic Schematic and PCB design tools footprint librari

Added to portage

2026-04-14

kicad-footprints - 9.0.8
Ebuild name:

sci-electronics/kicad-footprints-9.0.8

Description

Electronic Schematic and PCB design tools footprint librarie

Added to portage

2026-04-14

kicad-meta - 10.0.0
Ebuild name:

sci-electronics/kicad-meta-10.0.0

Description

Electronic Schematic and PCB design tools (meta package)

Added to portage

2026-04-14

kicad-meta - 9.0.8
Ebuild name:

sci-electronics/kicad-meta-9.0.8

Description

Electronic Schematic and PCB design tools (meta package)

Added to portage

2026-04-14

kicad-packages3d - 10.0.0
Ebuild name:

sci-electronics/kicad-packages3d-10.0.0

Description

Electronic Schematic and PCB design tools 3D package librar

Added to portage

2026-04-14

kicad-packages3d - 9.0.8
Ebuild name:

sci-electronics/kicad-packages3d-9.0.8

Description

Electronic Schematic and PCB design tools 3D package librari

Added to portage

2026-04-14

kicad-symbols - 10.0.0
Ebuild name:

sci-electronics/kicad-symbols-10.0.0

Description

Electronic Schematic and PCB design tools symbol libraries

Added to portage

2026-04-14

kicad-symbols - 9.0.8
Ebuild name:

sci-electronics/kicad-symbols-9.0.8

Description

Electronic Schematic and PCB design tools symbol libraries

Added to portage

2026-04-14

kicad-templates - 10.0.0
Ebuild name:

sci-electronics/kicad-templates-10.0.0

Description

Electronic Schematic and PCB design tools project templates

Added to portage

2026-04-14

kicad-templates - 9.0.8
Ebuild name:

sci-electronics/kicad-templates-9.0.8

Description

Electronic Schematic and PCB design tools project templates

Added to portage

2026-04-14

leancrypto - 1.7.2-r2
Ebuild name:

dev-libs/leancrypto-1.7.2-r2

Description

Lean cryptographic library usable for bare-metal environments

Added to portage

2026-04-14

libarchive - 3.8.7
Ebuild name:

app-arch/libarchive-3.8.7

Description

Multi-format archive and compression library

Added to portage

2026-04-14

libclc - 23.0.0_pre20260413
Ebuild name:

llvm-core/libclc-23.0.0_pre20260413

Description

OpenCL C library

Added to portage

2026-04-14

libcxx - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/libcxx-23.0.0_pre20260413

Description

New implementation of the C++ standard library, targeting C

Added to portage

2026-04-14

libcxxabi - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/libcxxabi-23.0.0_pre20260413

Description

Low level support for a standard C++ library

Added to portage

2026-04-14

libdvdnav - 7.0.0
Ebuild name:

media-libs/libdvdnav-7.0.0

Description

Library for DVD navigation tools

Added to portage

2026-04-14

libdvdread - 7.0.1
Ebuild name:

media-libs/libdvdread-7.0.1

Description

Library for DVD navigation tools

Added to portage

2026-04-14

libgcc - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/libgcc-23.0.0_pre20260413

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2026-04-14

libjcat - 0.2.6
Ebuild name:

dev-libs/libjcat-0.2.6

Description

Library and tool for reading and writing Jcat files

Added to portage

2026-04-14

libunwind - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/libunwind-23.0.0_pre20260413

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-04-14

libxmlb - 0.3.26
Ebuild name:

dev-libs/libxmlb-0.3.26

Description

Library to help create and query binary XML blobs

Added to portage

2026-04-14

lit - 23.0.0_pre20260413
Ebuild name:

dev-python/lit-23.0.0_pre20260413

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-04-14

lld - 23.0.0_pre20260413
Ebuild name:

llvm-core/lld-23.0.0_pre20260413

Description

The LLVM linker (link editor)

Added to portage

2026-04-14

lldb - 23.0.0_pre20260413
Ebuild name:

llvm-core/lldb-23.0.0_pre20260413

Description

The LLVM debugger

Added to portage

2026-04-14

llvm - 23.0.0_pre20260413
Ebuild name:

dev-ml/llvm-23.0.0_pre20260413

Description

OCaml bindings for LLVM

Added to portage

2026-04-14

llvm - 23.0.0_pre20260413
Ebuild name:

llvm-core/llvm-23.0.0_pre20260413

Description

Low Level Virtual Machine

Added to portage

2026-04-14

llvm-common - 23.0.0_pre20260413
Ebuild name:

llvm-core/llvm-common-23.0.0_pre20260413

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-04-14

mic-paren - 3.15-r1
Ebuild name:

app-emacs/mic-paren-3.15-r1

Description

Advanced highlighting of matching parentheses

Added to portage

2026-04-14

mldonkey - 0.0.4b-r2
Ebuild name:

app-emacs/mldonkey-0.0.4b-r2

Description

An Emacs Lisp interface to the MLDonkey core

Added to portage

2026-04-14

mlir - 23.0.0_pre20260413
Ebuild name:

llvm-core/mlir-23.0.0_pre20260413

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-04-14

mmm-mode - 0.5.11
Ebuild name:

app-emacs/mmm-mode-0.5.11

Description

Enables the user to edit different parts of a file in different major mod

Added to portage

2026-04-14

moccur-edit - 2.16
Ebuild name:

app-emacs/moccur-edit-2.16

Description

An improved interface to color-moccur for editing

Added to portage

2026-04-14

mono - 6.14.1-r1
Ebuild name:

dev-lang/mono-6.14.1-r1

Description

Mono open source ECMA CLI, C and .NET implementation

Added to portage

2026-04-14

nss - 3.112.4
Ebuild name:

dev-libs/nss-3.112.4

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-04-14

nss - 3.122.1
Ebuild name:

dev-libs/nss-3.122.1

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-04-14

nushell - 0.112.1
Ebuild name:

app-shells/nushell-0.112.1

Description

A new type of shell, written in Rust

Added to portage

2026-04-14

openjdk - 27_alpha17
Ebuild name:

dev-java/openjdk-27_alpha17

Description

Open source implementation of the Java programming language

Added to portage

2026-04-14

openjdk-bin - 27_alpha17
Ebuild name:

dev-java/openjdk-bin-27_alpha17

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-04-14

openmp - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/openmp-23.0.0_pre20260413

Description

OpenMP runtime libraries for LLVM/clang compiler

Added to portage

2026-04-14

openmp-amdgcn-amd-amdhsa - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/openmp-amdgcn-amd-amdhsa-23.0.0_pre20260413

Description

OpenMP target library for amdgcn devices

Added to portage

2026-04-14

openmp-nvptx64-nvidia-cuda - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/openmp-nvptx64-nvidia-cuda-23.0.0_pre20260413

Description

OpenMP target library for nvptx64 devic

Added to portage

2026-04-14

openmp-spirv64-intel - 23.0.0_pre20260413
Ebuild name:

llvm-runtimes/openmp-spirv64-intel-23.0.0_pre20260413

Description

OpenMP target library for spirv64 Intel devic

Added to portage

2026-04-14

openstacksdk - 4.11.0
Ebuild name:

dev-python/openstacksdk-4.11.0

Description

A collection of libraries for building applications to work with Ope

Added to portage

2026-04-14

phonenumbers - 9.0.28
Ebuild name:

dev-python/phonenumbers-9.0.28

Description

Python port of Google's libphonenumber

Added to portage

2026-04-14

polly - 23.0.0_pre20260413
Ebuild name:

llvm-core/polly-23.0.0_pre20260413

Description

Polyhedral optimizations for LLVM

Added to portage

2026-04-14

postfix - 3.12_pre20260413
Ebuild name:

mail-mta/postfix-3.12_pre20260413

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-04-14

pydantic - 2.13.0
Ebuild name:

dev-python/pydantic-2.13.0

Description

Data parsing and validation using Python type hints

Added to portage

2026-04-14

pyproject-fmt - 2.21.1
Ebuild name:

dev-python/pyproject-fmt-2.21.1

Description

Format your pyproject.toml file

Added to portage

2026-04-14

python - 0.3.13.13_p1
Ebuild name:

dev-lang/python-0.3.13.13_p1

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-04-14

python - 0.3.14.4_p1
Ebuild name:

dev-lang/python-0.3.14.4_p1

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-04-14

python - 3.13.13_p1
Ebuild name:

dev-lang/python-3.13.13_p1

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-04-14

python - 3.14.4_p1
Ebuild name:

dev-lang/python-3.14.4_p1

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-04-14

python-pkcs11 - 0.9.4
Ebuild name:

dev-python/python-pkcs11-0.9.4

Description

PKCS11/Cryptoki support for Python

Added to portage

2026-04-14

python-tests - 0.3.13.13_p1
Ebuild name:

dev-python/python-tests-0.3.13.13_p1

Description

Test modules from dev-lang/python

Added to portage

2026-04-14

python-tests - 0.3.14.4_p1
Ebuild name:

dev-python/python-tests-0.3.14.4_p1

Description

Test modules from dev-lang/python

Added to portage

2026-04-14

python-tests - 3.13.13_p1
Ebuild name:

dev-python/python-tests-3.13.13_p1

Description

Test modules from dev-lang/python

Added to portage

2026-04-14

python-tests - 3.14.4_p1
Ebuild name:

dev-python/python-tests-3.14.4_p1

Description

Test modules from dev-lang/python

Added to portage

2026-04-14

sphinx-autodoc-typehints - 3.10.1
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.10.1

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-04-14

sqlglot - 30.4.3
Ebuild name:

dev-python/sqlglot-30.4.3

Description

An easily customizable SQL parser and transpiler

Added to portage

2026-04-14

tesseract - 5.5.2-r1
Ebuild name:

app-text/tesseract-5.5.2-r1

Description

An OCR Engine, originally developed at HP, now open source

Added to portage

2026-04-14

vaultwarden - 1.35.7
Ebuild name:

app-admin/vaultwarden-1.35.7

Description

Unofficial Bitwarden compatible password manager

Added to portage

2026-04-14

virtualenv - 21.2.3
Ebuild name:

dev-python/virtualenv-21.2.3

Description

Virtual Python Environment builder

Added to portage

2026-04-14

winbox - 4.1
Ebuild name:

app-admin/winbox-4.1

Description

Management Software for MikroTik RouterOS

Added to portage

2026-04-14

xarray - 2026.4.0
Ebuild name:

dev-python/xarray-2026.4.0

Description

N-D labeled arrays and datasets in Python

Added to portage

2026-04-14

zipp - 3.23.1
Ebuild name:

dev-python/zipp-3.23.1

Description

Backport of pathlib-compatible object wrapper for zip files

Added to portage

2026-04-14

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