Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hello,
I read a text about 'chroot', now I wanted to try it, with "chroot /home/user", but I got that /bin/bash couldn't be found, I read that /bin/(ba)sh is default, when you do not type in your Command.
Everything was executed as root, can you help me ?
I want to "create" a jail, for testing. I know that it is no real security, but I just wanted to test it.
A chroot makes any dir you mention the "root" for apps operating in a chroot. They can't see outside of it, so if any libs, devices and files are needed you need to put 'em in the chrooted directory. Library dependancies you can figure out by using "ldd" on apps. Devices and files you can figure out by using "strace" on an app. Make sure you don't provide access to /proc devices (kmem anyone?), suid apps it doesn't really need and provide only stripped down versions of /etc/passwd where needed.
Patching your kernel with the GRSecurity patch assures for instance a "chdir" has been done before the actual "chroot", plus it features some more chroot stuff.
thanks, I'm reading some of the texts.
So, my command typed in is/was nonsense , as only the programs are in "jail" ???
Is it right that f.e. ftp uses chroot() to prevent the user logging in, from "having a look" on the whole system ?
Is it right that f.e. ftp uses chroot() to prevent the user logging in, from "having a look" on the whole system ?
Yes, but some ftpd's are more vulnerable than others in their implementation of chroot, due to either spaghetti code or some trade-off between functionality (f.i. following symlinks outside a chroot, administrators w/o chroot) and security.
Have a look at the changes/docs/code for Vsftpd, Muddleftpd (and Proftpd IIRC) for instance, they are considered quite secure.
thank you very much,
just to make sure that i understood it right , was my first statement (So, my command typed in is/was nonsense , as only the programs are in "jail" ???) right ?
#!/bin/bash
# mkchrootStupidExample.sh
# Our basedir is /var/jail/test,
# we gonna create some subdirs we need:
for d in /bin /etc /lib/i686; do echo "mkdir -p /var/jail/test$d"; done
# Since we're in examplemode let's just copy in bash,
# get the deps from doing "ldd /bin/bash" and
# an idea of files it opens by doing
# "strace -qf -eopen -o /tmp/strace.log /bin/bash"
cp /bin/bash /var/jail/test/bin
for f in /lib/libtermcap.so.2 /lib/libdl.so.2 /lib/ld-linux.so.2; do cp $f /var/jail/test/lib; done
cp /lib/i686/libc.so.6 /var/jail/test/lib/i686
cp /etc/profile /var/jail/test/etc
chroot /var/jail/test #done
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.