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

Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?

1043


How to find other end of unix socket connection?

520


How do unix sockets work?

494


What's better 6pt or 12pt sockets?

483


Can a socket have multiple ports?

506






How many sockets can a port have?

486


What is a socket address?

528


How many socket connections can a server handle?

475


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

462


Why do I get EPROTO from read()?

1013


What does af mean in sockets?

528


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

1150


What are the types of sockets?

498


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

1165


What is a deep well socket?

528