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:

86386

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-06-29
botan - 3.12.0
Ebuild name:

dev-libs/botan-3.12.0

Description

C++ crypto library

Added to portage

2026-06-29

clang - 23.0.0_pre20260628
Ebuild name:

dev-python/clang-23.0.0_pre20260628

Description

Python bindings for llvm-core/clang

Added to portage

2026-06-29

clang - 23.0.0_pre20260628
Ebuild name:

llvm-core/clang-23.0.0_pre20260628

Description

C language family frontend for LLVM

Added to portage

2026-06-29

clang-common - 23.0.0_pre20260628
Ebuild name:

llvm-core/clang-common-23.0.0_pre20260628

Description

Common files shared between multiple slots of clang

Added to portage

2026-06-29

compiler-rt - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/compiler-rt-23.0.0_pre20260628

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-06-29

compiler-rt-sanitizers - 23.0.0_pre20260628
Ebuild name:

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

Description

Compiler runtime libraries for clang (sanit

Added to portage

2026-06-29

flang - 23.0.0_pre20260628
Ebuild name:

llvm-core/flang-23.0.0_pre20260628

Description

LLVM's Fortran frontend

Added to portage

2026-06-29

flang-rt - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/flang-rt-23.0.0_pre20260628

Description

LLVM's Fortran runtime

Added to portage

2026-06-29

gentoo-zsh-completions - 20260628.1
Ebuild name:

app-shells/gentoo-zsh-completions-20260628.1

Description

Gentoo specific zsh completion support (includes emerg

Added to portage

2026-06-29

libclc - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libclc-23.0.0_pre20260628

Description

OpenCL C library

Added to portage

2026-06-29

libcxx - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libcxx-23.0.0_pre20260628

Description

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

Added to portage

2026-06-29

libcxxabi - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libcxxabi-23.0.0_pre20260628

Description

Low level support for a standard C++ library

Added to portage

2026-06-29

libgcc - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libgcc-23.0.0_pre20260628

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2026-06-29

libunwind - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libunwind-23.0.0_pre20260628

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-06-29

lit - 23.0.0_pre20260628
Ebuild name:

dev-python/lit-23.0.0_pre20260628

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-06-29

lld - 23.0.0_pre20260628
Ebuild name:

llvm-core/lld-23.0.0_pre20260628

Description

The LLVM linker (link editor)

Added to portage

2026-06-29

lldb - 23.0.0_pre20260628
Ebuild name:

llvm-core/lldb-23.0.0_pre20260628

Description

The LLVM debugger

Added to portage

2026-06-29

llvm - 23.0.0_pre20260628
Ebuild name:

dev-ml/llvm-23.0.0_pre20260628

Description

OCaml bindings for LLVM

Added to portage

2026-06-29

llvm - 23.0.0_pre20260628
Ebuild name:

llvm-core/llvm-23.0.0_pre20260628

Description

Low Level Virtual Machine

Added to portage

2026-06-29

llvm-common - 23.0.0_pre20260628
Ebuild name:

llvm-core/llvm-common-23.0.0_pre20260628

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-06-29

mlir - 23.0.0_pre20260628
Ebuild name:

llvm-core/mlir-23.0.0_pre20260628

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-06-29

openmp - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/openmp-23.0.0_pre20260628

Description

OpenMP runtime libraries for LLVM/clang compiler

Added to portage

2026-06-29

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

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

Description

OpenMP target library for amdgcn devices

Added to portage

2026-06-29

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

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

Description

OpenMP target library for nvptx64 devic

Added to portage

2026-06-29

openmp-spirv64-intel - 23.0.0_pre20260628
Ebuild name:

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

Description

OpenMP target library for spirv64 Intel devic

Added to portage

2026-06-29

polly - 23.0.0_pre20260628
Ebuild name:

llvm-core/polly-23.0.0_pre20260628

Description

Polyhedral optimizations for LLVM

Added to portage

2026-06-29

quimup - 2.1.2
Ebuild name:

media-sound/quimup-2.1.2

Description

Qt client for the music player daemon (MPD)

Added to portage

2026-06-29

2026-06-28
GnuPG-Interface - 1.70.0
Ebuild name:

dev-perl/GnuPG-Interface-1.70.0

Description

Perl interface to GnuPG

Added to portage

2026-06-28

ardour - 9.7.0-r1
Ebuild name:

media-sound/ardour-9.7.0-r1

Description

Digital Audio Workstation

Added to portage

2026-06-28

asyncssh - 2.24.0
Ebuild name:

dev-python/asyncssh-2.24.0

Description

Asynchronous SSHv2 client and server library

Added to portage

2026-06-28

atari800 - 7.0.0
Ebuild name:

games-emulation/atari800-7.0.0

Description

Emulator of Atari 8-bit computer systems and 5200 game console

Added to portage

2026-06-28

audacity - 3.7.8
Ebuild name:

media-sound/audacity-3.7.8

Description

Free crossplatform audio editor

Added to portage

2026-06-28

chromium - 149.0.7827.200
Ebuild name:

www-client/chromium-149.0.7827.200

Description

Open-source version of Google Chrome web browser

Added to portage

2026-06-28

fastfetch - 2.65.2
Ebuild name:

app-misc/fastfetch-2.65.2

Description

Fast neofetch-like system information tool

Added to portage

2026-06-28

gcc - 13.4.1_p20260624
Ebuild name:

sys-devel/gcc-13.4.1_p20260624

Description

The GNU Compiler Collection

Added to portage

2026-06-28

gcc - 14.4.0
Ebuild name:

sys-devel/gcc-14.4.0

Description

The GNU Compiler Collection

Added to portage

2026-06-28

gcc - 14.5.9999
Ebuild name:

sys-devel/gcc-14.5.9999

Description

The GNU Compiler Collection

Added to portage

2026-06-28

gcc - 15.3.1_p20260626
Ebuild name:

sys-devel/gcc-15.3.1_p20260626

Description

The GNU Compiler Collection

Added to portage

2026-06-28

gcc - 16.1.1_p20260627
Ebuild name:

sys-devel/gcc-16.1.1_p20260627

Description

The GNU Compiler Collection

Added to portage

2026-06-28

gentoolkit - 0.7.5
Ebuild name:

app-portage/gentoolkit-0.7.5

Description

Collection of administration scripts for Gentoo

Added to portage

2026-06-28

gpgme - 2.1.1
Ebuild name:

app-crypt/gpgme-2.1.1

Description

GnuPG Made Easy is a library for making GnuPG easier to use

Added to portage

2026-06-28

hypopg - 1.4.3-r1
Ebuild name:

dev-db/hypopg-1.4.3-r1

Description

Hypothetical Indexes for PostgreSQL

Added to portage

2026-06-28

imapfilter - 2.8.5
Ebuild name:

mail-filter/imapfilter-2.8.5

Description

An IMAP mail filtering utility

Added to portage

2026-06-28

jakartaee-migration - 1.0.12
Ebuild name:

dev-java/jakartaee-migration-1.0.12

Description

Apache Tomcat tool for migration from Java EE 8 to Jakarta EE 9

Added to portage

2026-06-28

libbgcode - 0.0.20260521
Ebuild name:

media-gfx/libbgcode-0.0.20260521

Description

Prusa Block & Binary G-code reader / writer / converter

Added to portage

2026-06-28

libredwg - 0.14
Ebuild name:

media-gfx/libredwg-0.14

Description

C library to handle DWG files

Added to portage

2026-06-28

libsass - 0.23.0-r1
Ebuild name:

dev-python/libsass-0.23.0-r1

Description

A straightforward binding of libsass for Python

Added to portage

2026-06-28

libtmux - 0.59.0
Ebuild name:

dev-python/libtmux-0.59.0

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2026-06-28

libvpl - 2.17.0
Ebuild name:

media-libs/libvpl-2.17.0

Description

Intel Video Processing Library dispatcher

Added to portage

2026-06-28

libvpl-tools - 1.6.0
Ebuild name:

media-libs/libvpl-tools-1.6.0

Description

Intel Video Processing Library tools

Added to portage

2026-06-28

lxqt-panel - 2.4.1-r1
Ebuild name:

lxqt-base/lxqt-panel-2.4.1-r1

Description

LXQt desktop panel and plugins

Added to portage

2026-06-28

lxqt-panel - 2.4.1-r2
Ebuild name:

lxqt-base/lxqt-panel-2.4.1-r2

Description

LXQt desktop panel and plugins

Added to portage

2026-06-28

magit - 9999
Ebuild name:

app-emacs/magit-9999

Description

A Git porcelain inside Emacs

Added to portage

2026-06-28

mirrorselect - 2.6.5
Ebuild name:

app-portage/mirrorselect-2.6.5

Description

Tool to help select distfiles mirrors for Gentoo

Added to portage

2026-06-28

nawk - 20260426
Ebuild name:

sys-apps/nawk-20260426

Description

Brian Kernighan's pattern scanning and processing language

Added to portage

2026-06-28

netpbm - 11.15.0
Ebuild name:

media-libs/netpbm-11.15.0

Description

A set of utilities for converting to/from the netpbm (and related) format

Added to portage

2026-06-28

obs-studio - 32.1.2
Ebuild name:

media-video/obs-studio-32.1.2

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-06-28

pg_background - 1.9.3
Ebuild name:

dev-db/pg_background-1.9.3

Description

Postgres Background Worker

Added to portage

2026-06-28

pg_background - 2.0.2
Ebuild name:

dev-db/pg_background-2.0.2

Description

Postgres Background Worker

Added to portage

2026-06-28

pg_qualstats - 2.1.4-r1
Ebuild name:

dev-db/pg_qualstats-2.1.4-r1

Description

Statistics about predicates for helping finding what indices are missi

Added to portage

2026-06-28

pg_stat_kcache - 2.3.2-r1
Ebuild name:

dev-db/pg_stat_kcache-2.3.2-r1

Description

Statistics about physical disk access and CPU consumption done by ba

Added to portage

2026-06-28

pg_track_settings - 2.1.2-r1
Ebuild name:

dev-db/pg_track_settings-2.1.2-r1

Description

Keeps track of PostgreSQL settings modification

Added to portage

2026-06-28

pg_wait_sampling - 1.1.9-r1
Ebuild name:

dev-db/pg_wait_sampling-1.1.9-r1

Description

Sampling based statistics of wait events

Added to portage

2026-06-28

pkgconf - 2.9.94
Ebuild name:

dev-util/pkgconf-2.9.94

Description

pkg-config compatible replacement with no dependencies other than C99

Added to portage

2026-06-28

powa-archivist - 5.1.2-r1
Ebuild name:

dev-db/powa-archivist-5.1.2-r1

Description

PostgreSQL Workload Analyzer Archivist

Added to portage

2026-06-28

prusaslicer - 2.9.6
Ebuild name:

media-gfx/prusaslicer-2.9.6

Description

A mesh slicer to generate G-code for fused-filament-fabrication (3D pri

Added to portage

2026-06-28

pulsectl-asyncio - 1.3.2
Ebuild name:

dev-python/pulsectl-asyncio-1.3.2

Description

Asyncio frontend for pulsectl, Python bindings of libpulse

Added to portage

2026-06-28

python - 0.3.14.6_p1
Ebuild name:

dev-lang/python-0.3.14.6_p1

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-06-28

python - 3.14.6_p1
Ebuild name:

dev-lang/python-3.14.6_p1

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-06-28

python-tests - 0.3.14.6_p1
Ebuild name:

dev-python/python-tests-0.3.14.6_p1

Description

Test modules from dev-lang/python

Added to portage

2026-06-28

python-tests - 3.14.6_p1
Ebuild name:

dev-python/python-tests-3.14.6_p1

Description

Test modules from dev-lang/python

Added to portage

2026-06-28

qdmr - 0.15.1
Ebuild name:

net-wireless/qdmr-0.15.1

Description

GUI application for configuring and programming cheap DMR radios

Added to portage

2026-06-28

qtox - 1.18.5
Ebuild name:

net-im/qtox-1.18.5

Description

Instant messaging client using the encrypted p2p Tox protocol

Added to portage

2026-06-28

rpi-eeprom - 28.28
Ebuild name:

dev-embedded/rpi-eeprom-28.28

Description

Updater for Raspberry Pi 4/5 bootloader and the VL805 USB controller

Added to portage

2026-06-28

screengrab - 3.2.0-r1
Ebuild name:

x11-misc/screengrab-3.2.0-r1

Description

Qt GUI Screenshot Utility

Added to portage

2026-06-28

screengrab - 3.2.0-r2
Ebuild name:

x11-misc/screengrab-3.2.0-r2

Description

Qt GUI Screenshot Utility

Added to portage

2026-06-28

setuptools-rust - 1.13.0
Ebuild name:

dev-python/setuptools-rust-1.13.0

Description

A plugin for setuptools to build Rust Python extensions

Added to portage

2026-06-28

socat - 1.8.1.3
Ebuild name:

net-misc/socat-1.8.1.3

Description

Multipurpose relay (SOcket CAT)

Added to portage

2026-06-28

spyder - 6.1.5
Ebuild name:

dev-python/spyder-6.1.5

Description

The Scientific Python Development Environment

Added to portage

2026-06-28

strawberry - 1.2.21
Ebuild name:

media-sound/strawberry-1.2.21

Description

Modern music player and library organizer based on Clementine and Qt

Added to portage

2026-06-28

tibs - 0.11.0
Ebuild name:

dev-python/tibs-0.11.0

Description

A sleek Python library for your binary data

Added to portage

2026-06-28

tinc - 1.0.37
Ebuild name:

net-vpn/tinc-1.0.37

Description

tinc is an easy to configure VPN implementation

Added to portage

2026-06-28

tomcat - 10.1.56
Ebuild name:

www-servers/tomcat-10.1.56

Description

Tomcat Servlet-6.0/JSP-3.1/EL-5.0/WebSocket-2.1/JASPIC-3.0 Container

Added to portage

2026-06-28

tomcat - 11.0.23
Ebuild name:

www-servers/tomcat-11.0.23

Description

Tomcat Servlet-6.1/JSP-4.0/EL-6.0/WebSocket-2.2/JASPIC-3.1 Container

Added to portage

2026-06-28

tomcat - 9.0.119
Ebuild name:

www-servers/tomcat-9.0.119

Description

Tomcat Servlet-4.0/JSP-2.3/EL-3.0/WebSocket-1.1/JASPIC-1.1 Container

Added to portage

2026-06-28

tomcat-native - 1.3.8
Ebuild name:

dev-java/tomcat-native-1.3.8

Description

Allows Tomcat to use certain native resources for better performance

Added to portage

2026-06-28

tomcat-native - 2.0.15
Ebuild name:

dev-java/tomcat-native-2.0.15

Description

Allows Tomcat to use certain native resources for better performance

Added to portage

2026-06-28

uhd - 4.10.0.0-r2
Ebuild name:

net-wireless/uhd-4.10.0.0-r2

Description

Universal Software Radio Peripheral (USRP) Hardware Driver

Added to portage

2026-06-28

valentina - 1.0.4
Ebuild name:

media-gfx/valentina-1.0.4

Description

Cloth patternmaking software

Added to portage

2026-06-28

vpl-gpu-rt - 26.2.1
Ebuild name:

media-libs/vpl-gpu-rt-26.2.1

Description

Intel Video Processing Library GPU Runtime

Added to portage

2026-06-28

xclock - 1.2.0
Ebuild name:

x11-apps/xclock-1.2.0

Description

analog / digital clock for X

Added to portage

2026-06-28

xxhash - 3.8.0
Ebuild name:

dev-python/xxhash-3.8.0

Description

Python binding for the xxHash library

Added to portage

2026-06-28

zabbix - 7.0.27
Ebuild name:

net-analyzer/zabbix-7.0.27

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2026-06-28

zabbix - 7.4.11
Ebuild name:

net-analyzer/zabbix-7.4.11

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2026-06-28

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