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:

45373

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



Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2019-04-24
exiftool - 11.37
Ebuild name:

media-libs/exiftool-11.37

Description

Read and write meta information in image, audio and video files

Added to portage

2019-04-24

git-remote-hg - 1.0.0-r1
Ebuild name:

dev-vcs/git-remote-hg-1.0.0-r1

Description

Semi-official Mercurial bridge from Git project

Added to portage

2019-04-24

haproxy - 1.9.6-r1
Ebuild name:

net-proxy/haproxy-1.9.6-r1

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2019-04-24

kdiff3 - 1.8.0_pre20190420
Ebuild name:

kde-misc/kdiff3-1.8.0_pre20190420

Description

Frontend to diff3 based on KDE Frameworks

Added to portage

2019-04-24

libgit2-glib - 0.28.0.1
Ebuild name:

dev-libs/libgit2-glib-0.28.0.1

Description

Git library for GLib

Added to portage

2019-04-24

libressl - 2.6.5
Ebuild name:

dev-libs/libressl-2.6.5

Description

Free version of the SSL/TLS protocol forked from OpenSSL

Added to portage

2019-04-24

libressl - 2.9.1
Ebuild name:

dev-libs/libressl-2.9.1

Description

Free version of the SSL/TLS protocol forked from OpenSSL

Added to portage

2019-04-24

nodejs - 12.0.0
Ebuild name:

net-libs/nodejs-12.0.0

Description

A JavaScript runtime built on Chrome's V8 JavaScript engine

Added to portage

2019-04-24

nvidia-drivers - 430.09
Ebuild name:

x11-drivers/nvidia-drivers-430.09

Description

NVIDIA Accelerated Graphics Driver

Added to portage

2019-04-24

opendkim - 2.10.3-r11
Ebuild name:

mail-filter/opendkim-2.10.3-r11

Description

A milter providing DKIM signing and verification

Added to portage

2019-04-24

opera-beta - 60.0.3255.60
Ebuild name:

www-client/opera-beta-60.0.3255.60

Description

A fast and secure web browser

Added to portage

2019-04-24

opera-developer - 61.0.3296.0
Ebuild name:

www-client/opera-developer-61.0.3296.0

Description

A fast and secure web browser

Added to portage

2019-04-24

parallel - 20190422
Ebuild name:

sys-process/parallel-20190422

Description

A shell tool for executing jobs in parallel locally or on remote mach

Added to portage

2019-04-24

postfix - 3.5_pre20190330-r1
Ebuild name:

mail-mta/postfix-3.5_pre20190330-r1

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2019-04-24

pycairo - 1.18.1
Ebuild name:

dev-python/pycairo-1.18.1

Description

Python bindings for the cairo library

Added to portage

2019-04-24

serverengine - 2.1.1
Ebuild name:

dev-ruby/serverengine-2.1.1

Description

A framework to implement robust multiprocess servers

Added to portage

2019-04-24

skrooge - 2.19.1
Ebuild name:

app-office/skrooge-2.19.1

Description

Personal finances manager, aiming at being simple and intuitive

Added to portage

2019-04-24

stunnel - 5.51-r1
Ebuild name:

net-misc/stunnel-5.51-r1

Description

TLS/SSL - Port Wrapper

Added to portage

2019-04-24

uptimed - 0.4.1-r1
Ebuild name:

app-misc/uptimed-0.4.1-r1

Description

System uptime record daemon that keeps track of your highest uptimes

Added to portage

2019-04-24

urllib3 - 1.24.2
Ebuild name:

dev-python/urllib3-1.24.2

Description

HTTP library with thread-safe connection pooling, file post, and more

Added to portage

2019-04-24

vivaldi-snapshot - 2.5.1525.4_p1
Ebuild name:

www-client/vivaldi-snapshot-2.5.1525.4_p1

Description

A browser for our friends

Added to portage

2019-04-24

wpa_supplicant - 2.8-r1
Ebuild name:

net-wireless/wpa_supplicant-2.8-r1

Description

IEEE 802.1X/WPA supplicant for secure wireless transfers

Added to portage

2019-04-24

youtube-dl - 2019.04.24
Ebuild name:

net-misc/youtube-dl-2019.04.24

Description

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

Added to portage

2019-04-24

2019-04-23
alacritty - 0.3.2
Ebuild name:

x11-terms/alacritty-0.3.2

Description

GPU-accelerated terminal emulator

Added to portage

2019-04-23

atftp - 0.7.2
Ebuild name:

net-ftp/atftp-0.7.2

Description

Advanced TFTP implementation client/server

Added to portage

2019-04-23

calibre - 3.41.3
Ebuild name:

app-text/calibre-3.41.3

Description

Ebook management application

Added to portage

2019-04-23

cdw - 0.8.1-r1
Ebuild name:

app-cdr/cdw-0.8.1-r1

Description

An ncurses based console frontend for cdrtools and dvd+rw-tools

Added to portage

2019-04-23

cmake - 3.14.3
Ebuild name:

dev-util/cmake-3.14.3

Description

Cross platform Make

Added to portage

2019-04-23

eduke32 - 20190419.7615
Ebuild name:

games-fps/eduke32-20190419.7615

Description

An open source engine port of the classic PC first person shooter D

Added to portage

2019-04-23

elfix - 0.9.5
Ebuild name:

sys-apps/elfix-0.9.5

Description

A suite of tools to work with ELF objects on Hardened Gentoo

Added to portage

2019-04-23

flannel - 0.11.0
Ebuild name:

app-emulation/flannel-0.11.0

Description

An etcd backed network fabric for containers

Added to portage

2019-04-23

fuse-python - 0.3.1
Ebuild name:

dev-python/fuse-python-0.3.1

Description

Python FUSE bindings

Added to portage

2019-04-23

fwupd - 1.2.8
Ebuild name:

sys-apps/fwupd-1.2.8

Description

Aims to make updating firmware on Linux automatic, safe and reliable

Added to portage

2019-04-23

gitea - 1.8.0
Ebuild name:

www-apps/gitea-1.8.0

Description

A painless self-hosted Git service

Added to portage

2019-04-23

gnuradio - 3.7.13.5
Ebuild name:

net-wireless/gnuradio-3.7.13.5

Description

Toolkit that provides signal processing blocks to implement software

Added to portage

2019-04-23

gssproxy - 0.7.0-r1
Ebuild name:

net-nds/gssproxy-0.7.0-r1

Description

daemon to proxy GSSAPI context establishment and channel handling

Added to portage

2019-04-23

gssproxy - 0.8.0
Ebuild name:

net-nds/gssproxy-0.8.0

Description

daemon to proxy GSSAPI context establishment and channel handling

Added to portage

2019-04-23

gssproxy - 0.8.2
Ebuild name:

net-nds/gssproxy-0.8.2

Description

daemon to proxy GSSAPI context establishment and channel handling

Added to portage

2019-04-23

hashdiff - 0.3.9
Ebuild name:

dev-ruby/hashdiff-0.3.9

Description

Simple Hash extension to make working with nested hashes easier

Added to portage

2019-04-23

karma-bin - 0.33
Ebuild name:

www-apps/karma-bin-0.33

Description

Alerts dashboard for Prometheus Alertmanager

Added to portage

2019-04-23

kube-bench - 0.0.27
Ebuild name:

app-admin/kube-bench-0.0.27

Description

Kubernetes Bench for Security runs the CIS Kubernetes Benchmark

Added to portage

2019-04-23

kubectl - 1.14.1
Ebuild name:

sys-cluster/kubectl-1.14.1

Description

CLI to run commands against Kubernetes clusters

Added to portage

2019-04-23

libfilezilla - 0.16.0
Ebuild name:

dev-libs/libfilezilla-0.16.0

Description

C++ library offering some basic functionality for platform-independent

Added to portage

2019-04-23

libgpg-error - 1.36
Ebuild name:

dev-libs/libgpg-error-1.36

Description

Contains error handling functions used by GnuPG software

Added to portage

2019-04-23

maim - 5.5.3
Ebuild name:

media-gfx/maim-5.5.3

Description

Commandline tool to take screenshots of the desktop

Added to portage

2019-04-23

mendeleydesktop - 1.19.4
Ebuild name:

sci-misc/mendeleydesktop-1.19.4

Description

Research management tool for desktop and web

Added to portage

2019-04-23

mercurial - 4.9.1
Ebuild name:

dev-vcs/mercurial-4.9.1

Description

Scalable distributed SCM

Added to portage

2019-04-23

multipath-tools - 0.8.1
Ebuild name:

sys-fs/multipath-tools-0.8.1

Description

Device mapper target autoconfig

Added to portage

2019-04-23

prometheus_flask_exporter - 0.7.2
Ebuild name:

dev-python/prometheus_flask_exporter-0.7.2

Description

Provides HTTP request metrics to export into Prometheus

Added to portage

2019-04-23

pypax - 0.9.5
Ebuild name:

dev-python/pypax-0.9.5

Description

Python module to get or set either PT_PAX and/or XATTR_PAX flags

Added to portage

2019-04-23

rinku - 2.0.6
Ebuild name:

dev-ruby/rinku-2.0.6

Description

A Ruby library that does autolinking

Added to portage

2019-04-23

setuptools - 41.0.1
Ebuild name:

dev-python/setuptools-41.0.1

Description

Collection of extensions to Distutils

Added to portage

2019-04-23

signal-desktop-bin - 1.24.1
Ebuild name:

net-im/signal-desktop-bin-1.24.1

Description

Allows you to send and receive messages of Signal Messenger on you

Added to portage

2019-04-23

tortoisehg - 4.9.1
Ebuild name:

dev-vcs/tortoisehg-4.9.1

Description

Set of graphical tools for Mercurial

Added to portage

2019-04-23

unifi - 5.10.22
Ebuild name:

net-wireless/unifi-5.10.22

Description

A Management Controller for Ubiquiti Networks UniFi APs

Added to portage

2019-04-23

userspace-rcu - 0.10.2
Ebuild name:

dev-libs/userspace-rcu-0.10.2

Description

userspace RCU (read-copy-update) library

Added to portage

2019-04-23

wsmake - 0.6.4-r1
Ebuild name:

www-misc/wsmake-0.6.4-r1

Description

Website pre-processor features tag substitution and page ordering

Added to portage

2019-04-23

xchm - 1.29
Ebuild name:

app-text/xchm-1.29

Description

Utility for viewing Compiled HTML Help (CHM) files

Added to portage

2019-04-23

xfce4-notifyd - 0.4.4
Ebuild name:

xfce-extra/xfce4-notifyd-0.4.4

Description

Notification daemon for the Xfce desktop environment

Added to portage

2019-04-23

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2018 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
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: 101.3 ms