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:

55826

userrating:

average rating: 1.5 (4 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.2 (48 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
2020-05-30
alsa-mixer - 0.3.0
Ebuild name:

dev-haskell/alsa-mixer-0.3.0

Description

Bindings to the ALSA simple mixer API

Added to portage

2020-05-30

cmake - 3.17.3
Ebuild name:

dev-util/cmake-3.17.3

Description

Cross platform Make

Added to portage

2020-05-30

debianutils - 4.11
Ebuild name:

sys-apps/debianutils-4.11

Description

A selection of tools from Debian

Added to portage

2020-05-30

dropbox - 98.4.158
Ebuild name:

net-misc/dropbox-98.4.158

Description

Dropbox daemon (pretends to be GUI-less)

Added to portage

2020-05-30

fast_gettext - 2.0.3
Ebuild name:

dev-ruby/fast_gettext-2.0.3

Description

GetText but 3.5x faster, 560x less memory, clean namespace and threadsa

Added to portage

2020-05-30

gcc - 6.5.0-r2
Ebuild name:

sys-devel/gcc-6.5.0-r2

Description

The GNU Compiler Collection

Added to portage

2020-05-30

gcc - 7.5.0-r1
Ebuild name:

sys-devel/gcc-7.5.0-r1

Description

The GNU Compiler Collection

Added to portage

2020-05-30

gcc - 8.4.0-r1
Ebuild name:

sys-devel/gcc-8.4.0-r1

Description

The GNU Compiler Collection

Added to portage

2020-05-30

gcc - 9.3.0-r1
Ebuild name:

sys-devel/gcc-9.3.0-r1

Description

The GNU Compiler Collection

Added to portage

2020-05-30

hocon - 1.3.1
Ebuild name:

dev-ruby/hocon-1.3.1

Description

This is a port of the Typesafe Config library to Ruby.

Added to portage

2020-05-30

hplip - 3.20.5
Ebuild name:

net-print/hplip-3.20.5

Description

HP Linux Imaging and Printing - Print, scan, fax drivers and service tools

Added to portage

2020-05-30

jsoncpp - 1.9.3
Ebuild name:

dev-libs/jsoncpp-1.9.3

Description

C++ JSON reader and writer

Added to portage

2020-05-30

karchive - 5.70.0-r1
Ebuild name:

kde-frameworks/karchive-5.70.0-r1

Description

Framework for reading, creation, and manipulation of various arch

Added to portage

2020-05-30

kio-extras - 19.12.3-r2
Ebuild name:

kde-apps/kio-extras-19.12.3-r2

Description

KIO plugins present a filesystem-like view of arbitrary data

Added to portage

2020-05-30

kio-extras - 20.04.1-r1
Ebuild name:

kde-apps/kio-extras-20.04.1-r1

Description

KIO plugins present a filesystem-like view of arbitrary data

Added to portage

2020-05-30

libfakekey - 0.3-r1
Ebuild name:

x11-libs/libfakekey-0.3-r1

Description

Helper library for the x11-misc/matchbox-keyboard package

Added to portage

2020-05-30

libgpg-error - 1.38
Ebuild name:

dev-libs/libgpg-error-1.38

Description

Contains error handling functions used by GnuPG software

Added to portage

2020-05-30

mako - 1.1.3
Ebuild name:

dev-python/mako-1.1.3

Description

A Python templating language

Added to portage

2020-05-30

parsec-numbers - 0.1.0
Ebuild name:

dev-haskell/parsec-numbers-0.1.0

Description

Utilities for parsing numbers from strings

Added to portage

2020-05-30

parsec1 - 1.0.0.6
Ebuild name:

dev-haskell/parsec1-1.0.0.6

Description

Portable monadic parser combinators

Added to portage

2020-05-30

phonenumbers - 8.12.4
Ebuild name:

dev-python/phonenumbers-8.12.4

Description

Python port of Google's libphonenumber

Added to portage

2020-05-30

proftpd - 1.3.7_rc3-r1
Ebuild name:

net-ftp/proftpd-1.3.7_rc3-r1

Description

An advanced and very configurable FTP server

Added to portage

2020-05-30

pyproject2setuppy - 7
Ebuild name:

dev-python/pyproject2setuppy-7

Description

Cheap setup.py hack to install flit & poetry-based projects

Added to portage

2020-05-30

reiser4progs - 2.0.1
Ebuild name:

sys-fs/reiser4progs-2.0.1

Description

reiser4progs mkfs, fsck, etc...

Added to portage

2020-05-30

ripgrep - 12.1.1
Ebuild name:

sys-apps/ripgrep-12.1.1

Description

a search tool that combines the usability of ag with the raw speed of grep

Added to portage

2020-05-30

wmfrog - 0.3.1-r1
Ebuild name:

x11-plugins/wmfrog-0.3.1-r1

Description

a weather application, it shows the weather in a graphical way

Added to portage

2020-05-30

wmfsm - 0.36
Ebuild name:

x11-plugins/wmfsm-0.36

Description

dockapp for monitoring filesystem usage

Added to portage

2020-05-30

wmfsm - 0.36-r1
Ebuild name:

x11-plugins/wmfsm-0.36-r1

Description

dockapp for monitoring filesystem usage

Added to portage

2020-05-30

wmget - 0.6.1
Ebuild name:

x11-plugins/wmget-0.6.1

Description

a libcurl based dockapp for automated downloads

Added to portage

2020-05-30

wmgrabimage - 0.72-r2
Ebuild name:

x11-plugins/wmgrabimage-0.72-r2

Description

wmGrabImage grabs an image from the WWW and displays it

Added to portage

2020-05-30

wmgtemp - 1.2
Ebuild name:

x11-plugins/wmgtemp-1.2

Description

CPU and SYS temperature dockapp

Added to portage

2020-05-30

wmhdplop - 0.9.10
Ebuild name:

x11-plugins/wmhdplop-0.9.10

Description

a dockapp for monitoring disk activities with fancy visuals

Added to portage

2020-05-30

wmhdplop - 0.9.11
Ebuild name:

x11-plugins/wmhdplop-0.9.11

Description

a dockapp for monitoring disk activities with fancy visuals

Added to portage

2020-05-30

wmifinfo - 0.10-r1
Ebuild name:

x11-plugins/wmifinfo-0.10-r1

Description

a dockapp for monitoring network interfaces

Added to portage

2020-05-30

wmifs - 1.8
Ebuild name:

x11-plugins/wmifs-1.8

Description

Network monitoring dockapp

Added to portage

2020-05-30

wminet - 3.0.0-r2
Ebuild name:

x11-plugins/wminet-3.0.0-r2

Description

dockapp for monitoring internet connections to and from your computer

Added to portage

2020-05-30

wmitime - 0.5-r1
Ebuild name:

x11-plugins/wmitime-0.5-r1

Description

Overglorified clock dockapp w/time, date, and internet time

Added to portage

2020-05-30

wmix - 3.2
Ebuild name:

x11-plugins/wmix-3.2

Description

Dockapp mixer for OSS or ALSA

Added to portage

2020-05-30

wmix - 3.4
Ebuild name:

x11-plugins/wmix-3.4

Description

Dockapp mixer for OSS or ALSA

Added to portage

2020-05-30

wmix - 3.5
Ebuild name:

x11-plugins/wmix-3.5

Description

Dockapp mixer for OSS or ALSA

Added to portage

2020-05-30

wmlife - 1.0.1-r1
Ebuild name:

x11-plugins/wmlife-1.0.1-r1

Description

dockapp running Conway's Game of Life (and program launcher)

Added to portage

2020-05-30

wmload - 0.9.7-r1
Ebuild name:

x11-plugins/wmload-0.9.7-r1

Description

yet another dock application showing a system load gauge

Added to portage

2020-05-30

wmlongrun - 0.3.1
Ebuild name:

x11-plugins/wmlongrun-0.3.1

Description

A dockapp to monitor LongRun on a Transmeta Crusoe processor

Added to portage

2020-05-30

wmmaiload - 2.2.1-r1
Ebuild name:

x11-plugins/wmmaiload-2.2.1-r1

Description

dockapp that monitors one or more mailboxes

Added to portage

2020-05-30

wmmaiload - 2.3.0-r1
Ebuild name:

x11-plugins/wmmaiload-2.3.0-r1

Description

dockapp that monitors one or more mailboxes

Added to portage

2020-05-30

wmmand - 1.3.2-r1
Ebuild name:

x11-plugins/wmmand-1.3.2-r1

Description

a dockable mandelbrot browser

Added to portage

2020-05-30

wmmemload - 0.1.8-r1
Ebuild name:

x11-plugins/wmmemload-0.1.8-r1

Description

dockapp that displays memory and swap space usage

Added to portage

2020-05-30

wmmenu - 1.3-r2
Ebuild name:

x11-plugins/wmmenu-1.3-r2

Description

a popup menu of icons like in AfterStep, as a dockapp

Added to portage

2020-05-30

wmmisc - 1.2
Ebuild name:

x11-plugins/wmmisc-1.2

Description

a monitoring dockapp for system load, user amount, fork amount and processes

Added to portage

2020-05-30

wmmixer - 1.8
Ebuild name:

x11-plugins/wmmixer-1.8

Description

A mixer designed for WindowMaker

Added to portage

2020-05-30

2020-05-29
audacious - 3.10.1-r1
Ebuild name:

media-sound/audacious-3.10.1-r1

Description

Lightweight and versatile audio player

Added to portage

2020-05-29

audacious-plugins - 3.10.1-r3
Ebuild name:

media-plugins/audacious-plugins-3.10.1-r3

Description

Lightweight and versatile audio player

Added to portage

2020-05-29

autofs - 5.1.6-r1
Ebuild name:

net-fs/autofs-5.1.6-r1

Description

Kernel based automounter

Added to portage

2020-05-29

bpftrace - 0.10.0-r1
Ebuild name:

dev-util/bpftrace-0.10.0-r1

Description

High-level tracing language for eBPF

Added to portage

2020-05-29

caribou - 0.4.21-r1
Ebuild name:

app-accessibility/caribou-0.4.21-r1

Description

Input assistive technology intended for switch and pointer user

Added to portage

2020-05-29

ceph - 15.2.2-r1
Ebuild name:

sys-cluster/ceph-15.2.2-r1

Description

Ceph distributed filesystem

Added to portage

2020-05-29

cffi - 1.14.0-r2
Ebuild name:

dev-python/cffi-1.14.0-r2

Description

Foreign Function Interface for Python calling C code

Added to portage

2020-05-29

cinnamon - 4.4.8
Ebuild name:

gnome-extra/cinnamon-4.4.8

Description

A fork of GNOME Shell with layout similar to GNOME 2

Added to portage

2020-05-29

cinnamon-control-center - 4.4.0
Ebuild name:

gnome-extra/cinnamon-control-center-4.4.0

Description

Cinnamons's main interface to configure various aspects o

Added to portage

2020-05-29

cinnamon-desktop - 4.4.1
Ebuild name:

gnome-extra/cinnamon-desktop-4.4.1

Description

A collection of libraries and utilites used by Cinnamon

Added to portage

2020-05-29

cinnamon-menus - 4.4.0
Ebuild name:

gnome-extra/cinnamon-menus-4.4.0

Description

Cinnamon's library for the Desktop Menu fd.o specification

Added to portage

2020-05-29

cinnamon-screensaver - 4.4.1
Ebuild name:

gnome-extra/cinnamon-screensaver-4.4.1

Description

Screensaver for Cinnamon

Added to portage

2020-05-29

cinnamon-session - 4.4.1
Ebuild name:

gnome-extra/cinnamon-session-4.4.1

Description

Cinnamon session manager

Added to portage

2020-05-29

cinnamon-settings-daemon - 4.4.0
Ebuild name:

gnome-extra/cinnamon-settings-daemon-4.4.0

Description

Cinnamon's settings daemon

Added to portage

2020-05-29

cinnamon-translations - 4.4.2
Ebuild name:

gnome-extra/cinnamon-translations-4.4.2

Description

Translation data for Cinnamon

Added to portage

2020-05-29

cjs - 4.4.0
Ebuild name:

gnome-extra/cjs-4.4.0

Description

Linux Mint's fork of gjs for Cinnamon

Added to portage

2020-05-29

cryptsetup - 2.3.3
Ebuild name:

sys-fs/cryptsetup-2.3.3

Description

Tool to setup encrypted devices with dm-crypt

Added to portage

2020-05-29

csv23 - 0.3.2
Ebuild name:

dev-python/csv23-0.3.2

Description

Python 2/3 unicode CSV compatibility layer

Added to portage

2020-05-29

exiv2 - 0.27.3_rc2
Ebuild name:

media-gfx/exiv2-0.27.3_rc2

Description

EXIF, IPTC and XMP metadata C++ library and command line utility

Added to portage

2020-05-29

fceux - 2.2.3-r1
Ebuild name:

games-emulation/fceux-2.2.3-r1

Description

A portable Famicom/NES emulator, an evolution of the original FCE Ul

Added to portage

2020-05-29

flameshot - 0.6.0
Ebuild name:

media-gfx/flameshot-0.6.0

Description

Powerful yet simple to use screenshot software

Added to portage

2020-05-29

fraqtive - 0.4.8-r2
Ebuild name:

x11-misc/fraqtive-0.4.8-r2

Description

Open source, multi-platform generator of the Mandelbrot family fractals

Added to portage

2020-05-29

gevent - 20.5.2
Ebuild name:

dev-python/gevent-20.5.2

Description

Coroutine-based network library

Added to portage

2020-05-29

gr - 0.49.0
Ebuild name:

sci-visualization/gr-0.49.0

Description

Universal framework for cross-platform visualization applications

Added to portage

2020-05-29

heat - 13.0.2
Ebuild name:

sys-cluster/heat-13.0.2

Description

A CloudFormation-compatible openstack-native cloud orchestration engine.

Added to portage

2020-05-29

ibus-libpinyin - 1.11.92
Ebuild name:

app-i18n/ibus-libpinyin-1.11.92

Description

Intelligent Pinyin and Bopomofo input methods based on LibPinyin fo

Added to portage

2020-05-29

jenkins-bin - 2.222.4
Ebuild name:

dev-util/jenkins-bin-2.222.4

Description

Extensible continuous integration server

Added to portage

2020-05-29

konsole - 20.04.1-r2
Ebuild name:

kde-apps/konsole-20.04.1-r2

Description

KDE's terminal emulator

Added to portage

2020-05-29

libtimezonemap - 0.4.6
Ebuild name:

dev-libs/libtimezonemap-0.4.6

Description

GTK+3 timezone map widget

Added to portage

2020-05-29

lsvpd - 1.7.11
Ebuild name:

sys-apps/lsvpd-1.7.11

Description

Utility to List Device Vital Product Data (VPD)

Added to portage

2020-05-29

mcelog - 170
Ebuild name:

app-admin/mcelog-170

Description

A tool to log and decode Machine Check Exceptions

Added to portage

2020-05-29

mesa - 20.1.0
Ebuild name:

media-libs/mesa-20.1.0

Description

OpenGL-like graphic library for Linux

Added to portage

2020-05-29

minicoredumper - 2.0.1-r1
Ebuild name:

sys-process/minicoredumper-2.0.1-r1

Description

Core dump file processor

Added to portage

2020-05-29

mod_h2 - 1.15.10
Ebuild name:

www-apache/mod_h2-1.15.10

Description

HTTP/2 module for Apache

Added to portage

2020-05-29

munin - 2.0.63
Ebuild name:

net-analyzer/munin-2.0.63

Description

Munin Server Monitoring Tool

Added to portage

2020-05-29

nemo - 4.4.2
Ebuild name:

gnome-extra/nemo-4.4.2

Description

A file manager for Cinnamon, forked from Nautilus

Added to portage

2020-05-29

openssh - 8.3_p1
Ebuild name:

net-misc/openssh-8.3_p1

Description

Port of OpenBSD's free SSH release

Added to portage

2020-05-29

opera-beta - 69.0.3686.12
Ebuild name:

www-client/opera-beta-69.0.3686.12

Description

A fast and secure web browser

Added to portage

2020-05-29

pysol_cards - 0.8.16
Ebuild name:

dev-python/pysol_cards-0.8.16

Description

Deal PySol FreeCell cards

Added to portage

2020-05-29

python-magic - 0.4.18
Ebuild name:

dev-python/python-magic-0.4.18

Description

Access the libmagic file type identification library

Added to portage

2020-05-29

setuptools - 47.1.1
Ebuild name:

dev-python/setuptools-47.1.1

Description

Collection of extensions to Distutils

Added to portage

2020-05-29

sispmctl - 4.1
Ebuild name:

sys-power/sispmctl-4.1

Description

GEMBIRD SiS-PM control utility

Added to portage

2020-05-29

stgit - 0.22
Ebuild name:

dev-vcs/stgit-0.22

Description

Manage a stack of patches using GIT as a backend

Added to portage

2020-05-29

stm - 2.5.0.0
Ebuild name:

dev-haskell/stm-2.5.0.0

Description

Software Transactional Memory

Added to portage

2020-05-29

sway - 1.4-r2
Ebuild name:

gui-wm/sway-1.4-r2

Description

i3-compatible Wayland window manager

Added to portage

2020-05-29

tor - 0.4.3.5
Ebuild name:

net-vpn/tor-0.4.3.5

Description

Anonymizing overlay network for TCP

Added to portage

2020-05-29

valgrind - 3.16.0
Ebuild name:

dev-util/valgrind-3.16.0

Description

An open-source memory debugger for GNU/Linux

Added to portage

2020-05-29

wily - 1.0-r2
Ebuild name:

app-editors/wily-1.0-r2

Description

An emulation of ACME, Plan9's hybrid window system, shell and editor

Added to portage

2020-05-29

wmforkplop - 0.9.3-r3
Ebuild name:

x11-plugins/wmforkplop-0.9.3-r3

Description

monitors the forking activity of the kernel and most active process

Added to portage

2020-05-29

wmfortune - 0.241-r1
Ebuild name:

x11-plugins/wmfortune-0.241-r1

Description

a dockapp showing fortune-mod messages

Added to portage

2020-05-29

wxhexeditor - 0.24
Ebuild name:

app-editors/wxhexeditor-0.24

Description

A cross-platform hex editor designed specially for large files

Added to portage

2020-05-29

xapps - 1.8.4
Ebuild name:

x11-libs/xapps-1.8.4

Description

Cross-desktop libraries and common resources

Added to portage

2020-05-29

xmlschema - 1.2.0
Ebuild name:

dev-python/xmlschema-1.2.0

Description

An XML Schema validator and decoder

Added to portage

2020-05-29

you-get - 0.4.1432
Ebuild name:

net-misc/you-get-0.4.1432

Description

utility to download media contents from the web

Added to portage

2020-05-29

youtube-dl - 2020.05.29
Ebuild name:

net-misc/youtube-dl-2020.05.29

Description

Download videos from YouTube.com (and more sites...)

Added to portage

2020-05-29

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: 58.9 ms