artikel:charoot-debian-12

This is an old revision of the document!


CHAROOT Membatasi akses SSH user di Debian 12

Berikut ini adalah cara membuat chroot di debian 12 untuk membatasi akses user

sudo apt update
sudo apt install debootstrap

Membuat direktori chroot

sudo mkdir -p /srv/chroot/debian

Membangun chroot

sudo debootstrap bookworm /srv/chroot/debian http://deb.debian.org/debian/
sudo mount -t proc proc /srv/chroot/debian/proc
sudo mount -t sysfs sys /srv/chroot/debian/sys
sudo mount -t devtmpfs dev /srv/chroot/debian/dev

Test login ke chroot

sudo chroot /srv/chroot/debian /bin/bash

Setting user sshd_config

nano /etc/ssh/sshd_config

tambahkan

Allowusers root
AllowUsers userku

Match User userku
  ChrootDirectory /srv/chroot/debian
  X11Forwarding no
  AllowTcpForwarding no

selamat mencoba

Error I have no name@server

jika ada error I have no name!@bk5:~$ maka solusinya adalah

sudo cp /etc/passwd /srv/chroot/debian/etc/
sudo cp /etc/group /srv/chroot/debian/etc/
sudo cp /etc/nsswitch.conf /srv/chroot/debian/etc/

kemdudian coba login kembali sebagai user

Permission Denied

Jika user login permission denied maka solusinya adalah

chown user:user /srv/chroot/debian/home/user

selesai

  • artikel/charoot-debian-12.1769917030.txt.gz
  • Last modified: 2026/02/01 11:37
  • by srvdoc