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:

85382

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-05-27
algol68g - 3.12.2
Ebuild name:

dev-lang/algol68g-3.12.2

Description

Algol 68 Genie compiler-interpreter

Added to portage

2026-05-27

gap - 4.16.0_beta2
Ebuild name:

sci-mathematics/gap-4.16.0_beta2

Description

System for computational discrete algebra. Core functionality.

Added to portage

2026-05-27

krita - 6.0.2
Ebuild name:

media-gfx/krita-6.0.2

Description

Free digital painting application. Digital Painting, Creative Freedom

Added to portage

2026-05-27

nushell - 0.113.0
Ebuild name:

app-shells/nushell-0.113.0

Description

A new type of shell, written in Rust

Added to portage

2026-05-27

nvidia-drivers - 610.43.02-r1
Ebuild name:

x11-drivers/nvidia-drivers-610.43.02-r1

Description

NVIDIA Accelerated Graphics Driver

Added to portage

2026-05-27

onak - 0.6.4
Ebuild name:

app-crypt/onak-0.6.4

Description

onak is an OpenPGP keyserver

Added to portage

2026-05-27

petsc - 3.25.1
Ebuild name:

sci-mathematics/petsc-3.25.1

Description

Portable, Extensible Toolkit for Scientific Computation

Added to portage

2026-05-27

qtspeech - 6.10.3-r1
Ebuild name:

dev-qt/qtspeech-6.10.3-r1

Description

Text-to-speech library for the Qt6 framework

Added to portage

2026-05-27

qtspeech - 6.11.1-r1
Ebuild name:

dev-qt/qtspeech-6.11.1-r1

Description

Text-to-speech library for the Qt6 framework

Added to portage

2026-05-27

slepc - 3.25.1
Ebuild name:

sci-mathematics/slepc-3.25.1

Description

Scalable Library for Eigenvalue Problem Computations

Added to portage

2026-05-27

sourcegit - 2026.11
Ebuild name:

dev-vcs/sourcegit-2026.11

Description

Open Source Git GUI client using .NET AvaloniaUI

Added to portage

2026-05-27

stalonetray - 1.3.0
Ebuild name:

x11-misc/stalonetray-1.3.0

Description

System tray utility including support for KDE system tray icons

Added to portage

2026-05-27

system-monitoring-center - 3.4.1
Ebuild name:

sys-apps/system-monitoring-center-3.4.1

Description

Multi-featured system monitor GUI written in Python

Added to portage

2026-05-27

2026-05-26
bitstring - 4.4.0-r2
Ebuild name:

dev-python/bitstring-4.4.0-r2

Description

A pure Python module for creation and analysis of binary data

Added to portage

2026-05-26

bmake - 20260508
Ebuild name:

dev-build/bmake-20260508

Description

NetBSD's portable make

Added to portage

2026-05-26

c-blosc2 - 3.1.0
Ebuild name:

dev-libs/c-blosc2-3.1.0

Description

Blocking, shuffling and lossless compression library

Added to portage

2026-05-26

cargo-c - 0.10.22-r1
Ebuild name:

dev-util/cargo-c-0.10.22-r1

Description

Helper program to build and install c-like libraries

Added to portage

2026-05-26

containerd - 2.0.2-r1
Ebuild name:

app-containers/containerd-2.0.2-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.0.3-r1
Ebuild name:

app-containers/containerd-2.0.3-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.0.4-r1
Ebuild name:

app-containers/containerd-2.0.4-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.0.5-r1
Ebuild name:

app-containers/containerd-2.0.5-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.0.7-r1
Ebuild name:

app-containers/containerd-2.0.7-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.1.0-r1
Ebuild name:

app-containers/containerd-2.1.0-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.1.1-r1
Ebuild name:

app-containers/containerd-2.1.1-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.1.4-r1
Ebuild name:

app-containers/containerd-2.1.4-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.1.5-r1
Ebuild name:

app-containers/containerd-2.1.5-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.2.0-r1
Ebuild name:

app-containers/containerd-2.2.0-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.2.1-r1
Ebuild name:

app-containers/containerd-2.2.1-r1

Description

A daemon to control runC

Added to portage

2026-05-26

containerd - 2.2.2-r1
Ebuild name:

app-containers/containerd-2.2.2-r1

Description

A daemon to control runC

Added to portage

2026-05-26

cri-tools - 1.36.0
Ebuild name:

app-containers/cri-tools-1.36.0

Description

CLI and validation tools for Kubelet Container Runtime (CRI)

Added to portage

2026-05-26

dbus-broker - 37-r1
Ebuild name:

sys-apps/dbus-broker-37-r1

Description

Linux D-Bus Message Broker

Added to portage

2026-05-26

dbus-fast - 5.0.14
Ebuild name:

dev-python/dbus-fast-5.0.14

Description

A faster version of dbus-next

Added to portage

2026-05-26

dist-kernel - 5.10.257_p1
Ebuild name:

virtual/dist-kernel-5.10.257_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 5.15.208_p1
Ebuild name:

virtual/dist-kernel-5.15.208_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 6.1.174_p1
Ebuild name:

virtual/dist-kernel-6.1.174_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 6.12.91_p1
Ebuild name:

virtual/dist-kernel-6.12.91_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 6.18.33_p1
Ebuild name:

virtual/dist-kernel-6.18.33_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 6.6.141_p1
Ebuild name:

virtual/dist-kernel-6.6.141_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

dist-kernel - 7.0.10_p1
Ebuild name:

virtual/dist-kernel-7.0.10_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-26

elastic-transport - 9.4.1
Ebuild name:

dev-python/elastic-transport-9.4.1

Description

Transport classes and utilities shared among Python Elastic clie

Added to portage

2026-05-26

etcd - 3.6.11
Ebuild name:

dev-db/etcd-3.6.11

Description

Highly-available key value store for shared configuration and service discovery

Added to portage

2026-05-26

evaluate - 0.4.6-r1
Ebuild name:

sci-ml/evaluate-0.4.6-r1

Description

makes evaluating, comparing models and reporting their performance easier

Added to portage

2026-05-26

flawfinder - 2.0.20
Ebuild name:

dev-util/flawfinder-2.0.20

Description

Examines C/C++ source code for security flaws

Added to portage

2026-05-26

gentoo-kernel - 5.10.257_p1
Ebuild name:

sys-kernel/gentoo-kernel-5.10.257_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 5.15.208_p1
Ebuild name:

sys-kernel/gentoo-kernel-5.15.208_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 6.1.174_p1
Ebuild name:

sys-kernel/gentoo-kernel-6.1.174_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 6.12.91_p1
Ebuild name:

sys-kernel/gentoo-kernel-6.12.91_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 6.18.33_p1
Ebuild name:

sys-kernel/gentoo-kernel-6.18.33_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 6.6.141_p1
Ebuild name:

sys-kernel/gentoo-kernel-6.6.141_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel - 7.0.10_p1
Ebuild name:

sys-kernel/gentoo-kernel-7.0.10_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 5.10.257_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.10.257_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 5.15.208_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.15.208_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 6.1.174_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.174_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 6.12.91_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.91_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 6.18.33_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.33_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 6.6.141_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.6.141_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-kernel-bin - 7.0.10_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.0.10_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-26

gentoo-sources - 5.10.257-r1
Ebuild name:

sys-kernel/gentoo-sources-5.10.257-r1

Description

Full sources including the Gentoo patchset for the . kernel t

Added to portage

2026-05-26

gentoo-sources - 5.15.208-r1
Ebuild name:

sys-kernel/gentoo-sources-5.15.208-r1

Description

Full sources including the Gentoo patchset for the . kernel t

Added to portage

2026-05-26

gentoo-sources - 6.1.174-r1
Ebuild name:

sys-kernel/gentoo-sources-6.1.174-r1

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-26

gentoo-sources - 6.12.91-r1
Ebuild name:

sys-kernel/gentoo-sources-6.12.91-r1

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-26

gentoo-sources - 6.18.33-r1
Ebuild name:

sys-kernel/gentoo-sources-6.18.33-r1

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-26

gentoo-sources - 6.6.141-r1
Ebuild name:

sys-kernel/gentoo-sources-6.6.141-r1

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-26

gentoo-sources - 7.0.10-r1
Ebuild name:

sys-kernel/gentoo-sources-7.0.10-r1

Description

Full sources including the Gentoo patchset for the . kernel tre

Added to portage

2026-05-26

httptools - 0.8.0
Ebuild name:

dev-python/httptools-0.8.0

Description

A collection of framework independent HTTP protocol utils

Added to portage

2026-05-26

hypothesis - 6.152.11
Ebuild name:

dev-python/hypothesis-6.152.11

Description

A library for property based testing

Added to portage

2026-05-26

jellyfin-bin - 10.11.10
Ebuild name:

www-apps/jellyfin-bin-10.11.10

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2026-05-26

jiwer - 3.0.5
Ebuild name:

sci-ml/jiwer-3.0.5

Description

Evaluate an automatic speech recognition system

Added to portage

2026-05-26

jiwer - 3.1.0
Ebuild name:

sci-ml/jiwer-3.1.0

Description

Evaluate an automatic speech recognition system

Added to portage

2026-05-26

libetpan - 1.10
Ebuild name:

net-libs/libetpan-1.10

Description

A portable, efficient middleware for different kinds of mail access

Added to portage

2026-05-26

mod_h2 - 2.0.40
Ebuild name:

www-apache/mod_h2-2.0.40

Description

HTTP/2 module for Apache

Added to portage

2026-05-26

nwipe - 0.41
Ebuild name:

app-crypt/nwipe-0.41

Description

Securely erase disks using a variety of recognized methods

Added to portage

2026-05-26

onak - 0.6.3
Ebuild name:

app-crypt/onak-0.6.3

Description

onak is an OpenPGP keyserver

Added to portage

2026-05-26

onak - 0.6.4
Ebuild name:

app-crypt/onak-0.6.4

Description

onak is an OpenPGP keyserver

Added to portage

2026-05-26

parse - 1.22.1
Ebuild name:

dev-python/parse-1.22.1

Description

Parse strings using a specification based on the Python format() syntax

Added to portage

2026-05-26

pikepdf - 10.7.2
Ebuild name:

dev-python/pikepdf-10.7.2

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-05-26

pipewire - 1.4.11
Ebuild name:

media-video/pipewire-1.4.11

Description

Multimedia processing graphs

Added to portage

2026-05-26

pipewire - 1.6.5
Ebuild name:

media-video/pipewire-1.6.5

Description

Multimedia processing graphs

Added to portage

2026-05-26

pipewire - 1.6.6
Ebuild name:

media-video/pipewire-1.6.6

Description

Multimedia processing graphs

Added to portage

2026-05-26

ppp - 2.5.3
Ebuild name:

net-dialup/ppp-2.5.3

Description

Point-to-Point Protocol (PPP)

Added to portage

2026-05-26

pytest-regressions - 2.11.0
Ebuild name:

dev-python/pytest-regressions-2.11.0

Description

Easy to use fixtures to write regression tests

Added to portage

2026-05-26

radvd - 2.21
Ebuild name:

net-misc/radvd-2.21

Description

Linux IPv6 Router Advertisement Daemon

Added to portage

2026-05-26

root - 6.40.00
Ebuild name:

sci-physics/root-6.40.00

Description

C++ data analysis framework and interpreter from CERN

Added to portage

2026-05-26

root - 6.40.9999
Ebuild name:

sci-physics/root-6.40.9999

Description

C++ data analysis framework and interpreter from CERN

Added to portage

2026-05-26

roundcube - 1.7.1
Ebuild name:

mail-client/roundcube-1.7.1

Description

A browser-based multilingual IMAP client with an application-like user

Added to portage

2026-05-26

selinux-gdomap - 2.20250618_p1
Ebuild name:

sec-policy/selinux-gdomap-2.20250618_p1

Description

SELinux policy for gdomap

Added to portage

2026-05-26

selinux-gdomap - 2.20260312_p1
Ebuild name:

sec-policy/selinux-gdomap-2.20260312_p1

Description

SELinux policy for gdomap

Added to portage

2026-05-26

selinux-gdomap - 9999
Ebuild name:

sec-policy/selinux-gdomap-9999

Description

SELinux policy for gdomap

Added to portage

2026-05-26

selinux-hadoop - 2.20250618_p1
Ebuild name:

sec-policy/selinux-hadoop-2.20250618_p1

Description

SELinux policy for hadoop

Added to portage

2026-05-26

selinux-hadoop - 2.20260312_p1
Ebuild name:

sec-policy/selinux-hadoop-2.20260312_p1

Description

SELinux policy for hadoop

Added to portage

2026-05-26

selinux-hadoop - 9999
Ebuild name:

sec-policy/selinux-hadoop-9999

Description

SELinux policy for hadoop

Added to portage

2026-05-26

selinux-mongodb - 2.20250618_p1
Ebuild name:

sec-policy/selinux-mongodb-2.20250618_p1

Description

SELinux policy for mongodb

Added to portage

2026-05-26

selinux-mongodb - 2.20260312_p1
Ebuild name:

sec-policy/selinux-mongodb-2.20260312_p1

Description

SELinux policy for mongodb

Added to portage

2026-05-26

selinux-mongodb - 9999
Ebuild name:

sec-policy/selinux-mongodb-9999

Description

SELinux policy for mongodb

Added to portage

2026-05-26

selinux-obex - 2.20250618_p1
Ebuild name:

sec-policy/selinux-obex-2.20250618_p1

Description

SELinux policy for obex

Added to portage

2026-05-26

selinux-obex - 2.20260312_p1
Ebuild name:

sec-policy/selinux-obex-2.20260312_p1

Description

SELinux policy for obex

Added to portage

2026-05-26

selinux-obex - 9999
Ebuild name:

sec-policy/selinux-obex-9999

Description

SELinux policy for obex

Added to portage

2026-05-26

selinux-passenger - 2.20250618_p1
Ebuild name:

sec-policy/selinux-passenger-2.20250618_p1

Description

SELinux policy for passenger

Added to portage

2026-05-26

selinux-passenger - 2.20260312_p1
Ebuild name:

sec-policy/selinux-passenger-2.20260312_p1

Description

SELinux policy for passenger

Added to portage

2026-05-26

selinux-passenger - 9999
Ebuild name:

sec-policy/selinux-passenger-9999

Description

SELinux policy for passenger

Added to portage

2026-05-26

selinux-rlogin - 2.20250618_p1
Ebuild name:

sec-policy/selinux-rlogin-2.20250618_p1

Description

SELinux policy for rlogin

Added to portage

2026-05-26

selinux-rlogin - 2.20260312_p1
Ebuild name:

sec-policy/selinux-rlogin-2.20260312_p1

Description

SELinux policy for rlogin

Added to portage

2026-05-26

selinux-rlogin - 9999
Ebuild name:

sec-policy/selinux-rlogin-9999

Description

SELinux policy for rlogin

Added to portage

2026-05-26

selinux-sigrok - 2.20250618_p1
Ebuild name:

sec-policy/selinux-sigrok-2.20250618_p1

Description

SELinux policy for sigrok

Added to portage

2026-05-26

selinux-sigrok - 2.20260312_p1
Ebuild name:

sec-policy/selinux-sigrok-2.20260312_p1

Description

SELinux policy for sigrok

Added to portage

2026-05-26

selinux-sigrok - 9999
Ebuild name:

sec-policy/selinux-sigrok-9999

Description

SELinux policy for sigrok

Added to portage

2026-05-26

selinux-uuidd - 2.20250618_p1
Ebuild name:

sec-policy/selinux-uuidd-2.20250618_p1

Description

SELinux policy for uuidd

Added to portage

2026-05-26

selinux-uuidd - 2.20260312_p1
Ebuild name:

sec-policy/selinux-uuidd-2.20260312_p1

Description

SELinux policy for uuidd

Added to portage

2026-05-26

selinux-uuidd - 9999
Ebuild name:

sec-policy/selinux-uuidd-9999

Description

SELinux policy for uuidd

Added to portage

2026-05-26

tibs - 0.8.0
Ebuild name:

dev-python/tibs-0.8.0

Description

A sleek Python library for your binary data

Added to portage

2026-05-26

tmpreaper - 1.6.17-r1
Ebuild name:

app-admin/tmpreaper-1.6.17-r1

Description

A utility for removing files based on when they were last accessed

Added to portage

2026-05-26

tmuxp - 1.70.0
Ebuild name:

app-misc/tmuxp-1.70.0

Description

tmux session manager. built on libtmux

Added to portage

2026-05-26

tokenizers - 0.22.2
Ebuild name:

sci-ml/tokenizers-0.22.2

Description

Implementation of today's most used tokenizers

Added to portage

2026-05-26

xcp - 0.24.8-r1
Ebuild name:

sys-fs/xcp-0.24.8-r1

Description

A 'cp' alternative with user-friendly feedback and performance optimisations

Added to portage

2026-05-26

xsimd - 14.2.0
Ebuild name:

dev-cpp/xsimd-14.2.0

Description

C++ wrappers for SIMD intrinsics

Added to portage

2026-05-26

xyzservices - 2026.3.0
Ebuild name:

sci-geosciences/xyzservices-2026.3.0

Description

Source of XYZ tiles providers

Added to portage

2026-05-26

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