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:

86035

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-19
aml - 1.0.0
Ebuild name:

dev-libs/aml-1.0.0

Description

Event timer executor loop

Added to portage

2026-06-19

drupal - 10.5.12
Ebuild name:

www-apps/drupal-10.5.12

Description

PHP-based open-source platform and content management system

Added to portage

2026-06-19

drupal - 10.6.11
Ebuild name:

www-apps/drupal-10.6.11

Description

PHP-based open-source platform and content management system

Added to portage

2026-06-19

drupal - 11.2.14
Ebuild name:

www-apps/drupal-11.2.14

Description

PHP-based open-source platform and content management system

Added to portage

2026-06-19

drupal - 11.3.12
Ebuild name:

www-apps/drupal-11.3.12

Description

PHP-based open-source platform and content management system

Added to portage

2026-06-19

mattermost-desktop-bin - 5.13.7
Ebuild name:

net-im/mattermost-desktop-bin-5.13.7

Description

Mattermost Desktop application

Added to portage

2026-06-19

mattermost-desktop-bin - 6.2.1
Ebuild name:

net-im/mattermost-desktop-bin-6.2.1

Description

Mattermost Desktop application

Added to portage

2026-06-19

neatvnc - 1.0.0
Ebuild name:

gui-libs/neatvnc-1.0.0

Description

Liberally licensed VNC server library with a clean interface

Added to portage

2026-06-19

virtualbox - 7.2.10
Ebuild name:

app-emulation/virtualbox-7.2.10

Description

Family of powerful x86 virtualization products for enterprise and h

Added to portage

2026-06-19

virtualbox-additions - 7.2.10
Ebuild name:

app-emulation/virtualbox-additions-7.2.10

Description

CD image containing guest additions for VirtualBox

Added to portage

2026-06-19

virtualbox-extpack-oracle - 7.2.10
Ebuild name:

app-emulation/virtualbox-extpack-oracle-7.2.10

Description

PUEL extensions for VirtualBox

Added to portage

2026-06-19

virtualbox-guest-additions - 7.2.10
Ebuild name:

app-emulation/virtualbox-guest-additions-7.2.10

Description

VirtualBox kernel modules and user-space tools for

Added to portage

2026-06-19

virtualbox-guest-modules - 7.2.10
Ebuild name:

app-emulation/virtualbox-guest-modules-7.2.10

Description

Kernel Modules for Virtualbox Guest Additions

Added to portage

2026-06-19

virtualbox-kvm - 7.2.10_pre20260201
Ebuild name:

app-emulation/virtualbox-kvm-7.2.10_pre20260201

Description

Family of powerful x86 virtualization products for

Added to portage

2026-06-19

virtualbox-modules - 7.2.10
Ebuild name:

app-emulation/virtualbox-modules-7.2.10

Description

Kernel Modules for Virtualbox

Added to portage

2026-06-19

wayvnc - 0.10.0
Ebuild name:

gui-apps/wayvnc-0.10.0

Description

VNC server for wlroots based Wayland compositors

Added to portage

2026-06-19

weston - 15.0.91
Ebuild name:

dev-libs/weston-15.0.91

Description

Wayland reference compositor

Added to portage

2026-06-19

2026-06-18
acl - 9999
Ebuild name:

sys-apps/acl-9999

Description

Access control list utilities, libraries, and headers

Added to portage

2026-06-18

amarok - 3.3.3
Ebuild name:

media-sound/amarok-3.3.3

Description

Advanced audio player based on KDE Frameworks

Added to portage

2026-06-18

android-studio - 2026.1.1.10
Ebuild name:

dev-util/android-studio-2026.1.1.10

Description

Android development environment based on IntelliJ IDEA

Added to portage

2026-06-18

asymptote - 3.12-r1
Ebuild name:

media-gfx/asymptote-3.12-r1

Description

A vector graphics language that provides a framework for technical draw

Added to portage

2026-06-18

awscli - 1.45.32
Ebuild name:

app-admin/awscli-1.45.32

Description

Universal Command Line Environment for AWS

Added to portage

2026-06-18

bitarray - 3.8.2
Ebuild name:

dev-python/bitarray-3.8.2

Description

Efficient arrays of booleans -- C extension

Added to portage

2026-06-18

boto3 - 1.43.32
Ebuild name:

dev-python/boto3-1.43.32

Description

The AWS SDK for Python

Added to portage

2026-06-18

botocore - 1.43.32
Ebuild name:

dev-python/botocore-1.43.32

Description

Low-level, data-driven core of boto 3

Added to portage

2026-06-18

bpf-linker - 0.10.4
Ebuild name:

dev-util/bpf-linker-0.10.4

Description

Simple BPF static linker

Added to portage

2026-06-18

c-blosc2 - 3.1.4
Ebuild name:

dev-libs/c-blosc2-3.1.4

Description

Blocking, shuffling and lossless compression library

Added to portage

2026-06-18

chrome-binary-plugins - 149.0.7827.155
Ebuild name:

www-plugins/chrome-binary-plugins-149.0.7827.155

Description

Binary plugins from Google Chrome for use in Chrom

Added to portage

2026-06-18

chrome-binary-plugins - 150.0.7871.24_beta
Ebuild name:

www-plugins/chrome-binary-plugins-150.0.7871.24_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-06-18

chrome-binary-plugins - 151.0.7886.2_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-151.0.7886.2_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-06-18

chromedriver-bin - 149.0.7827.155
Ebuild name:

www-apps/chromedriver-bin-149.0.7827.155

Description

WebDriver for Chrome

Added to portage

2026-06-18

chromium - 149.0.7827.155
Ebuild name:

www-client/chromium-149.0.7827.155

Description

Open-source version of Google Chrome web browser

Added to portage

2026-06-18

cmake - 4.3.4
Ebuild name:

dev-build/cmake-4.3.4

Description

Cross platform Make

Added to portage

2026-06-18

dbeaver-bin - 26.1.0
Ebuild name:

dev-db/dbeaver-bin-26.1.0

Description

Free universal database tool (community edition)

Added to portage

2026-06-18

dovecot - 2.4.3-r2
Ebuild name:

net-mail/dovecot-2.4.3-r2

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-06-18

dovecot - 2.4.4-r1
Ebuild name:

net-mail/dovecot-2.4.4-r1

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-06-18

fakeredis - 2.36.2
Ebuild name:

dev-python/fakeredis-2.36.2

Description

Fake implementation of redis API for testing purposes

Added to portage

2026-06-18

freecell-solver - 6.16.0
Ebuild name:

dev-games/freecell-solver-6.16.0

Description

C library for automatically solving Freecell and some other solita

Added to portage

2026-06-18

gentoo-sources - 7.1.0
Ebuild name:

sys-kernel/gentoo-sources-7.1.0

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-06-18

geoclue - 2.8.1
Ebuild name:

app-misc/geoclue-2.8.1

Description

Location information D-Bus service

Added to portage

2026-06-18

gerbera - 3.2.1
Ebuild name:

net-misc/gerbera-3.2.1

Description

UPnP Media Server

Added to portage

2026-06-18

gfan - 0.8_beta1
Ebuild name:

sci-mathematics/gfan-0.8_beta1

Description

Compute Groebner fans and tropical varieties

Added to portage

2026-06-18

github-cli - 2.94.0
Ebuild name:

dev-util/github-cli-2.94.0

Description

GitHub CLI

Added to portage

2026-06-18

gnuradio - 3.11_pre20260615
Ebuild name:

net-wireless/gnuradio-3.11_pre20260615

Description

Toolkit that provides signal processing blocks to implement

Added to portage

2026-06-18

google-chrome - 149.0.7827.155
Ebuild name:

www-client/google-chrome-149.0.7827.155

Description

The web browser from Google

Added to portage

2026-06-18

google-chrome-beta - 150.0.7871.24
Ebuild name:

www-client/google-chrome-beta-150.0.7871.24

Description

The web browser from Google

Added to portage

2026-06-18

google-chrome-unstable - 151.0.7886.2
Ebuild name:

www-client/google-chrome-unstable-151.0.7886.2

Description

The web browser from Google

Added to portage

2026-06-18

gpxsee - 16.9
Ebuild name:

sci-geosciences/gpxsee-16.9

Description

Viewer and analyzer that supports gpx, tcx, kml, fit, igc and nmea file

Added to portage

2026-06-18

greenlet - 3.5.2
Ebuild name:

dev-python/greenlet-3.5.2

Description

Lightweight in-process concurrent programming

Added to portage

2026-06-18

jupyter-server - 2.20.0
Ebuild name:

dev-python/jupyter-server-2.20.0

Description

Core services, APIs, and REST endpoints to Jupyter web application

Added to portage

2026-06-18

jupyterlab - 4.5.9
Ebuild name:

dev-python/jupyterlab-4.5.9

Description

JupyterLab computational environment

Added to portage

2026-06-18

knot-resolver - 6.4.0
Ebuild name:

net-dns/knot-resolver-6.4.0

Description

Scaleable caching DNS resolver

Added to portage

2026-06-18

libabw - 0.1.4
Ebuild name:

app-text/libabw-0.1.4

Description

Library parsing abiword documents

Added to portage

2026-06-18

libcdr - 0.1.9
Ebuild name:

media-libs/libcdr-0.1.9

Description

Library parsing the Corel cdr documents

Added to portage

2026-06-18

libcdr - 9999
Ebuild name:

media-libs/libcdr-9999

Description

Library parsing the Corel cdr documents

Added to portage

2026-06-18

libcmis - 0.6.3
Ebuild name:

dev-cpp/libcmis-0.6.3

Description

C++ client library for the CMIS interface

Added to portage

2026-06-18

libexttextcat - 3.4.8-r1
Ebuild name:

app-text/libexttextcat-3.4.8-r1

Description

Library implementing N-gram-based text categorization

Added to portage

2026-06-18

libfreehand - 0.1.3
Ebuild name:

media-libs/libfreehand-0.1.3

Description

Library for import of FreeHand drawings

Added to portage

2026-06-18

libfreehand - 9999
Ebuild name:

media-libs/libfreehand-9999

Description

Library for import of FreeHand drawings

Added to portage

2026-06-18

libmspub - 0.1.5
Ebuild name:

app-text/libmspub-0.1.5

Description

Library parsing Microsoft Publisher documents

Added to portage

2026-06-18

libmspub - 9999
Ebuild name:

app-text/libmspub-9999

Description

Library parsing Microsoft Publisher documents

Added to portage

2026-06-18

libqxp - 0.0.3
Ebuild name:

app-text/libqxp-0.0.3

Description

Library parsing QuarkXpress documents

Added to portage

2026-06-18

libvisio - 0.1.11
Ebuild name:

media-libs/libvisio-0.1.11

Description

Library parsing the file format of MS Visio documents

Added to portage

2026-06-18

libvisio - 9999
Ebuild name:

media-libs/libvisio-9999

Description

Library parsing the file format of MS Visio documents

Added to portage

2026-06-18

libwacom - 2.19.0
Ebuild name:

dev-libs/libwacom-2.19.0

Description

Library for identifying Wacom tablets and their model-specific features

Added to portage

2026-06-18

lighttpd - 1.4.84
Ebuild name:

www-servers/lighttpd-1.4.84

Description

Lightweight high-performance web server

Added to portage

2026-06-18

magit-popup - 2.13.3-r1
Ebuild name:

app-emacs/magit-popup-2.13.3-r1

Description

Define prefix-infix-suffix command combos

Added to portage

2026-06-18

mailcrypt - 3.5.9-r3
Ebuild name:

app-emacs/mailcrypt-3.5.9-r3

Description

Provides a simple interface to public key cryptography with OpenPGP

Added to portage

2026-06-18

makemkv - 1.18.4
Ebuild name:

media-video/makemkv-1.18.4

Description

Tool for ripping and streaming Blu-ray, HD-DVD and DVD discs

Added to portage

2026-06-18

marginalia - 2.10
Ebuild name:

app-emacs/marginalia-2.10

Description

Marginalia in the minibuffer

Added to portage

2026-06-18

mcrypt - 2.6.8-r3
Ebuild name:

app-crypt/mcrypt-2.6.8-r3

Description

Replacement of the old unix crypt(1)

Added to portage

2026-06-18

md5deep - 4.4
Ebuild name:

app-crypt/md5deep-4.4

Description

Expanded md5sum program with recursive and comparison options

Added to portage

2026-06-18

md6sum - 1.0-r3
Ebuild name:

app-crypt/md6sum-1.0-r3

Description

A C implementation of MD6

Added to portage

2026-06-18

mhash - 0.9.9.9-r4
Ebuild name:

app-crypt/mhash-0.9.9.9-r4

Description

Library providing a uniform interface to a large number of hash algorith

Added to portage

2026-06-18

microsoft-edge - 149.0.4022.69
Ebuild name:

www-client/microsoft-edge-149.0.4022.69

Description

The web browser from Microsoft

Added to portage

2026-06-18

microsoft-edge-beta - 150.0.4078.13
Ebuild name:

www-client/microsoft-edge-beta-150.0.4078.13

Description

The web browser from Microsoft

Added to portage

2026-06-18

microsoft-edge-dev - 151.0.4091.0
Ebuild name:

www-client/microsoft-edge-dev-151.0.4091.0

Description

The web browser from Microsoft

Added to portage

2026-06-18

minizip-ng - 4.2.1
Ebuild name:

sys-libs/minizip-ng-4.2.1

Description

Fork of the popular zip manipulation library found in the zlib distributi

Added to portage

2026-06-18

mongodb-compass-bin - 1.49.8
Ebuild name:

dev-db/mongodb-compass-bin-1.49.8

Description

GUI for MongoDB

Added to portage

2026-06-18

mythes - 1.2.6
Ebuild name:

app-text/mythes-1.2.6

Description

Simple thesaurus for LibreOffice

Added to portage

2026-06-18

nextcloud - 32.0.11
Ebuild name:

www-apps/nextcloud-32.0.11

Description

Personal cloud that runs on your own server

Added to portage

2026-06-18

nvidia-drivers - 595.84
Ebuild name:

x11-drivers/nvidia-drivers-595.84

Description

NVIDIA Accelerated Graphics Driver

Added to portage

2026-06-18

openstacksdk - 4.16.0
Ebuild name:

dev-python/openstacksdk-4.16.0

Description

A collection of libraries for building applications to work with Ope

Added to portage

2026-06-18

opera - 132.0.5905.73
Ebuild name:

www-client/opera-132.0.5905.73

Description

A fast and secure web browser

Added to portage

2026-06-18

opera-developer - 133.0.5931.0
Ebuild name:

www-client/opera-developer-133.0.5931.0

Description

A fast and secure web browser

Added to portage

2026-06-18

pecl-uuid - 1.3.0
Ebuild name:

dev-php/pecl-uuid-1.3.0

Description

A wrapper around libuuid

Added to portage

2026-06-18

postfix - 3.11.4
Ebuild name:

mail-mta/postfix-3.11.4

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-06-18

postfix - 3.12_pre20260615
Ebuild name:

mail-mta/postfix-3.12_pre20260615

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-06-18

ppsspp - 1.20.4-r1
Ebuild name:

games-emulation/ppsspp-1.20.4-r1

Description

A PSP emulator written in C++

Added to portage

2026-06-18

pypdf - 6.13.3
Ebuild name:

dev-python/pypdf-6.13.3

Description

Python library to work with PDF files

Added to portage

2026-06-18

pyproject-fmt - 2.25.0
Ebuild name:

dev-python/pyproject-fmt-2.25.0

Description

Format your pyproject.toml file

Added to portage

2026-06-18

stgit - 2.6.0
Ebuild name:

dev-vcs/stgit-2.6.0

Description

Stack-based patch management for Git

Added to portage

2026-06-18

svglib - 2.0.1
Ebuild name:

dev-python/svglib-2.0.1

Description

Pure-Python library for reading and converting SVG

Added to portage

2026-06-18

terraform - 1.15.6
Ebuild name:

app-admin/terraform-1.15.6

Description

A tool for building, changing, and combining infrastructure safely

Added to portage

2026-06-18

tqdm - 4.68.3
Ebuild name:

dev-python/tqdm-4.68.3

Description

Add a progress meter to your loops in a second

Added to portage

2026-06-18

vivaldi - 8.0.4033.48
Ebuild name:

www-client/vivaldi-8.0.4033.48

Description

A browser for our friends

Added to portage

2026-06-18

vivaldi - 8.0.4033.50
Ebuild name:

www-client/vivaldi-8.0.4033.50

Description

A browser for our friends

Added to portage

2026-06-18

vivaldi-snapshot - 8.1.4070.3
Ebuild name:

www-client/vivaldi-snapshot-8.1.4070.3

Description

A browser for our friends

Added to portage

2026-06-18

vivaldi-snapshot - 8.1.4076.4
Ebuild name:

www-client/vivaldi-snapshot-8.1.4076.4

Description

A browser for our friends

Added to portage

2026-06-18

wine-mono - 11.2.0
Ebuild name:

app-emulation/wine-mono-11.2.0

Description

Replacement for the .NET runtime and class libraries in Wine

Added to portage

2026-06-18

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