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:

83419

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-02-23
astroid - 4.1.1
Ebuild name:

dev-python/astroid-4.1.1

Description

Abstract Syntax Tree for logilab packages

Added to portage

2026-02-23

b2sdk - 2.10.3
Ebuild name:

dev-python/b2sdk-2.10.3

Description

Library to access Backblaze B2 cloud storage

Added to portage

2026-02-23

caffe2 - 2.10.0-r3
Ebuild name:

sci-ml/caffe2-2.10.0-r3

Description

A deep learning framework

Added to portage

2026-02-23

calamares - 3.3.14-r7
Ebuild name:

app-admin/calamares-3.3.14-r7

Description

Distribution-independent installer framework

Added to portage

2026-02-23

calamares-gentoo-livecd - 3.3.14_p20260210
Ebuild name:

app-misc/calamares-gentoo-livecd-3.3.14_p20260210

Description

Gentoo Linux Calamares installer configuration fo

Added to portage

2026-02-23

camlp4 - 5.4_p1
Ebuild name:

dev-ml/camlp4-5.4_p1

Description

System for writing extensible parsers for programming languages

Added to portage

2026-02-23

chardet - 6.0.0_p1
Ebuild name:

dev-python/chardet-6.0.0_p1

Description

Universal encoding detector

Added to portage

2026-02-23

chkrootkit - 0.59
Ebuild name:

app-forensics/chkrootkit-0.59

Description

Tool to locally check for signs of a rootkit

Added to portage

2026-02-23

cups - 2.4.16
Ebuild name:

net-print/cups-2.4.16

Description

The Common Unix Printing System

Added to portage

2026-02-23

cups-filters - 2.0.1-r1
Ebuild name:

net-print/cups-filters-2.0.1-r1

Description

Cups filters

Added to portage

2026-02-23

cups-pdf - 3.0.2
Ebuild name:

net-print/cups-pdf-3.0.2

Description

Provides a virtual printer for CUPS to produce PDF files

Added to portage

2026-02-23

galaxis - 1.13
Ebuild name:

games-puzzle/galaxis-1.13

Description

Curses-based clone of the nifty little Macintosh freeware game Galaxis

Added to portage

2026-02-23

gcc - 16.0.1_p20260222
Ebuild name:

sys-devel/gcc-16.0.1_p20260222

Description

The GNU Compiler Collection

Added to portage

2026-02-23

git-sources - 7.0_rc1
Ebuild name:

sys-kernel/git-sources-7.0_rc1

Description

The very latest -git version of the Linux kernel

Added to portage

2026-02-23

intellij-idea - 2025.3.3
Ebuild name:

dev-util/intellij-idea-2025.3.3

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-02-23

libcupsfilters - 2.1.1-r1
Ebuild name:

net-print/libcupsfilters-2.1.1-r1

Description

library for developing printing features, split out of cups-filte

Added to portage

2026-02-23

mdadm - 4.5
Ebuild name:

sys-fs/mdadm-4.5

Description

Tool for running RAID systems - replacement for the raidtools

Added to portage

2026-02-23

minicom - 2.11
Ebuild name:

net-dialup/minicom-2.11

Description

Serial Communication Program

Added to portage

2026-02-23

mstflint - 4.30.0_p1-r1
Ebuild name:

sys-fabric/mstflint-4.30.0_p1-r1

Description

Mstflint - an open source version of MFT (Mellanox Firmware Tools)

Added to portage

2026-02-23

ophcrack-tables - 1.0-r2
Ebuild name:

app-crypt/ophcrack-tables-1.0-r2

Description

Tables available for ophcrack

Added to portage

2026-02-23

plasma-meta - 6.6.0-r1
Ebuild name:

kde-plasma/plasma-meta-6.6.0-r1

Description

Merge this to pull in all Plasma 6 packages

Added to portage

2026-02-23

platformio - 6.1.19
Ebuild name:

dev-embedded/platformio-6.1.19

Description

An open source ecosystem for IoT development

Added to portage

2026-02-23

postfix - 3.10.8
Ebuild name:

mail-mta/postfix-3.10.8

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-02-23

postfix - 3.12_pre20260218
Ebuild name:

mail-mta/postfix-3.12_pre20260218

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-02-23

pyfakefs - 6.1.2
Ebuild name:

dev-python/pyfakefs-6.1.2

Description

A fake file system that mocks the Python file system modules

Added to portage

2026-02-23

pypdf - 6.7.2
Ebuild name:

dev-python/pypdf-6.7.2

Description

Python library to work with PDF files

Added to portage

2026-02-23

rq - 2.7.0
Ebuild name:

dev-python/rq-2.7.0

Description

Simple, lightweight library for creating and processing background jobs

Added to portage

2026-02-23

scipy - 1.17.1
Ebuild name:

dev-python/scipy-1.17.1

Description

Scientific algorithms library for Python

Added to portage

2026-02-23

tuxedo-control-center-bin - 2.1.23
Ebuild name:

app-laptop/tuxedo-control-center-bin-2.1.23

Description

Tool to control performance, energy, fan and comfort se

Added to portage

2026-02-23

virtualbox - 7.1.16-r1
Ebuild name:

app-emulation/virtualbox-7.1.16-r1

Description

Family of powerful x86 virtualization products for enterprise an

Added to portage

2026-02-23

virtualbox - 7.2.6-r1
Ebuild name:

app-emulation/virtualbox-7.2.6-r1

Description

Family of powerful x86 virtualization products for enterprise and

Added to portage

2026-02-23

virtualbox-kvm - 7.1.16_pre20251103-r1
Ebuild name:

app-emulation/virtualbox-kvm-7.1.16_pre20251103-r1

Description

Family of powerful x86 virtualization products f

Added to portage

2026-02-23

virtualbox-kvm - 7.2.6_pre20260201-r1
Ebuild name:

app-emulation/virtualbox-kvm-7.2.6_pre20260201-r1

Description

Family of powerful x86 virtualization products fo

Added to portage

2026-02-23

zxing-cpp - 3.0.2
Ebuild name:

media-libs/zxing-cpp-3.0.2

Description

C++ Multi-format 1D/2D barcode image processing library

Added to portage

2026-02-23

2026-02-22
bluez - 5.86
Ebuild name:

net-wireless/bluez-5.86

Description

Bluetooth Tools and System Daemons for Linux

Added to portage

2026-02-22

bomberclone - 0.11.9-r1
Ebuild name:

games-action/bomberclone-0.11.9-r1

Description

Bomberman clone with network game support

Added to portage

2026-02-22

chromium - 147.0.7695.0
Ebuild name:

www-client/chromium-147.0.7695.0

Description

Open-source version of Google Chrome web browser

Added to portage

2026-02-22

cmd2 - 3.2.2
Ebuild name:

dev-python/cmd2-3.2.2

Description

Extra features for standard library's cmd module

Added to portage

2026-02-22

darktable - 5.4.1
Ebuild name:

media-gfx/darktable-5.4.1

Description

A virtual lighttable and darkroom for photographers

Added to portage

2026-02-22

dcraw - 9.28.0-r5
Ebuild name:

media-gfx/dcraw-9.28.0-r5

Description

Command-line decoder for raw digital photos

Added to portage

2026-02-22

ffmpeg-chromium - 147
Ebuild name:

media-video/ffmpeg-chromium-147

Description

FFmpeg built specifically for codec support in Chromium-based brows

Added to portage

2026-02-22

gawk - 5.4.0
Ebuild name:

sys-apps/gawk-5.4.0

Description

GNU awk pattern-matching language

Added to portage

2026-02-22

gcc - 15.2.1_p20260221
Ebuild name:

sys-devel/gcc-15.2.1_p20260221

Description

The GNU Compiler Collection

Added to portage

2026-02-22

gnome-online-accounts - 3.54.10
Ebuild name:

net-libs/gnome-online-accounts-3.54.10

Description

GNOME framework for accessing online accounts

Added to portage

2026-02-22

gnome-online-accounts - 3.56.4
Ebuild name:

net-libs/gnome-online-accounts-3.56.4

Description

GNOME framework for accessing online accounts

Added to portage

2026-02-22

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

gnome-extra/gnome-shell-extension-appindicator-63

Description

Support legacy, AppIndicators and KStatusNotifier

Added to portage

2026-02-22

grilo-plugins - 0.3.18-r1
Ebuild name:

media-plugins/grilo-plugins-0.3.18-r1

Description

A collection of plugins for the Grilo framework

Added to portage

2026-02-22

gutenprint - 5.3.5
Ebuild name:

net-print/gutenprint-5.3.5

Description

Ghostscript and cups printer drivers

Added to portage

2026-02-22

hotspot - 1.5.1_p20250907-r1
Ebuild name:

dev-debug/hotspot-1.5.1_p20250907-r1

Description

Linux perf GUI for performance analysis

Added to portage

2026-02-22

inline-snapshot - 0.32.2
Ebuild name:

dev-python/inline-snapshot-0.32.2

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-02-22

ja2-stracciatella - 0.22.1
Ebuild name:

games-strategy/ja2-stracciatella-0.22.1

Description

An improved, cross-platform, stable Jagged Alliance 2 runti

Added to portage

2026-02-22

jupyter - 1.1.1-r1
Ebuild name:

dev-python/jupyter-1.1.1-r1

Description

Jupyter metapackage. Install all the Jupyter components in one go

Added to portage

2026-02-22

jupyterlab - 4.4.10-r1
Ebuild name:

dev-python/jupyterlab-4.4.10-r1

Description

JupyterLab computational environment

Added to portage

2026-02-22

kmymoney - 5.2.2
Ebuild name:

app-office/kmymoney-5.2.2

Description

Personal finance manager based on KDE Frameworks

Added to portage

2026-02-22

ktorrent - 25.12.2-r2
Ebuild name:

net-p2p/ktorrent-25.12.2-r2

Description

Powerful BitTorrent client based on KDE Frameworks

Added to portage

2026-02-22

libsmacker - 1.2.0_p43-r1
Ebuild name:

dev-games/libsmacker-1.2.0_p43-r1

Description

A cross-platform C library for decoding .smk Smacker Video files.

Added to portage

2026-02-22

lttng-modules - 2.13.23
Ebuild name:

dev-util/lttng-modules-2.13.23

Description

LTTng Kernel Tracer Modules

Added to portage

2026-02-22

lttng-modules - 2.14.4
Ebuild name:

dev-util/lttng-modules-2.14.4

Description

LTTng Kernel Tracer Modules

Added to portage

2026-02-22

lttng-tools - 2.14.1
Ebuild name:

dev-util/lttng-tools-2.14.1

Description

Linux Trace Toolkit - next generation

Added to portage

2026-02-22

lttng-ust - 2.13.10
Ebuild name:

dev-util/lttng-ust-2.13.10

Description

Linux Trace Toolkit - UST library

Added to portage

2026-02-22

lttng-ust - 2.14.1
Ebuild name:

dev-util/lttng-ust-2.14.1

Description

Linux Trace Toolkit - UST library

Added to portage

2026-02-22

lvm2 - 9999
Ebuild name:

sys-fs/lvm2-9999

Description

User-land utilities for LVM2 (device-mapper) software

Added to portage

2026-02-22

mycli - 1.55.0
Ebuild name:

dev-db/mycli-1.55.0

Description

CLI for MySQL Database with auto-completion and syntax highlighting

Added to portage

2026-02-22

mysql-connector-c++ - 9.6.0
Ebuild name:

dev-db/mysql-connector-c++-9.6.0

Description

MySQL database connector for C++ (mimics JDBC 4.0 API)

Added to portage

2026-02-22

notebook - 7.4.7-r1
Ebuild name:

dev-python/notebook-7.4.7-r1

Description

Jupyter Interactive Notebook

Added to portage

2026-02-22

pyatspi - 2.58.1
Ebuild name:

dev-python/pyatspi-2.58.1

Description

Python client bindings for D-Bus AT-SPI

Added to portage

2026-02-22

pyls-spyder - 0.4.0-r4
Ebuild name:

dev-python/pyls-spyder-0.4.0-r4

Description

Spyder extensions for the python language server

Added to portage

2026-02-22

python-box - 7.4.1
Ebuild name:

dev-python/python-box-7.4.1

Description

Python dictionaries with advanced dot notation access

Added to portage

2026-02-22

python-lsp-black - 2.0.0-r2
Ebuild name:

dev-python/python-lsp-black-2.0.0-r2

Description

Black plugin for the Python LSP Server

Added to portage

2026-02-22

r8168 - 8.056.02
Ebuild name:

net-misc/r8168-8.056.02

Description

r8168 driver for Realtek 8111/8168 PCI-E NICs

Added to portage

2026-02-22

tables - 3.11.0
Ebuild name:

dev-python/tables-3.11.0

Description

Hierarchical datasets for Python

Added to portage

2026-02-22

typer - 0.24.1
Ebuild name:

dev-python/typer-0.24.1

Description

Build great CLIs. Easy to code. Based on Python type hints

Added to portage

2026-02-22

uutils-coreutils - 0.6.0
Ebuild name:

sys-apps/uutils-coreutils-0.6.0

Description

GNU coreutils rewritten in Rust

Added to portage

2026-02-22

vivaldi - 7.8.3925.73
Ebuild name:

www-client/vivaldi-7.8.3925.73

Description

A browser for our friends

Added to portage

2026-02-22

weston - 15.0.0
Ebuild name:

dev-libs/weston-15.0.0

Description

Wayland reference compositor

Added to portage

2026-02-22

widelands - 1.3.1
Ebuild name:

games-strategy/widelands-1.3.1

Description

Game similar to Settlers 2

Added to portage

2026-02-22

xdp-tools - 1.6.2
Ebuild name:

net-libs/xdp-tools-1.6.2

Description

The libxdp library and various tools for use with XDP

Added to portage

2026-02-22

xfce4-whiskermenu-plugin - 2.10.1
Ebuild name:

xfce-extra/xfce4-whiskermenu-plugin-2.10.1

Description

Alternate application launcher for Xfce

Added to portage

2026-02-22

xmltodict - 1.0.4
Ebuild name:

dev-python/xmltodict-1.0.4

Description

Makes working with XML feel like you are working with JSON

Added to portage

2026-02-22

yt-dlp - 2026.02.21
Ebuild name:

net-misc/yt-dlp-2026.02.21

Description

youtube-dl fork with additional features and fixes

Added to portage

2026-02-22

yt-dlp-ejs - 0.5.0
Ebuild name:

dev-python/yt-dlp-ejs-0.5.0

Description

External JavaScript for yt-dlp supporting many runtimes

Added to portage

2026-02-22

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