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:

87263

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-07-29
annotated-doc - 0.0.5
Ebuild name:

dev-python/annotated-doc-0.0.5

Description

Document parameters, variables inline, with Annotated

Added to portage

2026-07-29

awkward - 2.12.0
Ebuild name:

dev-python/awkward-2.12.0

Description

Manipulate JSON-like data with NumPy-like idioms

Added to portage

2026-07-29

awkward-cpp - 55
Ebuild name:

dev-python/awkward-cpp-55

Description

CPU kernels and compiled extensions for Awkward Array

Added to portage

2026-07-29

awscli - 1.45.58
Ebuild name:

app-admin/awscli-1.45.58

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-29

borgbackup - 1.4.5
Ebuild name:

app-backup/borgbackup-1.4.5

Description

Deduplicating backup program with compression and authenticated encrypt

Added to portage

2026-07-29

boto3 - 1.43.58
Ebuild name:

dev-python/boto3-1.43.58

Description

The AWS SDK for Python

Added to portage

2026-07-29

botocore - 1.43.58
Ebuild name:

dev-python/botocore-1.43.58

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-29

cfn-lint - 1.53.3
Ebuild name:

dev-python/cfn-lint-1.53.3

Description

CloudFormation Linter

Added to portage

2026-07-29

clang - 23.1.0_rc2
Ebuild name:

dev-python/clang-23.1.0_rc2

Description

Python bindings for llvm-core/clang

Added to portage

2026-07-29

clang - 23.1.0_rc2
Ebuild name:

llvm-core/clang-23.1.0_rc2

Description

C language family frontend for LLVM

Added to portage

2026-07-29

clang-common - 23.1.0_rc2
Ebuild name:

llvm-core/clang-common-23.1.0_rc2

Description

Common files shared between multiple slots of clang

Added to portage

2026-07-29

compiler-rt - 23.1.0_rc2
Ebuild name:

llvm-runtimes/compiler-rt-23.1.0_rc2

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-07-29

compiler-rt-sanitizers - 23.1.0_rc2
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-23.1.0_rc2

Description

Compiler runtime libraries for clang (sanitizers &a

Added to portage

2026-07-29

fastapi - 0.140.13
Ebuild name:

dev-python/fastapi-0.140.13

Description

High performance framework, easy to learn, fast to code, ready for prod

Added to portage

2026-07-29

flang - 23.1.0_rc2
Ebuild name:

llvm-core/flang-23.1.0_rc2

Description

LLVM's Fortran frontend

Added to portage

2026-07-29

flang-rt - 23.1.0_rc2
Ebuild name:

llvm-runtimes/flang-rt-23.1.0_rc2

Description

LLVM's Fortran runtime

Added to portage

2026-07-29

flatpak-builder - 1.4.10-r1
Ebuild name:

dev-util/flatpak-builder-1.4.10-r1

Description

Tool to build flatpaks from source

Added to portage

2026-07-29

fsspec - 2026.7.0
Ebuild name:

dev-python/fsspec-2026.7.0

Description

A specification that python filesystems should adhere to

Added to portage

2026-07-29

hypothesis - 6.163.0
Ebuild name:

dev-python/hypothesis-6.163.0

Description

A library for property based testing

Added to portage

2026-07-29

jansson - 2.15.1
Ebuild name:

dev-libs/jansson-2.15.1

Description

C library for encoding, decoding and manipulating JSON data

Added to portage

2026-07-29

kirigami-app-components - 1.0.2
Ebuild name:

dev-libs/kirigami-app-components-1.0.2

Description

Kirigami addons and modules necessary to do a full featured

Added to portage

2026-07-29

knot-resolver - 5.7.7-r1
Ebuild name:

net-dns/knot-resolver-5.7.7-r1

Description

A scaleable caching DNS resolver

Added to portage

2026-07-29

knot-resolver - 6.4.1-r1
Ebuild name:

net-dns/knot-resolver-6.4.1-r1

Description

Scaleable caching DNS resolver

Added to portage

2026-07-29

libarchive - 3.8.9
Ebuild name:

app-arch/libarchive-3.8.9

Description

Multi-format archive and compression library

Added to portage

2026-07-29

libclc - 23.1.0_rc2
Ebuild name:

llvm-runtimes/libclc-23.1.0_rc2

Description

OpenCL C library

Added to portage

2026-07-29

libcxx - 23.1.0_rc2
Ebuild name:

llvm-runtimes/libcxx-23.1.0_rc2

Description

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

Added to portage

2026-07-29

libcxxabi - 23.1.0_rc2
Ebuild name:

llvm-runtimes/libcxxabi-23.1.0_rc2

Description

Low level support for a standard C++ library

Added to portage

2026-07-29

libgcc - 23.1.0_rc2
Ebuild name:

llvm-runtimes/libgcc-23.1.0_rc2

Description

Compiler runtime library for clang, compatible with libgcc_s

Added to portage

2026-07-29

libunwind - 23.1.0_rc2
Ebuild name:

llvm-runtimes/libunwind-23.1.0_rc2

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-07-29

lit - 23.1.0_rc2
Ebuild name:

dev-python/lit-23.1.0_rc2

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-07-29

lld - 23.1.0_rc2
Ebuild name:

llvm-core/lld-23.1.0_rc2

Description

The LLVM linker (link editor)

Added to portage

2026-07-29

lldb - 23.1.0_rc2
Ebuild name:

llvm-core/lldb-23.1.0_rc2

Description

The LLVM debugger

Added to portage

2026-07-29

llvm - 23.1.0_rc2
Ebuild name:

dev-ml/llvm-23.1.0_rc2

Description

OCaml bindings for LLVM

Added to portage

2026-07-29

llvm - 23.1.0_rc2
Ebuild name:

llvm-core/llvm-23.1.0_rc2

Description

Low Level Virtual Machine

Added to portage

2026-07-29

llvm-common - 23.1.0_rc2
Ebuild name:

llvm-core/llvm-common-23.1.0_rc2

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-07-29

matlab - 9999
Ebuild name:

app-emacs/matlab-9999

Description

Major modes for MATLAB .m and .tlc files

Added to portage

2026-07-29

mediawiki - 2.3.1
Ebuild name:

app-emacs/mediawiki-2.3.1

Description

MediaWiki client for Emacs

Added to portage

2026-07-29

meson-mode - 0.4
Ebuild name:

app-emacs/meson-mode-0.4

Description

A GNU Emacs major mode for Meson build-system files

Added to portage

2026-07-29

mlir - 23.1.0_rc2
Ebuild name:

llvm-core/mlir-23.1.0_rc2

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-07-29

openmp - 23.1.0_rc2
Ebuild name:

llvm-runtimes/openmp-23.1.0_rc2

Description

OpenMP runtime libraries for LLVM/clang compiler

Added to portage

2026-07-29

openmp-amdgcn-amd-amdhsa - 23.1.0_rc2
Ebuild name:

llvm-runtimes/openmp-amdgcn-amd-amdhsa-23.1.0_rc2

Description

OpenMP target library for amdgcn devices

Added to portage

2026-07-29

openmp-nvptx64-nvidia-cuda - 23.1.0_rc2
Ebuild name:

llvm-runtimes/openmp-nvptx64-nvidia-cuda-23.1.0_rc2

Description

OpenMP target library for nvptx64 devices

Added to portage

2026-07-29

openmp-spirv64-intel - 23.1.0_rc2
Ebuild name:

llvm-runtimes/openmp-spirv64-intel-23.1.0_rc2

Description

OpenMP target library for spirv64 Intel devices

Added to portage

2026-07-29

openpgp-keys-unrealircd - 20241118
Ebuild name:

sec-keys/openpgp-keys-unrealircd-20241118

Description

OpenPGP keys used to sign UnrealIRCd releases

Added to portage

2026-07-29

pbs-installer - 2026.7.28
Ebuild name:

dev-python/pbs-installer-2026.7.28

Description

Installer for Python Build Standalone

Added to portage

2026-07-29

polly - 23.1.0_rc2
Ebuild name:

llvm-core/polly-23.1.0_rc2

Description

Polyhedral optimizations for LLVM

Added to portage

2026-07-29

pypi-attestations - 0.0.30
Ebuild name:

dev-python/pypi-attestations-0.0.30

Description

Convert between Sigstore Bundles and PEP-740 Attestation object

Added to portage

2026-07-29

pyzotero - 1.13.3
Ebuild name:

dev-python/pyzotero-1.13.3

Description

A Python client for the Zotero API

Added to portage

2026-07-29

unrealircd - 6.2.6
Ebuild name:

net-irc/unrealircd-6.2.6

Description

An advanced Internet Relay Chat daemon

Added to portage

2026-07-29

yara - 4.5.8
Ebuild name:

app-forensics/yara-4.5.8

Description

A malware identification and classification tool

Added to portage

2026-07-29

2026-07-28
accountsservice - 23.13.9-r1
Ebuild name:

sys-apps/accountsservice-23.13.9-r1

Description

D-Bus interfaces for querying and manipulating user account inf

Added to portage

2026-07-28

accountsservice - 26.27.3
Ebuild name:

sys-apps/accountsservice-26.27.3

Description

D-Bus interfaces for querying and manipulating user account inform

Added to portage

2026-07-28

awscli - 1.45.57
Ebuild name:

app-admin/awscli-1.45.57

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-28

boto3 - 1.43.57
Ebuild name:

dev-python/boto3-1.43.57

Description

The AWS SDK for Python

Added to portage

2026-07-28

botocore - 1.43.57
Ebuild name:

dev-python/botocore-1.43.57

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-28

brotli - 0.8.0-r1
Ebuild name:

dev-ruby/brotli-0.8.0-r1

Description

Brotli compressor/decompressor

Added to portage

2026-07-28

c-blosc2 - 3.3.0
Ebuild name:

dev-libs/c-blosc2-3.3.0

Description

Blocking, shuffling and lossless compression library

Added to portage

2026-07-28

cachebox - 6.2.1
Ebuild name:

dev-python/cachebox-6.2.1

Description

The fastest memoizing and caching Python library written in Rust

Added to portage

2026-07-28

cssselect - 1.5.0
Ebuild name:

dev-python/cssselect-1.5.0

Description

Parse CSS3 Selectors and translate them to XPath 1.0

Added to portage

2026-07-28

deepdiff - 9.1.0
Ebuild name:

dev-python/deepdiff-9.1.0

Description

A library for comparing dictionaries, iterables, strings and other object

Added to portage

2026-07-28

fastapi - 0.140.7
Ebuild name:

dev-python/fastapi-0.140.7

Description

High performance framework, easy to learn, fast to code, ready for produ

Added to portage

2026-07-28

fastbencode - 0.3.11
Ebuild name:

dev-python/fastbencode-0.3.11

Description

Implementation of bencode with Rust implementation

Added to portage

2026-07-28

fastjsonschema - 2.22.1
Ebuild name:

dev-python/fastjsonschema-2.22.1

Description

Fast JSON schema validator for Python

Added to portage

2026-07-28

gdm - 49.3-r2
Ebuild name:

gnome-base/gdm-49.3-r2

Description

GNOME Display Manager for managing graphical display servers and user logins

Added to portage

2026-07-28

gnome-control-center - 49.8-r1
Ebuild name:

gnome-base/gnome-control-center-49.8-r1

Description

GNOME's main interface to configure various aspects of the

Added to portage

2026-07-28

gnome-flashback-herbstluftwm - 1.0
Ebuild name:

x11-wm/gnome-flashback-herbstluftwm-1.0

Description

GNOME Herbstluftwm session (via GNOME Flashback)

Added to portage

2026-07-28

gnome-shell-extension-appindicator - 65
Ebuild name:

gnome-extra/gnome-shell-extension-appindicator-65

Description

Support legacy, AppIndicators and KStatusNotifier

Added to portage

2026-07-28

guile - 3.0.11-r1
Ebuild name:

dev-scheme/guile-3.0.11-r1

Description

GNU Ubiquitous Intelligent Language for Extensions

Added to portage

2026-07-28

hypothesis - 6.161.8
Ebuild name:

dev-python/hypothesis-6.161.8

Description

A library for property based testing

Added to portage

2026-07-28

inline-snapshot - 0.35.3
Ebuild name:

dev-python/inline-snapshot-0.35.3

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-07-28

krita - 6.0.3
Ebuild name:

media-gfx/krita-6.0.3

Description

Free digital painting application. Digital Painting, Creative Freedom

Added to portage

2026-07-28

libwebsockets - 5.0.0-r1
Ebuild name:

net-libs/libwebsockets-5.0.0-r1

Description

A flexible pure-C library for implementing network protocols

Added to portage

2026-07-28

meson-mode - 0.4
Ebuild name:

app-emacs/meson-mode-0.4

Description

A GNU Emacs major mode for Meson build-system files

Added to portage

2026-07-28

psych - 5.4.0
Ebuild name:

dev-ruby/psych-5.4.0

Description

A YAML parser and emitter

Added to portage

2026-07-28

pyproject-fmt - 2.26.0
Ebuild name:

dev-python/pyproject-fmt-2.26.0

Description

Format your pyproject.toml file

Added to portage

2026-07-28

pyquery - 2.0.2
Ebuild name:

dev-python/pyquery-2.0.2

Description

A jQuery-like library for python

Added to portage

2026-07-28

pyquery - 2.1.0
Ebuild name:

dev-python/pyquery-2.1.0

Description

A jQuery-like library for python

Added to portage

2026-07-28

python-lsp-server - 1.15.0
Ebuild name:

dev-python/python-lsp-server-1.15.0

Description

Python Language Server for the Language Server Protocol

Added to portage

2026-07-28

ruff - 0.16.0
Ebuild name:

dev-util/ruff-0.16.0

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-07-28

samba - 4.23.10
Ebuild name:

net-fs/samba-4.23.10

Description

Samba Suite Version 4

Added to portage

2026-07-28

samba - 4.24.5
Ebuild name:

net-fs/samba-4.24.5

Description

Samba Suite Version 4

Added to portage

2026-07-28

sqlglot - 30.14.0
Ebuild name:

dev-python/sqlglot-30.14.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2026-07-28

tailscale - 1.102.0
Ebuild name:

net-vpn/tailscale-1.102.0

Description

Tailscale vpn client

Added to portage

2026-07-28

tekore - 6.2.0
Ebuild name:

dev-python/tekore-6.2.0

Description

Spotify Web API client

Added to portage

2026-07-28

tqdm - 4.70.0
Ebuild name:

dev-python/tqdm-4.70.0

Description

Add a progress meter to your loops in a second

Added to portage

2026-07-28

ttyd - 1.7.7-r2
Ebuild name:

www-apps/ttyd-1.7.7-r2

Description

ttyd, a simple command-line tool for sharing terminal over the web

Added to portage

2026-07-28

twine - 7.0.0
Ebuild name:

dev-python/twine-7.0.0

Description

Collection of utilities for publishing packages on PyPI

Added to portage

2026-07-28

zoom - 7.0.0.1666-r2
Ebuild name:

net-im/zoom-7.0.0.1666-r2

Description

Video conferencing and web conferencing service

Added to portage

2026-07-28

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