Page 1 of 1
chroot umgebung für user...
Posted: 2003-08-01 21:14
by mixus
Hi,
habe auf einem Testserver [debian] eine chroot Umgebung gebastelt für einige User.
Das einzige Problem, ein Fehler beim einloggen:
/usr/sbin/chroot: cannot execute /bin/su: No such file or directory
Habe natürlich su direkt in die chroot umgebung kompiliert!
Hat jemand ne Idee??
MfG und Danke
miXus
Re: chroot umgebung für user...
Posted: 2003-08-01 22:53
by captaincrunch
Schau mal hier :
http://www.tjw.org/chroot-login-HOWTO/ , besonders den Abschnitt über die neue Login-Shell für die User (bzw. das genannte Shellscript).
Re: chroot umgebung für user...
Posted: 2003-08-02 14:04
by mixus
genau nach der Anleitung habe ich es gemacht....
Der Fehler ist das Resultat!.
MfG
miXus
Re: chroot umgebung für user...
Posted: 2003-08-02 16:13
by captaincrunch
Habe natürlich su direkt in die chroot umgebung kompiliert!
Hat jemand ne Idee??
In dem Fall lieht das binary wohl kaum unter /bin ...
Re: chroot umgebung für user...
Posted: 2003-08-02 16:53
by mixus
doch liegt alles da wo es hin sollte:
arbitrary:/# find / -name su
/usr/local/src/sh-utils-2.0.15/src/su
/etc/pam.d/su
/bin/su
/home/testuser/bin/su
...andere Idee??
MfG
miXus
Re: chroot umgebung für user...
Posted: 2003-08-02 16:56
by captaincrunch
Was sagen :
ls -l /home/testuser/bin
und
strace chroot /home/testuser /bin/su - testuser
?
Re: chroot umgebung für user...
Posted: 2003-08-02 17:00
by mixus
arbitrary:/# ls -l /home/testuser/bin
total 1052
-rwxr-xr-x 1 root root 10908 Aug 1 23:03 basename
-rwxr-xr-x 1 root root 511400 Aug 1 22:45 bash
-rwxr-xr-x 1 root root 11128 Aug 1 23:03 chroot
-rwxr-xr-x 1 root root 35892 Aug 1 23:03 date
-rwxr-xr-x 1 root root 11296 Aug 1 23:03 dirname
-rwxr-xr-x 1 root root 12120 Aug 1 23:03 echo
-rwxr-xr-x 1 root root 11284 Aug 1 23:03 env
-rwxr-xr-x 1 root root 20204 Aug 1 23:03 expr
-rwxr-xr-x 1 root root 23648 Aug 1 23:03 factor
-rwxr-xr-x 1 root root 10548 Aug 1 23:03 false
-rwxr-xr-x 1 root root 1685 Aug 1 23:03 groups
-rwxr-xr-x 1 root root 10616 Aug 1 23:03 hostid
-rwxr-xr-x 1 root root 10940 Aug 1 23:03 hostname
-rwxr-xr-x 1 root root 14776 Aug 1 23:03 id
-rwxr-xr-x 1 root root 15260 Aug 1 23:03 kill
-rwxr-xr-x 1 root root 10648 Aug 1 23:03 logname
-rwxr-xr-x 1 root root 13280 Aug 1 23:03 nice
-rwxr-xr-x 1 root root 2131 Aug 1 23:03 nohup
-rwxr-xr-x 1 root root 12572 Aug 1 23:03 pathchk
-rwxr-xr-x 1 root root 16412 Aug 1 23:03 pinky
-rwxr-xr-x 1 root root 10840 Aug 1 23:03 printenv
-rwxr-xr-x 1 root root 18112 Aug 1 23:03 printf
-rwxr-xr-x 1 root root 10684 Aug 1 23:03 pwd
-rwxr-xr-x 1 root root 14744 Aug 1 23:03 seq
-rwxr-xr-x 1 root root 12188 Aug 1 23:03 sleep
-rwxr-xr-x 1 root root 33500 Aug 1 23:03 stty
-rwxr-xr-x 1 root root 14776 Aug 1 23:03 su
-rwxr-xr-x 1 root root 11764 Aug 1 23:03 tee
-rwxr-xr-x 1 root root 22072 Aug 1 23:03 test
-rwxr-xr-x 1 root root 10548 Aug 1 23:03 true
-rwxr-xr-x 1 root root 10708 Aug 1 23:03 tty
-rwxr-xr-x 1 root root 11700 Aug 1 23:03 uname
-rwxr-xr-x 1 root root 13116 Aug 1 23:03 uptime
-rwxr-xr-x 1 root root 11900 Aug 1 23:03 users
-rwxr-xr-x 1 root root 17916 Aug 1 23:03 who
-rwxr-xr-x 1 root root 10808 Aug 1 23:03 whoami
-rwxr-xr-x 1 root root 10808 Aug 1 23:03 yes
arbitrary:/# strace chroot /home/testuser /bin/su - testuser
execve("/usr/sbin/chroot", ["chroot", "/home/testuser", "/bin/su", "-", "testuser"], [/* 14 vars */]) = 0
uname({sys="Linux", node="arbitrary", ...}) = 0
brk(0) = 0x804b444
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=11163, ...}) = 0
old_mmap(NULL, 11163, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "177ELF11133130222"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1153784, ...}) = 0
old_mmap(NULL, 1166560, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40017000
mprotect(0x4012a000, 40160, PROT_NONE) = 0
old_mmap(0x4012a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x113000) = 0x4012a000
old_mmap(0x40130000, 15584, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40130000
close(3) = 0
munmap(0x40014000, 11163) = 0
brk(0) = 0x804b444
brk(0x804b46c) = 0x804b46c
brk(0x804c000) = 0x804c000
chroot("/home/testuser") = 0
chdir("/") = 0
execve("/bin/su", ["/bin/su", "-", "testuser"], [/* 14 vars */]) = -1 ENOENT (No such file or directory)
write(2, "chroot: ", 8chroot: ) = 8
write(2, "cannot execute /bin/su", 22cannot execute /bin/su) = 22
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "n", 1
) = 1
_exit(1)
Re: chroot umgebung für user...
Posted: 2003-08-02 17:02
by captaincrunch
Was passiert denn, wenn du als root mal einfach ein chroot /home/testuser machst, und dann mal ein su - testuser ?
Re: chroot umgebung für user...
Posted: 2003-08-02 17:04
by mixus
arbitrary:/# chroot /home/testuser
chroot: cannot execute /bin/bash: No such file or directory
arbitrary:/# su - testuser
/usr/sbin/chroot: cannot execute /bin/su: No such file or directory
arbitrary:/#
...irgend was stimmt da nicht...
Re: chroot umgebung für user...
Posted: 2003-08-02 17:07
by captaincrunch
Anscheinend. Ich würd noch mal von vorne anfangen, ist wohl einfacher (und vor allem schneller) als den Fehler jetzt zu suchen.
Re: chroot umgebung für user...
Posted: 2003-08-02 17:27
by mixus
jetzt schauts so aus, ich habe su nicht neu kompiliert sondern direkt kopiert incl. libs.
login as: testuser
testuser@www.arbitrary.de's password:
Linux arbitrary 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 unknown
Most of the programs included with the Debian GNU/Linux system are
freely redistributable; the exact distribution terms for each program
are described in the individual files in /usr/share/doc/*/copyright
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Aug 2 19:25:40 2003 from XXXXXXXX
Sorry.
Re: chroot umgebung für user...
Posted: 2003-08-02 18:44
by captaincrunch
Das "Sorry" am Ende lässt aber irgendwie darauf schließen, dass das abschließende" su fehlschlägt, oder klappt's jetzt ?
Re: chroot umgebung für user...
Posted: 2003-08-02 18:50
by mixus
nö
Re: chroot umgebung für user...
Posted: 2003-08-02 19:02
by mixus
hab ne andere möglchkleit gefunden, klappt alles wunderbar :)
werde in den nächsten Tagen berichten...jetzt ist Wochendende..
MfG
miXus
Re: chroot umgebung für user...
Posted: 2003-12-26 12:26
by eagle2k
ich habe auch das problem. wie hast du es denn gelöst? wäre interessant zu wissen