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:

82182

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
rate this article:
current rating: average rating: 1.3 (71 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2025-11-28
clang - 22.0.0_pre20251127
Ebuild name:

dev-python/clang-22.0.0_pre20251127

Description

Python bindings for llvm-core/clang

Added to portage

2025-11-28

clang - 22.0.0_pre20251127
Ebuild name:

llvm-core/clang-22.0.0_pre20251127

Description

C language family frontend for LLVM

Added to portage

2025-11-28

clang-common - 22.0.0_pre20251127
Ebuild name:

llvm-core/clang-common-22.0.0_pre20251127

Description

Common files shared between multiple slots of clang

Added to portage

2025-11-28

compiler-rt - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/compiler-rt-22.0.0_pre20251127

Description

Compiler runtime library for clang (built-in part)

Added to portage

2025-11-28

compiler-rt-sanitizers - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-22.0.0_pre20251127

Description

Compiler runtime libraries for clang (sanit

Added to portage

2025-11-28

flang - 22.0.0_pre20251127
Ebuild name:

llvm-core/flang-22.0.0_pre20251127

Description

LLVM's Fortran frontend

Added to portage

2025-11-28

flang-rt - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/flang-rt-22.0.0_pre20251127

Description

LLVM's Fortran runtime

Added to portage

2025-11-28

libclc - 22.0.0_pre20251127
Ebuild name:

llvm-core/libclc-22.0.0_pre20251127

Description

OpenCL C library

Added to portage

2025-11-28

libcxx - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libcxx-22.0.0_pre20251127

Description

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

Added to portage

2025-11-28

libcxxabi - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libcxxabi-22.0.0_pre20251127

Description

Low level support for a standard C++ library

Added to portage

2025-11-28

libgcc - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libgcc-22.0.0_pre20251127

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2025-11-28

libunwind - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libunwind-22.0.0_pre20251127

Description

C++ runtime stack unwinder from LLVM

Added to portage

2025-11-28

lit - 22.0.0_pre20251127
Ebuild name:

dev-python/lit-22.0.0_pre20251127

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2025-11-28

lld - 22.0.0_pre20251127
Ebuild name:

llvm-core/lld-22.0.0_pre20251127

Description

The LLVM linker (link editor)

Added to portage

2025-11-28

lldb - 22.0.0_pre20251127
Ebuild name:

llvm-core/lldb-22.0.0_pre20251127

Description

The LLVM debugger

Added to portage

2025-11-28

llvm - 22.0.0_pre20251127
Ebuild name:

dev-ml/llvm-22.0.0_pre20251127

Description

OCaml bindings for LLVM

Added to portage

2025-11-28

llvm - 22.0.0_pre20251127
Ebuild name:

llvm-core/llvm-22.0.0_pre20251127

Description

Low Level Virtual Machine

Added to portage

2025-11-28

llvm-common - 22.0.0_pre20251127
Ebuild name:

llvm-core/llvm-common-22.0.0_pre20251127

Description

Common files shared between multiple slots of LLVM

Added to portage

2025-11-28

mlir - 22.0.0_pre20251127
Ebuild name:

llvm-core/mlir-22.0.0_pre20251127

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2025-11-28

offload - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/offload-22.0.0_pre20251127

Description

OpenMP offloading support

Added to portage

2025-11-28

openmp - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/openmp-22.0.0_pre20251127

Description

OpenMP runtime library for LLVM/clang compiler

Added to portage

2025-11-28

polly - 22.0.0_pre20251127
Ebuild name:

llvm-core/polly-22.0.0_pre20251127

Description

Polyhedral optimizations for LLVM

Added to portage

2025-11-28

qgis - 3.44.5
Ebuild name:

sci-geosciences/qgis-3.44.5

Description

User friendly Geographic Information System

Added to portage

2025-11-28

steve - 1.0.2
Ebuild name:

dev-build/steve-1.0.2

Description

A simple jobserver for Gentoo

Added to portage

2025-11-28

2025-11-27
awscli - 1.43.5
Ebuild name:

app-admin/awscli-1.43.5

Description

Universal Command Line Environment for AWS

Added to portage

2025-11-27

bash - 5.3_p8
Ebuild name:

app-shells/bash-5.3_p8

Description

The standard GNU Bourne again shell

Added to portage

2025-11-27

borgmatic - 2.0.12
Ebuild name:

app-backup/borgmatic-2.0.12

Description

Automatically create, prune and verify backups with borgbackup

Added to portage

2025-11-27

boto3 - 1.41.5
Ebuild name:

dev-python/boto3-1.41.5

Description

The AWS SDK for Python

Added to portage

2025-11-27

botocore - 1.41.5
Ebuild name:

dev-python/botocore-1.41.5

Description

Low-level, data-driven core of boto 3

Added to portage

2025-11-27

charset-normalizer - 3.4.4-r1
Ebuild name:

dev-python/charset-normalizer-3.4.4-r1

Description

The Real First Universal Charset Detector

Added to portage

2025-11-27

clang - 16.0.6-r1
Ebuild name:

llvm-core/clang-16.0.6-r1

Description

C language family frontend for LLVM

Added to portage

2025-11-27

clang - 17.0.6-r1
Ebuild name:

llvm-core/clang-17.0.6-r1

Description

C language family frontend for LLVM

Added to portage

2025-11-27

clang - 18.1.8-r7
Ebuild name:

llvm-core/clang-18.1.8-r7

Description

C language family frontend for LLVM

Added to portage

2025-11-27

clang - 19.1.7-r1
Ebuild name:

llvm-core/clang-19.1.7-r1

Description

C language family frontend for LLVM

Added to portage

2025-11-27

clang-linker-config - 16
Ebuild name:

llvm-core/clang-linker-config-16

Description

Default linker configuration for clang

Added to portage

2025-11-27

clang-linker-config - 17
Ebuild name:

llvm-core/clang-linker-config-17

Description

Default linker configuration for clang

Added to portage

2025-11-27

clang-linker-config - 18
Ebuild name:

llvm-core/clang-linker-config-18

Description

Default linker configuration for clang

Added to portage

2025-11-27

clang-linker-config - 19
Ebuild name:

llvm-core/clang-linker-config-19

Description

Default linker configuration for clang

Added to portage

2025-11-27

clang-rtlib-config - 16
Ebuild name:

llvm-runtimes/clang-rtlib-config-16

Description

Default rtlib configuration for clang

Added to portage

2025-11-27

clang-rtlib-config - 17
Ebuild name:

llvm-runtimes/clang-rtlib-config-17

Description

Default rtlib configuration for clang

Added to portage

2025-11-27

clang-rtlib-config - 18
Ebuild name:

llvm-runtimes/clang-rtlib-config-18

Description

Default rtlib configuration for clang

Added to portage

2025-11-27

clang-rtlib-config - 19
Ebuild name:

llvm-runtimes/clang-rtlib-config-19

Description

Default rtlib configuration for clang

Added to portage

2025-11-27

clang-runtime - 16.0.6-r1
Ebuild name:

llvm-runtimes/clang-runtime-16.0.6-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2025-11-27

clang-runtime - 17.0.6-r1
Ebuild name:

llvm-runtimes/clang-runtime-17.0.6-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2025-11-27

clang-runtime - 18.1.8-r1
Ebuild name:

llvm-runtimes/clang-runtime-18.1.8-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2025-11-27

clang-runtime - 19.1.7-r1
Ebuild name:

llvm-runtimes/clang-runtime-19.1.7-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2025-11-27

clang-stdlib-config - 16
Ebuild name:

llvm-runtimes/clang-stdlib-config-16

Description

Default C++ library configuration for clang

Added to portage

2025-11-27

clang-stdlib-config - 17
Ebuild name:

llvm-runtimes/clang-stdlib-config-17

Description

Default C++ library configuration for clang

Added to portage

2025-11-27

clang-stdlib-config - 18
Ebuild name:

llvm-runtimes/clang-stdlib-config-18

Description

Default C++ library configuration for clang

Added to portage

2025-11-27

clang-stdlib-config - 19
Ebuild name:

llvm-runtimes/clang-stdlib-config-19

Description

Default C++ library configuration for clang

Added to portage

2025-11-27

clang-unwindlib-config - 16
Ebuild name:

llvm-runtimes/clang-unwindlib-config-16

Description

Default unwindlib configuration for clang

Added to portage

2025-11-27

clang-unwindlib-config - 17
Ebuild name:

llvm-runtimes/clang-unwindlib-config-17

Description

Default unwindlib configuration for clang

Added to portage

2025-11-27

clang-unwindlib-config - 18
Ebuild name:

llvm-runtimes/clang-unwindlib-config-18

Description

Default unwindlib configuration for clang

Added to portage

2025-11-27

clang-unwindlib-config - 19
Ebuild name:

llvm-runtimes/clang-unwindlib-config-19

Description

Default unwindlib configuration for clang

Added to portage

2025-11-27

copyq - 13.0.0
Ebuild name:

x11-misc/copyq-13.0.0

Description

Clipboard manager with advanced features

Added to portage

2025-11-27

easyeffects - 8.0.5
Ebuild name:

media-sound/easyeffects-8.0.5

Description

Limiter, auto volume and many other plugins for PipeWire applications

Added to portage

2025-11-27

element-desktop-bin - 1.12.4
Ebuild name:

net-im/element-desktop-bin-1.12.4

Description

A glossy Matrix collaboration client for desktop (binary package)

Added to portage

2025-11-27

git-crypt - 0.8.0
Ebuild name:

dev-vcs/git-crypt-0.8.0

Description

Transparent file encryption in git

Added to portage

2025-11-27

haproxy - 3.3.0
Ebuild name:

net-proxy/haproxy-3.3.0

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2025-11-27

haproxy - 3.3.9999
Ebuild name:

net-proxy/haproxy-3.3.9999

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2025-11-27

hatchling - 1.28.0
Ebuild name:

dev-python/hatchling-1.28.0

Description

Modern, extensible Python build backend

Added to portage

2025-11-27

jalv - 1.6.8-r1
Ebuild name:

media-sound/jalv-1.6.8-r1

Description

Simple but fully featured LV2 host for Jack

Added to portage

2025-11-27

just - 1.43.1
Ebuild name:

dev-build/just-1.43.1

Description

Just a command runner (with syntax inspired by 'make')

Added to portage

2025-11-27

kimageannotator - 0.7.2
Ebuild name:

media-libs/kimageannotator-0.7.2

Description

Tool for annotating images

Added to portage

2025-11-27

kquickimageeditor - 0.6.0
Ebuild name:

media-libs/kquickimageeditor-0.6.0

Description

QtQuick components providing basic image editing capabilities

Added to portage

2025-11-27

libinput - 1.30.0
Ebuild name:

dev-libs/libinput-1.30.0

Description

Library to handle input devices in Wayland

Added to portage

2025-11-27

limine - 10.3.2
Ebuild name:

sys-boot/limine-10.3.2

Description

Limine is a modern, advanced, and portable BIOS/UEFI multiprotocol bootloade

Added to portage

2025-11-27

linux-firmware - 20251125
Ebuild name:

sys-kernel/linux-firmware-20251125

Description

Linux firmware files

Added to portage

2025-11-27

njs - 0.9.4
Ebuild name:

www-nginx/njs-0.9.4

Description

A subset of JavaScript language to use in NGINX

Added to portage

2025-11-27

nuitka - 2.8.7
Ebuild name:

dev-python/nuitka-2.8.7

Description

Python to native compiler

Added to portage

2025-11-27

persist - 0.6.1
Ebuild name:

app-emacs/persist-0.6.1

Description

Persist variables between Emacs sessions

Added to portage

2025-11-27

persist - 0.7
Ebuild name:

app-emacs/persist-0.7

Description

Persist variables between Emacs sessions

Added to portage

2025-11-27

pydantic - 2.12.5
Ebuild name:

dev-python/pydantic-2.12.5

Description

Data parsing and validation using Python type hints

Added to portage

2025-11-27

pymdown-extensions - 10.17.2
Ebuild name:

dev-python/pymdown-extensions-10.17.2

Description

Extensions for Python Markdown

Added to portage

2025-11-27

pyspelling - 2.12.1
Ebuild name:

dev-python/pyspelling-2.12.1

Description

Spell checker automation tool

Added to portage

2025-11-27

python-xmp-toolkit - 2.1.0
Ebuild name:

dev-python/python-xmp-toolkit-2.1.0

Description

Library for working with XMP metadata

Added to portage

2025-11-27

quickjs-ng - 0.11.0
Ebuild name:

dev-libs/quickjs-ng-0.11.0

Description

QuickJS, the Next Generation a mighty JavaScript engine

Added to portage

2025-11-27

sigstore-models - 0.0.6
Ebuild name:

dev-python/sigstore-models-0.0.6

Description

Pydantic based models for Sigstore's protobuf specifications

Added to portage

2025-11-27

spotipy - 2.25.2
Ebuild name:

dev-python/spotipy-2.25.2

Description

A lightweight Python library for the Spotify Web API

Added to portage

2025-11-27

steve - 1.0.0
Ebuild name:

dev-build/steve-1.0.0

Description

A simple jobserver for Gentoo

Added to portage

2025-11-27

steve - 1.0.1
Ebuild name:

dev-build/steve-1.0.1

Description

A simple jobserver for Gentoo

Added to portage

2025-11-27

subtitlecomposer - 0.8.2-r1
Ebuild name:

media-video/subtitlecomposer-0.8.2-r1

Description

Text-based subtitles editor

Added to portage

2025-11-27

telegram-desktop-bin - 6.3.4
Ebuild name:

net-im/telegram-desktop-bin-6.3.4

Description

Official desktop client for Telegram (binary package)

Added to portage

2025-11-27

uv - 0.9.13
Ebuild name:

dev-python/uv-0.9.13

Description

A Python package installer and resolver, written in Rust

Added to portage

2025-11-27

uv-build - 0.9.13
Ebuild name:

dev-python/uv-build-0.9.13

Description

PEP517 uv build backend

Added to portage

2025-11-27

vlc - 3.0.22_rc2
Ebuild name:

media-video/vlc-3.0.22_rc2

Description

Media player and framework with support for most multimedia files and st

Added to portage

2025-11-27

wayland-utils - 1.3.0
Ebuild name:

app-misc/wayland-utils-1.3.0

Description

Display information about supported Wayland protocols and current comp

Added to portage

2025-11-27

xorg-server - 21.1.21
Ebuild name:

x11-base/xorg-server-21.1.21

Description

X.Org X servers

Added to portage

2025-11-27

zlib-ng - 2.3.1
Ebuild name:

sys-libs/zlib-ng-2.3.1

Description

Fork of the zlib data compression library

Added to portage

2025-11-27

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 87.6 ms