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:

82919

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-01-23
akonadi - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-25.12.1-r1

Description

Storage service for PIM data and libraries for PIM apps

Added to portage

2026-01-23

akonadi-calendar - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-calendar-25.12.1-r1

Description

Library for akonadi calendar integration

Added to portage

2026-01-23

akonadi-calendar-tools-common - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-calendar-tools-common-25.12.1-r1

Description

Added to portage

2026-01-23

akonadi-contacts - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-contacts-25.12.1-r1

Description

Library for akonadi contact integration

Added to portage

2026-01-23

akonadi-import-wizard - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-import-wizard-25.12.1-r1

Description

Assistant to import PIM data from other applications into

Added to portage

2026-01-23

akonadi-mime - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-mime-25.12.1-r1

Description

Library for akonadi mime types

Added to portage

2026-01-23

akonadi-search - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-search-25.12.1-r1

Description

Libraries and daemons to implement searching in Akonadi

Added to portage

2026-01-23

akonadiconsole - 25.12.1-r1
Ebuild name:

kde-apps/akonadiconsole-25.12.1-r1

Description

Application for debugging Akonadi Resources

Added to portage

2026-01-23

akregator - 25.12.1-r1
Ebuild name:

kde-apps/akregator-25.12.1-r1

Description

News feed aggregator

Added to portage

2026-01-23

bazelisk - 1.28.1
Ebuild name:

dev-build/bazelisk-1.28.1

Description

A user-friendly launcher for Bazel written in Go

Added to portage

2026-01-23

blueprint-compiler - 0.19.0
Ebuild name:

dev-util/blueprint-compiler-0.19.0

Description

Compiler for Blueprint, a markup language for GTK user interface

Added to portage

2026-01-23

calendarjanitor - 25.12.1-r1
Ebuild name:

kde-apps/calendarjanitor-25.12.1-r1

Description

Tool to scan calendar data for buggy instances

Added to portage

2026-01-23

calendarsupport - 25.12.1-r1
Ebuild name:

kde-apps/calendarsupport-25.12.1-r1

Description

Calendar support library

Added to portage

2026-01-23

closure-compiler-bin - 20260120
Ebuild name:

dev-lang/closure-compiler-bin-20260120

Description

JavaScript optimizing compiler

Added to portage

2026-01-23

devcontainer - 0.81.1
Ebuild name:

app-containers/devcontainer-0.81.1

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-01-23

ensurepip-setuptools - 80.10.1
Ebuild name:

dev-python/ensurepip-setuptools-80.10.1

Description

Shared setuptools wheel for ensurepip Python module

Added to portage

2026-01-23

eventviews - 25.12.1-r1
Ebuild name:

kde-apps/eventviews-25.12.1-r1

Description

Calendar viewer for KDE PIM

Added to portage

2026-01-23

fastfetch - 2.58.0
Ebuild name:

app-misc/fastfetch-2.58.0

Description

Fast neofetch-like system information tool

Added to portage

2026-01-23

git-cliff - 2.11.0
Ebuild name:

dev-vcs/git-cliff-2.11.0

Description

A highly customizable changelog generator

Added to portage

2026-01-23

grantlee-editor - 25.12.1-r1
Ebuild name:

kde-apps/grantlee-editor-25.12.1-r1

Description

Utilities and tools to manage themes in KDE PIM applications

Added to portage

2026-01-23

grantleetheme - 25.12.1-r1
Ebuild name:

kde-apps/grantleetheme-25.12.1-r1

Description

Library for Grantlee plugins

Added to portage

2026-01-23

incidenceeditor - 25.12.1-r1
Ebuild name:

kde-apps/incidenceeditor-25.12.1-r1

Description

Incidence editor for KOrganizer

Added to portage

2026-01-23

joplin-desktop - 3.5.12
Ebuild name:

app-office/joplin-desktop-3.5.12

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2026-01-23

kaddressbook - 25.12.1-r1
Ebuild name:

kde-apps/kaddressbook-25.12.1-r1

Description

Address book application based on KDE Frameworks

Added to portage

2026-01-23

kalarm - 25.12.1-r1
Ebuild name:

kde-apps/kalarm-25.12.1-r1

Description

Application to manage alarms and other timer based alerts for the deskto

Added to portage

2026-01-23

kate - 25.12.1-r1
Ebuild name:

kde-apps/kate-25.12.1-r1

Description

Multi-document editor with network transparency, Plasma integration and mo

Added to portage

2026-01-23

kate-addons - 25.12.1-r1
Ebuild name:

kde-apps/kate-addons-25.12.1-r1

Description

Addons used by Kate

Added to portage

2026-01-23

kate-lib - 25.12.1-r1
Ebuild name:

kde-apps/kate-lib-25.12.1-r1

Description

Shared library used by Kate/Kwrite and Kate-Addons

Added to portage

2026-01-23

kcalutils - 25.12.1-r1
Ebuild name:

kde-apps/kcalutils-25.12.1-r1

Description

Library providing utility functions for the handling of calendar data

Added to portage

2026-01-23

kdepim-addons - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-addons-25.12.1-r1

Description

Plugins for KDE Personal Information Management Suite

Added to portage

2026-01-23

kdepim-meta - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-meta-25.12.1-r1

Description

KDE PIM - merge this to pull in all kdepim-derived packages

Added to portage

2026-01-23

kdepim-runtime - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-runtime-25.12.1-r1

Description

Runtime plugin collection to extend the functionality of KDE PIM

Added to portage

2026-01-23

kdf - 25.12.1-r1
Ebuild name:

kde-apps/kdf-25.12.1-r1

Description

KDE free disk space utility

Added to portage

2026-01-23

keditbookmarks - 25.12.1-r1
Ebuild name:

kde-apps/keditbookmarks-25.12.1-r1

Description

Bookmarks editor based on KDE Frameworks

Added to portage

2026-01-23

kopeninghours - 25.12.1-r1
Ebuild name:

dev-libs/kopeninghours-25.12.1-r1

Description

Library for parsing and evaluating OSM opening hours expressions

Added to portage

2026-01-23

kosmindoormap - 25.12.1-r1
Ebuild name:

dev-libs/kosmindoormap-25.12.1-r1

Description

Data Model and Extraction System for Travel Reservation informati

Added to portage

2026-01-23

kpublictransport - 25.12.1-r1
Ebuild name:

dev-libs/kpublictransport-25.12.1-r1

Description

Library for accessing public transport timetables and other in

Added to portage

2026-01-23

libtsm - 4.4.1
Ebuild name:

dev-libs/libtsm-4.4.1

Description

Terminal Emulator State Machine

Added to portage

2026-01-23

merkuro - 25.12.1-r1
Ebuild name:

app-office/merkuro-25.12.1-r1

Description

Calendar application using Akonadi

Added to portage

2026-01-23

open-vmdk - 0.3.13
Ebuild name:

app-emulation/open-vmdk-0.3.13

Description

Tools for creating and converting OVA virtual appliance files

Added to portage

2026-01-23

osm - 9999
Ebuild name:

app-emacs/osm-9999

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2026-01-23

outline-magic - 0.9
Ebuild name:

app-emacs/outline-magic-0.9

Description

Outline mode extensions for Emacs

Added to portage

2026-01-23

package-build - 4.0.0
Ebuild name:

app-emacs/package-build-4.0.0

Description

Tools for assembling a package archive

Added to portage

2026-01-23

package-lint - 0.26
Ebuild name:

app-emacs/package-lint-0.26

Description

Linting library for Emacs Lisp package metadata

Added to portage

2026-01-23

reason - 3.17.3
Ebuild name:

dev-ml/reason-3.17.3

Description

Simple, fast & type safe language that leverages JavaScript and OCaml

Added to portage

2026-01-23

rpi-eeprom - 28.12_p1
Ebuild name:

dev-embedded/rpi-eeprom-28.12_p1

Description

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

Added to portage

2026-01-23

setuptools - 80.10.1
Ebuild name:

dev-python/setuptools-80.10.1

Description

Collection of extensions to Distutils

Added to portage

2026-01-23

tempel - 1.10
Ebuild name:

app-emacs/tempel-1.10

Description

Templates with in-buffer field editing for GNU Emacs

Added to portage

2026-01-23

vertico - 2.7
Ebuild name:

app-emacs/vertico-2.7

Description

Vertical interactive completion

Added to portage

2026-01-23

xxhash - 0.8.3-r2
Ebuild name:

dev-libs/xxhash-0.8.3-r2

Description

Extremely fast non-cryptographic hash algorithm

Added to portage

2026-01-23

2026-01-22
awscli - 1.44.22
Ebuild name:

app-admin/awscli-1.44.22

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-22

boto3 - 1.42.32
Ebuild name:

dev-python/boto3-1.42.32

Description

The AWS SDK for Python

Added to portage

2026-01-22

botocore - 1.42.32
Ebuild name:

dev-python/botocore-1.42.32

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-22

cargo-nextest - 0.9.122
Ebuild name:

dev-util/cargo-nextest-0.9.122

Description

Next-generation test runner for Rust

Added to portage

2026-01-22

cargo-tarpaulin - 0.35.1
Ebuild name:

dev-util/cargo-tarpaulin-0.35.1

Description

Cargo-Tarpaulin is a tool to determine code coverage achieved via t

Added to portage

2026-01-22

cfn-lint - 1.43.4
Ebuild name:

dev-python/cfn-lint-1.43.4

Description

CloudFormation Linter

Added to portage

2026-01-22

cmocka - 2.0.2
Ebuild name:

dev-util/cmocka-2.0.2

Description

Unit testing framework for C

Added to portage

2026-01-22

dbeaver-bin - 25.3.3
Ebuild name:

dev-db/dbeaver-bin-25.3.3

Description

Free universal database tool (community edition)

Added to portage

2026-01-22

eggdrop - 1.10.1
Ebuild name:

net-irc/eggdrop-1.10.1

Description

An IRC bot extensible with C or TCL

Added to portage

2026-01-22

ensurepip-wheel - 0.46.2
Ebuild name:

dev-python/ensurepip-wheel-0.46.2

Description

Shared wheel wheel for use in pip tests

Added to portage

2026-01-22

gherkin-official - 38.0.0
Ebuild name:

dev-python/gherkin-official-38.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-01-22

krita - 6.0.0_alpha_pre20260121
Ebuild name:

media-gfx/krita-6.0.0_alpha_pre20260121

Description

Free digital painting application. Digital Painting, Creati

Added to portage

2026-01-22

marknote - 1.4.0
Ebuild name:

app-text/marknote-1.4.0

Description

Markdown editor with a wide range of formating options for everyday notes

Added to portage

2026-01-22

mongodb-compass-bin - 1.49.0
Ebuild name:

dev-db/mongodb-compass-bin-1.49.0

Description

GUI for MongoDB

Added to portage

2026-01-22

oath-toolkit - 2.6.13
Ebuild name:

sys-auth/oath-toolkit-2.6.13

Description

Toolkit for using one-time password authentication with HOTP/TOTP algo

Added to portage

2026-01-22

openpgp-keys-libseccomp - 20260122
Ebuild name:

sec-keys/openpgp-keys-libseccomp-20260122

Description

OpenPGP key used for sys-libs/libseccomp

Added to portage

2026-01-22

openpgp-keys-oath-toolkit - 20260122
Ebuild name:

sec-keys/openpgp-keys-oath-toolkit-20260122

Description

OpenPGP keys used for sys-auth/oath-toolkit

Added to portage

2026-01-22

packaging - 26.0
Ebuild name:

dev-python/packaging-26.0

Description

Core utilities for Python packages

Added to portage

2026-01-22

pandoc-mode - 2.35
Ebuild name:

app-emacs/pandoc-mode-2.35

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2026-01-22

pandoc-mode - 2.90.2
Ebuild name:

app-emacs/pandoc-mode-2.90.2

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2026-01-22

pass-otp - 1.2.0-r3
Ebuild name:

app-admin/pass-otp-1.2.0-r3

Description

A pass extension for managing one-time-password (OTP) tokens

Added to portage

2026-01-22

pcl - 1.14.1-r3
Ebuild name:

sci-libs/pcl-1.14.1-r3

Description

2D/3D image and point cloud processing

Added to portage

2026-01-22

pycparser - 3.0
Ebuild name:

dev-python/pycparser-3.0

Description

C parser and AST generator written in Python

Added to portage

2026-01-22

skrooge - 26.1.20
Ebuild name:

app-office/skrooge-26.1.20

Description

Personal finances manager, aiming at being simple and intuitive

Added to portage

2026-01-22

sqlalchemy - 2.0.46
Ebuild name:

dev-python/sqlalchemy-2.0.46

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-01-22

upterm - 0.22.0
Ebuild name:

app-misc/upterm-0.22.0

Description

Instant Terminal Sharing

Added to portage

2026-01-22

wheel - 0.46.2
Ebuild name:

dev-python/wheel-0.46.2

Description

A built-package format for Python

Added to portage

2026-01-22

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