[35]Actually, POSIX does have the same feature under a different name, but it isn't always present, either.To aid in portability, SSH1 and SSH2 use the reliably available setuid system call. The first time they need to access a file as a regular user, they start a subprocess. The subprocess calls setuid to change (irrevocably) to the desired uid, but the main SSH program continues running as root. Then, whenever SSH needs file access as that user, the main program sends a message to the subprocess, asking it to perform the needed operation and return the results. Internally, this facility is called the userfile module. Keep this behavior in mind when debugging an SSH process with SunOS trace, Solaris truss, Linux strace, or another process tracer. By default, these programs trace only the topmost process, so always remember to trace subprocesses as well. (See the tracer's manpage for the appropriate option, though it is usually -f. ) If you forget to do this, and the problem is with file access, you might not see it, since the userfile subprocess performs the file-access system calls (open, read, write, stat, etc.).
3.5. Inside SSH-2 | 3.7. Randomness |
Copyright © 2002 O'Reilly & Associates. All rights reserved.