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

What is a socket api?

533


Can a socket have multiple ports?

504


What is socket address with example?

493


Why does the sockets buffer fill up sooner than expected?

997


What is a socket address?

520






What is a sae socket?

514


What is a socket connection?

506


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

1210


Why do we need socket programming?

497


What is af_inet in socket?

475


How is a socket created?

507


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

458


What are the pros/cons of select(), non-blocking I/O and SIGIO?

978


What is sae socket?

438


What is socket address?

570