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



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

Post New Answer

More Unix Socket Programming Interview Questions

What exactly does SO_LINGER do?

1 Answers  


What is active unix domain sockets?

0 Answers  


Why does it take so long to detect that the peer died?

0 Answers  


How can I bind() to a port number < 1024?

1 Answers  


What is a sae socket?

0 Answers  






What is with the second parameter in bind()?

1 Answers  


Is socket a hardware or software?

0 Answers  


What is sae socket?

0 Answers  


What are raw sockets?

4 Answers   Axis Technologies,


How would I put my socket in non-blocking mode?

1 Answers  


What is Mac, and how is it different from PC? Which one is better for professional users, and why

1 Answers   Evolving Systems, IBM,


What is the purpose of socket?

0 Answers  


Categories