Jl. Projosumarto II Kab. Tegal
Jawa Tengah, Kode Pos 52193
0812-1788-7688
[email protected]
[email protected]

Chroot Shell / User SSH dengan Jailkit

Chroot atau Change Root pada sistem operasi Unix / Linux adalah sebuah operasi untuk mengubah direktori untuk proses yang sedang berjalan. Sebuah program dapat berjalan tanpa mengubah file sistem dari OS.

Chroot Shell menggunakan jailkit berfungsi untuk membuat user ssh dengan membatasi user untuk mengakses file sistem dan membatasi user dari command-command tertentu.

Download dan Install Jailkit

[[email protected] ~]# cd /usr/local/src/
[[email protected] ~]# wget http://olivier.sessink.nl/jailkit/jailkit-2.17.tar.bz2
[[email protected] ~]# tar -xjvf jailkit-2.17.tar.bz2
[[email protected] ~]# cd jailkit-2.17
[roo[email protected] ~]# ./configure && make && make install

Konfigurasi Jailkit

tambahkan command /usr/bin/id pada file /etc/jailkit/jk_init.ini,

[[email protected] ~]# vim /etc/jailkit/jk_init.ini

sehingga menjadi:

[basicshell]
comment = bash based shell with several basic utilities
paths = /bin/sh, bash, ls, cat, chmod, mkdir, cp, cpio, date, dd, echo, egrep, false, fgrep, grep, gunzip, gzip, ln, ls, mkdir, mktemp, more, mv, pwd, rm, rmdir, sed, sh, sleep, sync, tar, touch, true, uncompress, zcat, /usr/bin/id, /etc/motd, /etc/issue, /etc/bash.bashrc, /etc/bashrc, /etc/profile, /usr/lib/locale/en_US.utf8

Setup dan Membuat Jail User

Sebagai contoh, chroot direktori akan dibuat di /home/chroot

[[email protected] ~]# mkdir /home/chroot/home

Jail user yang akan dibuat diberikan permission perintah basic

[[email protected] ~]# jk_init -v -j /home/chroot/ basicshell editors extendedshell netutils ssh sftp scp

Selanjutnya akan membuat user shell dengan username servindo

[[email protected] ~]# useradd servindo -d /home/chroot/./home/servindo -s /usr/sbin/jk_chrootsh

Perhatikan saat memuat user, direktory /home/chroot/./ dipisahkan dengan tanda /./

Perhatikan user yang telah dibuat pada file /etc/passwd dan /etc/group

kemudian edit file /home/chroot/etc/passswd

[[email protected] ~]# vim /home/chroot/etc/passwd

kemudian tambahkan diakhir baris, misal

servindo:x:500:500::/home/servindo:/bin/bash

edit file /home/chroot/etc/group

[[email protected] ~]# vim /home/chroot/etc/group

kemudian tambahkan diakhir baris, misal

servindo:x:500:

Terakhir, setup password untuk user servindo

[[email protected] ~]# passwd servindo

Silahkan dicoba untuk login ssh menggunakan akun servindo.