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:

36623

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
Please read "Why adblockers are bad".



other Ads
Stellenangebote
Stellenangebote
für Fach- und
Führungskräfte
www.nachoben.com
Trace My Cash
Wenn Sie sich schon immer mal gefragt haben, wo eigentlich Ihr geliebtes Bargeld geblieben ist, finden Sie hier vielleicht die Antwort.
www.tracemycash.com
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
2017-01-24
a2ps - 4.14-r6
Ebuild name:

app-text/a2ps-4.14-r6

Description

Any to PostScript filter

Added to portage

2017-01-24

actionpack-action_caching - 1.2.0
Ebuild name:

dev-ruby/actionpack-action_caching-1.2.0

Description

Action caching for Action Pack (removed from core in Rails

Added to portage

2017-01-24

bones - 3.8.4-r1
Ebuild name:

dev-ruby/bones-3.8.4-r1

Description

Tool that creates new Ruby projects from a code skeleton

Added to portage

2017-01-24

fbpdf - 0_p20161202
Ebuild name:

app-text/fbpdf-0_p20161202

Description

framebuffer pdf and djvu viewer

Added to portage

2017-01-24

java-sdk-docs - 1.8.0.121
Ebuild name:

dev-java/java-sdk-docs-1.8.0.121

Description

Oracle's documentation bundle (including API) for Java SE

Added to portage

2017-01-24

libcss - 0.6.1
Ebuild name:

dev-libs/libcss-0.6.1

Description

CSS parser and selection engine, written in C

Added to portage

2017-01-24

libnsfb - 0.1.5
Ebuild name:

dev-libs/libnsfb-0.1.5

Description

framebuffer abstraction library, written in C

Added to portage

2017-01-24

libnsutils - 0.0.3
Ebuild name:

dev-libs/libnsutils-0.0.3

Description

base64 and time library, written in C

Added to portage

2017-01-24

libwapcaplet - 0.4.0
Ebuild name:

dev-libs/libwapcaplet-0.4.0

Description

string internment library, written in C

Added to portage

2017-01-24

nsgenbind - 0.4
Ebuild name:

dev-libs/nsgenbind-0.4

Description

generate javascript to dom bindings from w3c webidl files

Added to portage

2017-01-24

oracle-jdk-bin - 1.8.0.121
Ebuild name:

dev-java/oracle-jdk-bin-1.8.0.121

Description

Oracle's Java SE Development Kit

Added to portage

2017-01-24

oracle-jre-bin - 1.8.0.121
Ebuild name:

dev-java/oracle-jre-bin-1.8.0.121

Description

Oracle's Java SE Runtime Environment

Added to portage

2017-01-24

pax-utils - 1.2.1
Ebuild name:

app-misc/pax-utils-1.2.1

Description

ELF utils that can check files for security relevant properties

Added to portage

2017-01-24

puppet-agent - 1.8.3-r1
Ebuild name:

app-admin/puppet-agent-1.8.3-r1

Description

general puppet client utils along with mcollective hiera and facter

Added to portage

2017-01-24

rack-cache - 1.7.0
Ebuild name:

dev-ruby/rack-cache-1.7.0

Description

Enable HTTP caching for Rack-based applications that produce freshness in

Added to portage

2017-01-24

rubygems - 2.6.10
Ebuild name:

dev-ruby/rubygems-2.6.10

Description

Centralized Ruby extension management system

Added to portage

2017-01-24

skrooge - 2.7.0
Ebuild name:

app-office/skrooge-2.7.0

Description

Personal finances manager, aiming at being simple and intuitive

Added to portage

2017-01-24

2017-01-23
acts_as_list - 0.9.0
Ebuild name:

dev-ruby/acts_as_list-0.9.0

Description

Capabilities for sorting and reordering a number of objects in a list

Added to portage

2017-01-23

blackfriday - 1.4
Ebuild name:

dev-go/blackfriday-1.4

Description

a markdown processor implemented in Go

Added to portage

2017-01-23

botan - 1.10.15
Ebuild name:

dev-libs/botan-1.10.15

Description

A C++ crypto library

Added to portage

2017-01-23

botan - 2.0.1
Ebuild name:

dev-libs/botan-2.0.1

Description

A C++ crypto library

Added to portage

2017-01-23

bup - 0.29-r1
Ebuild name:

app-backup/bup-0.29-r1

Description

A highly efficient backup system based on the git packfile format

Added to portage

2017-01-23

childprocess - 0.6.1
Ebuild name:

dev-ruby/childprocess-0.6.1

Description

Solution for controlling external programs running in the background

Added to portage

2017-01-23

collada-dom - 2.4.4
Ebuild name:

dev-libs/collada-dom-2.4.4

Description

COLLADA Document Object Model (DOM) C++ Library

Added to portage

2017-01-23

cssselect - 1.0.1
Ebuild name:

dev-python/cssselect-1.0.1

Description

parses CSS3 Selectors and translates them to XPath 1.0

Added to portage

2017-01-23

ctemplate - 2.3-r1
Ebuild name:

dev-cpp/ctemplate-2.3-r1

Description

A simple but powerful template language for C++

Added to portage

2017-01-23

decorator - 4.0.11
Ebuild name:

dev-python/decorator-4.0.11

Description

Simplifies the usage of decorators for the average programmer

Added to portage

2017-01-23

device-atlas-api-c - 2.1
Ebuild name:

dev-libs/device-atlas-api-c-2.1

Description

API to detect devices based on the User-Agent HTTP header

Added to portage

2017-01-23

girara - 0.2.7
Ebuild name:

dev-libs/girara-0.2.7

Description

UI library that focuses on simplicity and minimalism

Added to portage

2017-01-23

gnupg - 2.1.17-r2
Ebuild name:

app-crypt/gnupg-2.1.17-r2

Description

The GNU Privacy Guard, a GPL OpenPGP implementation

Added to portage

2017-01-23

go-md2man - 1.0.6
Ebuild name:

dev-go/go-md2man-1.0.6

Description

A utility to convert markdown to man pages

Added to portage

2017-01-23

ipaddress - 1.0.18
Ebuild name:

dev-python/ipaddress-1.0.18

Description

IPv4/IPv6 manipulation library, backport of the ipaddress module

Added to portage

2017-01-23

libgit2 - 0.25.1
Ebuild name:

dev-libs/libgit2-0.25.1

Description

A linkable library for Git

Added to portage

2017-01-23

libvirt - 3.0.0
Ebuild name:

app-emulation/libvirt-3.0.0

Description

C toolkit to manipulate virtual machines

Added to portage

2017-01-23

libvirt-python - 3.0.0
Ebuild name:

dev-python/libvirt-python-3.0.0

Description

libvirt Python bindings

Added to portage

2017-01-23

llpp - 23
Ebuild name:

app-text/llpp-23

Description

graphical PDF viewer which aims to superficially resemble less(1)

Added to portage

2017-01-23

mc - 4.8.18-r1
Ebuild name:

app-misc/mc-4.8.18-r1

Description

GNU Midnight Commander is a text based file manager

Added to portage

2017-01-23

mujs - 0_p20150202
Ebuild name:

dev-lang/mujs-0_p20150202

Description

lightweight Javascript interpreter

Added to portage

2017-01-23

mujs - 0_p20160504
Ebuild name:

dev-lang/mujs-0_p20160504

Description

lightweight Javascript interpreter

Added to portage

2017-01-23

mupdf - 1.10a
Ebuild name:

app-text/mupdf-1.10a

Description

a lightweight PDF viewer and toolkit written in portable C

Added to portage

2017-01-23

nose-exclude - 0.5.0
Ebuild name:

dev-python/nose-exclude-0.5.0

Description

Exclude specific directories from nosetests runs

Added to portage

2017-01-23

pngpp - 0.2.9
Ebuild name:

dev-cpp/pngpp-0.2.9

Description

A simple but powerful C++ interface to libpng

Added to portage

2017-01-23

pyrsistent - 0.12.0
Ebuild name:

dev-python/pyrsistent-0.12.0

Description

Persistent/Functional/Immutable data structures

Added to portage

2017-01-23

requests - 2.12.5
Ebuild name:

dev-python/requests-2.12.5

Description

HTTP library for human beings

Added to portage

2017-01-23

serf - 0.8.0
Ebuild name:

app-admin/serf-0.8.0

Description

Service orchestration and management tool

Added to portage

2017-01-23

sqlalchemy - 1.1.5
Ebuild name:

dev-python/sqlalchemy-1.1.5

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2017-01-23

texstudio - 2.12.0
Ebuild name:

app-office/texstudio-2.12.0

Description

Free cross-platform LaTeX editor (fork from texmakerX)

Added to portage

2017-01-23

typing - 3.5.3.0
Ebuild name:

dev-python/typing-3.5.3.0

Description

Type Hints for Python

Added to portage

2017-01-23

urllib3 - 1.20
Ebuild name:

dev-python/urllib3-1.20

Description

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

Added to portage

2017-01-23

websocket-driver - 0.6.5
Ebuild name:

dev-ruby/websocket-driver-0.6.5

Description

A complete implementation of the WebSocket protocols

Added to portage

2017-01-23

wstools - 0.4.5
Ebuild name:

dev-python/wstools-0.4.5

Description

WSDL parsing services package for Web Services for Python

Added to portage

2017-01-23

zathura - 0.3.7
Ebuild name:

app-text/zathura-0.3.7

Description

A highly customizable and functional document viewer

Added to portage

2017-01-23

zathura-cb - 0.1.6
Ebuild name:

app-text/zathura-cb-0.1.6

Description

Comic book plug-in for zathura with 7zip, rar, tar and zip support

Added to portage

2017-01-23

zathura-djvu - 0.2.6
Ebuild name:

app-text/zathura-djvu-0.2.6

Description

DjVu plug-in for zathura

Added to portage

2017-01-23

zathura-pdf-mupdf - 0.3.1
Ebuild name:

app-text/zathura-pdf-mupdf-0.3.1

Description

PDF plug-in for zathura

Added to portage

2017-01-23

zathura-pdf-poppler - 0.2.7
Ebuild name:

app-text/zathura-pdf-poppler-0.2.7

Description

PDF plug-in for zathura

Added to portage

2017-01-23

zathura-ps - 0.2.4
Ebuild name:

app-text/zathura-ps-0.2.4

Description

PostScript plug-in for zathura

Added to portage

2017-01-23

zope-interface - 4.3.3
Ebuild name:

dev-python/zope-interface-4.3.3

Description

Interfaces for Python

Added to portage

2017-01-23

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004 S&P Softwaredesign
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: 7.6 ms
system status display
Stellenangebote