Advertisement
metalx1000

Alpine Linux Chroot with GUI

May 30th, 2023
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.64 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Create a Alpine Linux Chroot
  4. url="https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-minirootfs-3.18.0-x86_64.tar.gz"
  5. wget "$url" -O alpine.tar.gz
  6. mkdir alpine
  7. cd alpine || exit 1
  8. tar xvf ../alpine.tar.gz
  9.  
  10. sudo mount --bind /dev dev
  11. sudo mount -t devpts devpts dev/pts
  12. sudo mount -t proc proc proc
  13. sudo mount -t sysfs sysfs sys
  14.  
  15. sudo chroot . sh
  16.  
  17. #once in chroot
  18. echo "nameserver 8.8.8.8" > /etc/resolv.conf
  19. apk update
  20. apk add nmap
  21. adduser -D guest
  22. su guest -c sh
  23.  
  24.  
  25. #GUI with Xephyr
  26. #on host machine
  27. Xephyr -resizeable :1
  28.  
  29. #in chroot as root
  30. apk add xfce4
  31. export DISPLAY=:1
  32. xfce4-session
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement