BigAdmin System Administration Portal
Community Submitted Article
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

Using DTrace With a Problem Uploading Files via FTP

Derek Crudgington, May 2006

I was having a problem trying to upload something via FTP through a web application, and it wasn't uploading for some reason. The FTP daemon was receiving the commands, but the file wasn't showing up in the directory.

Here's the FTP log of the session I was trying to upload:

Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 165209 daemon.info] USER pinnftp
Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 125383 daemon.info] PASS password
Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 201503 daemon.info] CWD /
Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 313182 daemon.info] PORT
Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 307055 daemon.info] TYPE Image
Oct 27 14:54:26 callacctweb ftpd[25157]: [ID 206289 daemon.info] STOR logo-left.jpg

Nothing looks suspicious here, and even to test if it was a permission error I went ahead and made the ftp directory +w by everyone. Still, I kept getting the same stuff, with no file showing up in the directory.

I decided to use DTrace to investigate. (Note: Dynamic Tracing or DTrace is a new feature in the Solaris 10 OS that is used to better understand the system and programs run on the system.) I ran the DTrace script opensnoop (as I tell the web app to upload the file):

What we are looking for here is all of the -1< FD values. This indicates there was an error somewhere. Looking at all of them, only one really sticks out, and it is the name of the image I was trying to upload, logo-left.jpg.

It has an error number of 13. Let's see what this means:

root@callacct:~/DTraceToolkit-0.83# grep 13 /usr/include/sys/errno.h
#define EACCES  13      /* Permission denied                    */
#define ECONNABORTED    130     /* Software caused connection abort */
#define ECONNRESET      131     /* Connection reset by peer */
#define ENOBUFS         132     /* No buffer space available */
#define EISCONN         133     /* Socket is already connected */
#define ENOTCONN        134     /* Socket is not connected */
/* XENIX has 135 - 142 */

It is showing that I'm getting a permission denied. This makes more sense if you look at the FTP log above: It shows it issuing CWD / then trying to upload a file, which means it's changing to the root (/) directory first then uploading the file and failing with the permission denied. The root directory doesn't have permission to let anyone upload there and the FTP web app shouldn't be issuing a cd / and then trying to upload the file unless maybe it wants the FTP daemon to run chroot'ed.

At first I overlooked the FTP application sending the CWD / command, and I didn't see this. Using DTrace, I was able to actually see this by looking at what was going on in the system, which then verified there was a permission error.


About the Author

Derek Crudgington can be reached at dacrud@gmail.com, or see his web site at: http://hell.jedicoder.net.

 


The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource.

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
BigAdmin
  
 
 
 
Would you recommend this Sun site to a friend or colleague?
Contact About Sun News & Events Employment Site Map Privacy Terms of Use Trademarks Copyright Sun Microsystems, Inc.