一个简洁实用的进入 Chroot 环境的脚本

之前在某处看到了这么一份用于进入 Chroot 环境的 Bash 脚本,感觉不错就收藏了。先贴一下原始脚本: 1#!/bin/bash 2 3CHROOT_DIR=$(dirname $(readlink -f $0)) 4 5USAGE=" 6Usage: sh $0 [option] 7 8Warning: This script cannot be used in compile_env 9Options: 10 init init compile_env and mount the required directories 11 no option default to init 12 umount clean up …

Install & Explain SSL Certificates

This is a repost of this answer on Ask Ubuntu, which, primarily showing how to install SSL certificates on CLI, explains as well what happens behind the scene when a certificate verification error occurs1. This work is licensed under the Creative Common Attribute-SharedAlike 3.0 Unported License , as the original post …

Check What Libraries an ELF Depends On

Immediate Dependencies Only 1objdump -x a.out | grep NEEDED # or -p 2 3 NEEDED libstdc++.so.6 4 NEEDED libgcc_s.so.1 5 NEEDED libc.so.6 Alternative: 1readelf -d a.out | grep NEEDED 2 3 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 4 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 5 …

Vim: List All Matching Lines

1. vimgrep (Error List) 1:vimgrep pattern % To open the list of matches in a buffer: 1:copen On the list, navigate normally, and use <Enter> to select a match. 2. lvim (Location List) 1:lvim pattern % To open the list 1:lopen Navigation is similar with vimgrep. 3. Global Search1 1:g/regular-expression/p Note that …

Create a Minimalist `Chroot` Environment

Learnt from this article by Dave McKay . Create the root directory of the chroot environment if it doesn’t exist. 1chr=/home/ricky/testroot 2mkdir -p $chr Create necessary directories and then get into the environment. 1mkdir -p $chr/{bin,lib,lib64} 2cd $chr Copy the binaries we need for surviving on this …