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:

88197

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-09-06
aboot - 2.0
Ebuild name:

sys-boot/aboot-2.0

Description

Alpha Linux boot loader for SRM

Added to portage

2026-09-06

adwaita-fonts - 50.0
Ebuild name:

media-fonts/adwaita-fonts-50.0

Description

The typefaces for GNOME

Added to portage

2026-09-06

ansi2html - 1.9.5
Ebuild name:

dev-python/ansi2html-1.9.5

Description

Convert text with ANSI color codes to HTML

Added to portage

2026-09-06

anyio - 4.15.1
Ebuild name:

dev-python/anyio-4.15.1

Description

Compatibility layer for multiple asynchronous event loop implementations

Added to portage

2026-09-06

at-spi2-core - 2.60.6
Ebuild name:

app-accessibility/at-spi2-core-2.60.6

Description

D-Bus accessibility specifications and registration daemon

Added to portage

2026-09-06

celluloid - 0.30-r1
Ebuild name:

media-video/celluloid-0.30-r1

Description

Simple GTK+ frontend for mpv

Added to portage

2026-09-06

chemex - 2026.9.0
Ebuild name:

sci-chemistry/chemex-2026.9.0

Description

Program to fit chemical exchange induced shift and relaxation data

Added to portage

2026-09-06

davix - 0.9.0
Ebuild name:

net-libs/davix-0.9.0

Description

High-performance file management over WebDAV/HTTP

Added to portage

2026-09-06

dokuwiki - 20260714c
Ebuild name:

www-apps/dokuwiki-20260714c

Description

DokuWiki is a simple to use Wiki aimed at a small company's documentati

Added to portage

2026-09-06

e16 - 1.0.32
Ebuild name:

x11-wm/e16-1.0.32

Description

Enlightenment Window Manager (E16)

Added to portage

2026-09-06

eog - 50.3
Ebuild name:

media-gfx/eog-50.3

Description

The Eye of GNOME image viewer

Added to portage

2026-09-06

fastfetch - 2.68.1
Ebuild name:

app-misc/fastfetch-2.68.1

Description

Fast neofetch-like system information tool

Added to portage

2026-09-06

getmail - 6.20.01
Ebuild name:

net-mail/getmail-6.20.01

Description

A mail retriever with reliable Maildir and mbox delivery

Added to portage

2026-09-06

gimp-arrow-brushes - 20190407-r1
Ebuild name:

media-gfx/gimp-arrow-brushes-20190407-r1

Description

Brushes for GIMP with the styles arrow, handpointer, butto

Added to portage

2026-09-06

git-bug - 0.10.1
Ebuild name:

dev-util/git-bug-0.10.1

Description

Distributed, offline-first bug tracker embedded in git

Added to portage

2026-09-06

gitstats - 0_pre20201124-r1
Ebuild name:

dev-vcs/gitstats-0_pre20201124-r1

Description

Statistics generator for git

Added to portage

2026-09-06

glycin - 2.1.5
Ebuild name:

media-libs/glycin-2.1.5

Description

Sandboxed and extendable image loading library

Added to portage

2026-09-06

gnome-clocks - 50.0
Ebuild name:

gnome-extra/gnome-clocks-50.0

Description

Clocks application for GNOME

Added to portage

2026-09-06

gnome-shell-extension-alphabetical-grid - 46.0
Ebuild name:

gnome-extra/gnome-shell-extension-alphabetical-grid-46.0

Description

Restore the alphabetical ordering of the a

Added to portage

2026-09-06

grisbi - 3.90.1
Ebuild name:

app-office/grisbi-3.90.1

Description

Grisbi is a personal accounting application for Linux

Added to portage

2026-09-06

kaidan - 0.16.0
Ebuild name:

net-im/kaidan-0.16.0

Description

Modern XMPP chat app for every device

Added to portage

2026-09-06

kmymoney - 5.2.2_p20260906
Ebuild name:

app-office/kmymoney-5.2.2_p20260906

Description

Personal finance manager based on KDE Frameworks

Added to portage

2026-09-06

lean-mode - 0_p20230611-r1
Ebuild name:

app-emacs/lean-mode-0_p20230611-r1

Description

Emacs mode for the Lean 3 theorem prover

Added to portage

2026-09-06

mongodb - 8.0.29
Ebuild name:

dev-db/mongodb-8.0.29

Description

A high-performance, open source, schema-free document-oriented database

Added to portage

2026-09-06

mongodb - 8.3.8
Ebuild name:

dev-db/mongodb-8.3.8

Description

A high-performance, open source, schema-free document-oriented database

Added to portage

2026-09-06

netpbm - 11.15.7
Ebuild name:

media-libs/netpbm-11.15.7

Description

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

Added to portage

2026-09-06

netpbm - 11.2.29
Ebuild name:

media-libs/netpbm-11.2.29

Description

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

Added to portage

2026-09-06

nuitka - 4.2.1
Ebuild name:

dev-python/nuitka-4.2.1

Description

Python to native compiler

Added to portage

2026-09-06

oidc-agent - 5.3.8
Ebuild name:

net-misc/oidc-agent-5.3.8

Description

Agent and tools for managing OpenID Connect tokens on the command line

Added to portage

2026-09-06

peewee - 4.5.0
Ebuild name:

dev-python/peewee-4.5.0

Description

Small Python ORM

Added to portage

2026-09-06

pikepdf - 10.13.0_p1
Ebuild name:

dev-python/pikepdf-10.13.0_p1

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-09-06

pkgconf - 3.0.7
Ebuild name:

dev-util/pkgconf-3.0.7

Description

pkg-config compatible replacement with no dependencies other than C99

Added to portage

2026-09-06

poetry - 2.4.3
Ebuild name:

dev-python/poetry-2.4.3

Description

A frontend for poetry - a python dependency management and packaging tool

Added to portage

2026-09-06

pure-eval - 0.2.3-r1
Ebuild name:

dev-python/pure-eval-0.2.3-r1

Description

Safely evaluate AST nodes without side effects

Added to portage

2026-09-06

pyproj - 3.8.0
Ebuild name:

dev-python/pyproj-3.8.0

Description

Python interface to the PROJ library

Added to portage

2026-09-06

pysequoia - 0.1.35
Ebuild name:

dev-python/pysequoia-0.1.35

Description

Provides OpenPGP facilities using Sequoia-PGP library

Added to portage

2026-09-06

qxmpp - 1.16.3
Ebuild name:

net-libs/qxmpp-1.16.3

Description

Cross-platform C++ XMPP client and server library

Added to portage

2026-09-06

readme-renderer - 46.0-r1
Ebuild name:

dev-python/readme-renderer-46.0-r1

Description

A library for rendering 'readme' descriptions for Warehouse

Added to portage

2026-09-06

regress - 2026.9.1
Ebuild name:

dev-python/regress-2026.9.1

Description

Python bindings to the Rust regress crate

Added to portage

2026-09-06

rich-click - 1.9.9
Ebuild name:

dev-python/rich-click-1.9.9

Description

Format click help output nicely with rich

Added to portage

2026-09-06

root - 6.40.04
Ebuild name:

sci-physics/root-6.40.04

Description

C++ data analysis framework and interpreter from CERN

Added to portage

2026-09-06

skrooge - 26.8.0
Ebuild name:

app-office/skrooge-26.8.0

Description

Personal finances manager, aiming at being simple and intuitive

Added to portage

2026-09-06

taglib - 2.3.2
Ebuild name:

media-libs/taglib-2.3.2

Description

Library for reading and editing audio meta data

Added to portage

2026-09-06

thriftpy2 - 0.7.1
Ebuild name:

dev-python/thriftpy2-0.7.1

Description

Pure python approach of Apache Thrift

Added to portage

2026-09-06

uftrace - 0.20
Ebuild name:

dev-util/uftrace-0.20

Description

Function (graph) tracer for user-space

Added to portage

2026-09-06

untrunc - 0_pre20260820
Ebuild name:

media-video/untrunc-0_pre20260820

Description

Restore truncated mp4/mov files

Added to portage

2026-09-06

unuran - 1.12.0
Ebuild name:

sci-mathematics/unuran-1.12.0

Description

Universal Non-Uniform Random number generator

Added to portage

2026-09-06

virt-firmware - 26.9
Ebuild name:

app-emulation/virt-firmware-26.9

Description

Tools for ovmf/armvirt firmware volumes

Added to portage

2026-09-06

virtualgl - 3.1.5
Ebuild name:

x11-misc/virtualgl-3.1.5

Description

Run OpenGL applications remotely with full 3D hardware acceleration

Added to portage

2026-09-06

vpl-gpu-rt - 26.3.2
Ebuild name:

media-libs/vpl-gpu-rt-26.3.2

Description

Intel Video Processing Library GPU Runtime

Added to portage

2026-09-06

2026-09-05
alembic - 1.19.2
Ebuild name:

dev-python/alembic-1.19.2

Description

Database migrations tool, written by the author of SQLAlchemy

Added to portage

2026-09-05

boto3 - 1.43.89
Ebuild name:

dev-python/boto3-1.43.89

Description

The AWS SDK for Python

Added to portage

2026-09-05

botocore - 1.43.89
Ebuild name:

dev-python/botocore-1.43.89

Description

Low-level, data-driven core of boto 3

Added to portage

2026-09-05

cachebox - 6.2.7
Ebuild name:

dev-python/cachebox-6.2.7

Description

The fastest memoizing and caching Python library written in Rust

Added to portage

2026-09-05

ceph - 20.2.1-r4
Ebuild name:

sys-cluster/ceph-20.2.1-r4

Description

Ceph distributed filesystem

Added to portage

2026-09-05

ceph - 20.2.4
Ebuild name:

sys-cluster/ceph-20.2.4

Description

Ceph distributed filesystem

Added to portage

2026-09-05

derper - 1.102.2-r1
Ebuild name:

net-vpn/derper-1.102.2-r1

Description

DERP server for tailscale network

Added to portage

2026-09-05

dovecot - 2.4.5-r1
Ebuild name:

net-mail/dovecot-2.4.5-r1

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-09-05

firefox - 155.0.1
Ebuild name:

www-client/firefox-155.0.1

Description

Firefox Web Browser

Added to portage

2026-09-05

firefox-bin - 155.0.1
Ebuild name:

www-client/firefox-bin-155.0.1

Description

Firefox Web Browser

Added to portage

2026-09-05

firefox-l10n - 155.0.1
Ebuild name:

www-client/firefox-l10n-155.0.1

Description

Firefox Web Browser's translation files

Added to portage

2026-09-05

flask-caching - 2.5.1
Ebuild name:

dev-python/flask-caching-2.5.1

Description

Adds caching support to Flask applications

Added to portage

2026-09-05

gentoo-bashcomp - 20260905
Ebuild name:

app-shells/gentoo-bashcomp-20260905

Description

Gentoo-specific bash command-line completions (emerge, ebuild,

Added to portage

2026-09-05

ggml - 0.23.0
Ebuild name:

sci-ml/ggml-0.23.0

Description

Tensor library for machine learning

Added to portage

2026-09-05

gpgmepy - 2.0.0-r2
Ebuild name:

dev-python/gpgmepy-2.0.0-r2

Description

GnuPG Made Easy is a library for making GnuPG easier to use (Python bin

Added to portage

2026-09-05

ibus-typing-booster - 2.31.0
Ebuild name:

app-i18n/ibus-typing-booster-2.31.0

Description

Completion input method for IBus

Added to portage

2026-09-05

jupyter-builder - 1.2.3
Ebuild name:

dev-python/jupyter-builder-1.2.3

Description

JupyterLab build tools

Added to portage

2026-09-05

kquickimageeditor - 0.7.0.1
Ebuild name:

media-libs/kquickimageeditor-0.7.0.1

Description

QtQuick components providing basic image editing capabilities

Added to portage

2026-09-05

ledger-mode - 4.0.0
Ebuild name:

app-emacs/ledger-mode-4.0.0

Description

An Emacs major mode for editing ledger files

Added to portage

2026-09-05

libxml2 - 2.15.4
Ebuild name:

dev-libs/libxml2-2.15.4

Description

XML C parser and toolkit

Added to portage

2026-09-05

ollama - 0.33.3
Ebuild name:

sci-ml/ollama-0.33.3

Description

Get up and running with Llama 3, Mistral, Gemma, and other language models

Added to portage

2026-09-05

pdns-recursor - 5.4.6
Ebuild name:

net-dns/pdns-recursor-5.4.6

Description

The PowerDNS Recursor

Added to portage

2026-09-05

pebble - 5.2.2
Ebuild name:

dev-python/pebble-5.2.2

Description

Threading and multiprocessing eye-candy

Added to portage

2026-09-05

pkgcheck - 0.10.43
Ebuild name:

dev-util/pkgcheck-0.10.43

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2026-09-05

pkgcore - 0.12.42
Ebuild name:

sys-apps/pkgcore-0.12.42

Description

a framework for package management

Added to portage

2026-09-05

pkgdev - 0.2.18
Ebuild name:

dev-util/pkgdev-0.2.18

Description

Collection of tools for Gentoo development

Added to portage

2026-09-05

py-landlock - 0.1.1
Ebuild name:

dev-python/py-landlock-0.1.1

Description

Python bindings for the Linux Landlock security module

Added to portage

2026-09-05

pygraphviz - 2.0.1-r1
Ebuild name:

dev-python/pygraphviz-2.0.1-r1

Description

Python wrapper for the Graphviz Agraph data structure

Added to portage

2026-09-05

pymongo - 4.18.0
Ebuild name:

dev-python/pymongo-4.18.0

Description

Python driver for MongoDB

Added to portage

2026-09-05

pypdf - 6.17.0
Ebuild name:

dev-python/pypdf-6.17.0

Description

Python library to work with PDF files

Added to portage

2026-09-05

securesystemslib - 1.5.1
Ebuild name:

dev-python/securesystemslib-1.5.1

Description

Cryptographic routines for Secure Systems Lab projects at NYU

Added to portage

2026-09-05

snakeoil - 0.11.6
Ebuild name:

dev-python/snakeoil-0.11.6

Description

misc common functionality and useful optimizations

Added to portage

2026-09-05

spidermonkey - 153.2.0
Ebuild name:

dev-lang/spidermonkey-153.2.0

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-09-05

stockfish - 19
Ebuild name:

games-board/stockfish-19

Description

Free UCI chess engine, claimed to be the strongest in the world

Added to portage

2026-09-05

towncrier - 26.9.0
Ebuild name:

dev-python/towncrier-26.9.0

Description

Building newsfiles for your project

Added to portage

2026-09-05

ujson - 6.0.0
Ebuild name:

dev-python/ujson-6.0.0

Description

Ultra fast JSON encoder and decoder for Python

Added to portage

2026-09-05

util-linux - 2.42.3
Ebuild name:

sys-apps/util-linux-2.42.3

Description

Various useful Linux utilities

Added to portage

2026-09-05

uv - 0.12.10
Ebuild name:

dev-python/uv-0.12.10

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-09-05

uv-build - 0.12.10
Ebuild name:

dev-python/uv-build-0.12.10

Description

PEP517 uv build backend

Added to portage

2026-09-05

wine-staging - 11.17
Ebuild name:

app-emulation/wine-staging-11.17

Description

Free implementation of Windows(tm) on Unix, with Wine-Staging patc

Added to portage

2026-09-05

wine-vanilla - 11.17
Ebuild name:

app-emulation/wine-vanilla-11.17

Description

Free implementation of Windows(tm) on Unix, without external patch

Added to portage

2026-09-05

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