After the chroot(), calls to socket() are failing. Why?
Answer / chaitanya
On systems where sockets are implemented on top of Streams (e.g. all SysV-based systems, presumably including Solaris), the socket() function will actually be opening certain special files in /dev. You will need to create a /dev directory under your fake root and populate it with the required device nodes (only).
Your system documentation may or may not specify exactly which device nodes are required; suggested checking the man page for ftpd, which should list the files you need to copy and devices you need to create in the chroot'd environment.)
A less-obvious issue with chroot() is if you call syslog(), as many daemons do; syslog() opens (depending on the system) either a UDP socket, a FIFO or a Unix-domain socket. So if you use it after a chroot() call, make sure that you call openlog() *before* the chroot.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can I be sure that UDP messages are received in order?
Whats the difference between select() and poll()?
When should I use UDP instead of TCP?
How do I use TCP_NODELAY?
How can I put a timeout on connect()?
Why do not my sockets close?
How does a socket work?
How can my client work through a firewall/proxy server?
Why do I keep getting EINTR from the socket calls?
Is a socket a file?
How can I tell when a socket is closed on the other end?
How can I find the full hostname (FQDN) of the system I am running on?