After the chroot(), calls to socket() are failing. Why?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can multiple sockets use the same port?

636


What's the difference between impact sockets and regular sockets?

612


Is socket a hardware or software?

669


What pieces of information make up a socket?

723


What is af_inet in socket?

622


Can multiple clients connect to same socket?

647


What is difference between socket () and serversocket () class?

627


How are unix domain sockets implemented?

632


What is sae socket?

595


How many sockets can a port have?

643


Are unix sockets faster than tcp?

639


Whats the difference between select() and poll()?

1371


Is tcp or unix socket faster?

616


What's the difference between a socket and a port?

608


What is socket address with example?

639