
그래서 나는 chroot를 사용하여 데비안 부트스트랩으로 chrooting하고 있습니다. 새로운 사용자를 추가하여 xdisplay 또는 localhost ip를 업데이트하거나 액세스할 수 없다는 것을 알아내기 전까지는 모든 것이 루트 계정에서 제대로 작동했습니다. 이상하게도 무엇을 해야할지 몰랐습니다. 도움을 요청합니다. 제가 사용하고 있는 chroot 스크립트입니다.
~ $ cat chroot.sh
sudo mount -t proc /proc chroot-ubuntu/proc
sudo mount --rbind /sys chroot-ubuntu/sys
sudo mount --rbind /dev chroot-ubuntu/dev
sudo mount /system/ chroot-ubuntu/system/
unset LD_PRELOAD
env -i HOME=/root \
PATH="/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games:/opt/wine-5.3/bin/:/opt/wine-staging/bin/" \
TERM="xterm" \
BASH="/usr/bin/bash" \
SHELL="/usr/bin/bash" \
PREFIX="/usr" \
MDIR="/tmp" \
LD_LIBRARY_PATH="/lib:/usr/lib:/usr/lib/i386-linux-gnu/:/var/lib:/var/lib/dpkg/:/lib/i386-linux-gnu:/usr/local/lib:/opt/wine-stable/lib:/opt/wine-stable/lib/wine:/opt/wine-5.3/lib:/lib:/lib/wine:/lib/wine/fakedlls:/opt/wine-staging/lib" \
chroot chroot-ubuntu/ /bin/bash
나는 sudo를 사용하여 chroot.sh를 실행하므로 항상 루트 계정에 새 사용자를 추가할 수 있습니다. 이상한 결과가 나타납니다.
root@localhost:~# adduser g
Adding user `g' ...
Adding new group `g' (1000) ...
Adding new user `g' (1000) with group `g' ...
Creating home directory `/home/g' ...
Copying files from `/etc/skel' ...
passwd: user 'g' does not exist
Permission denied
Try again? [y/N]
새 사용자에게 비밀번호를 추가하려고 하면 다음과 같은 메시지가 표시됩니다.
root@localhost:~# passwd g
passwd: user 'g' does not exist
그래서 사용자를 수동으로 추가해야 했고 제가 그랬어요(어떻게 했는지 기억이 안 나네요)
다음은 루트 및 사용자에 대한 ifconfig 출력입니다.
root@localhost:~# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
사용자가 ifcnfig를 수행할 때 inet 127.0.0.1이 없다는 점에 유의하세요.
spiral@localhost:~$ /sbin/ifconfig
warning: no inet socket available: No such file or directory`
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet6 ::1 prefixlen 128 scopeid 0x10<host>
warning: no inet socket available: No such file or directory
대신에 오류 가 있어요
답변1
여기에 출력이 있습니다
spiral@localhost:~$ strace ifconfig 2>&1 |grep ENOENT
proot warning: ptrace request 'PTRACE_???' not supported yet
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ax25", R_OK) = -1 ENOENT (No such file or directory) faccessat(AT_FDCWD, "/proc/net/nr", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/rose", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ipx", R_OK) = -1 ENOENT (No such file or directory) faccessat(AT_FDCWD, "/proc/net/appletalk", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/econet", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/ash", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/x25", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ax25", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/nr", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/rose", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ipx", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/appletalk", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/econet", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/ash", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/x25", R_OK) = -1 ENOENT (No such file or directory)
spiral@localhost:~$