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

How come I get address already in use from bind()?

1 Answers  


How can I read only one character at a time?

1 Answers  


How does unix socket work?

0 Answers  


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

0 Answers  


When should I use shutdown()?

1 Answers   Wipro,






How can I put a timeout on connect()?

1 Answers  


Why sockets are used?

0 Answers  


Are unix sockets faster than tcp?

0 Answers  


How come select says there is data, but read returns zero?

1 Answers  


system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?

0 Answers  


What's better 6pt or 12pt sockets?

0 Answers  


When will my application receive SIGPIPE?

1 Answers  


Categories