Other Software > Developer's Corner
Please explain FTP file permissions
kyrathaba:
I'm working on a class I've named clsFTPclient.cs. One of the methods returns detailed directory information. Below is some sample output that I get when I use the method to return details about the root directory of a website I manage for our church.
I'm getting these details using...
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
in conjunction with...
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Now, I understand that the date portion of each line tells the last modified/accessed date/time for a given subdirectory. And I know that the last portion of each line indicates the name of the subdirectory. I also know that the initial letter "d" indicates it's a directory, not a file. I think the rwxr stuff has to do with reading/writing permissions. What about the hyphens? What does "psaserv" indicate? And what is the significance of "4096"?
--- ---drwxr-x--- 5 kyrathaba psaserv 4096 Mar 15 2009 anon_ftp
drwxr-xr-x 2 root psaserv 4096 Mar 15 2009 bin
drwxr-x--- 3 kyrathaba psaserv 4096 Mar 15 2009 cgi-bin
drwxr-x--- 2 root psaserv 4096 Nov 4 19:28 conf
drwxr-xr-x 2 root psaserv 4096 Mar 15 2009 error_docs
drwxr-x--- 13 kyrathaba psaserv 4096 Jan 1 22:39 httpdocs
drwxr-x--- 7 kyrathaba psaserv 4096 Mar 15 2009 httpsdocs
drwxrwx--- 2 apache psacln 4096 Mar 15 2009 mivadata
drwxr-x--- 2 root psaserv 4096 Mar 15 2009 pd
drwx------ 2 kyrathaba root 4096 Mar 15 2009 private
dr-xr-x--- 7 root psaserv 4096 Mar 15 2009 statistics
drwxr-xr-x 2 root psaserv 4096 Mar 21 2009 subdomains
drwxr-xr-x 3 root psacln 4096 Mar 16 2009 vault_scripts
drwxr-xr-x 2 root psaserv 4096 Mar 15 2009 web_users
worstje:
I can't help you with the 4096, but I should be able to help you out with the rest.
Let's split cut off the d and then split up drwxr-x--- into three groups.
rwx: The first three letters define the permissions given to the OWNER of the file. Read, Write, eXecute.
r-x: The second three letters define the permissions given to the GROUP the file belongs to. Read, no Write, eXecute.
---: The last three letters define the permissions given to everybody else. No Read, no Write, no eXecute.
psaserv is the group the files are assigned and alluded to above, just like root, kyrathaba and apache are the owners of the various files.
kyrathaba:
Interesting. Thanks!
Renegade:
They're standard UNIX file permissions. Search for that and NTFS files permissions and things should clear up.
This might help as it's visual:
http://www.copyandwaste.com/2007/12/25/parsing-webrequestmethodsftplistdirectorydetails-and-listdirectory/
And once again, MSDN turns up a big turd:
http://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp.listdirectorydetails.aspx
They're probably server specific, so check that avenue.
4wd:
Regarding the 4096, here's the answer from the superuser site: Why is the size of a directory always 4096 bytes in unix?
But note in the comments that it is filesystem dependent, ReiserFS apparently reports the directory content size.
Navigation
[0] Message Index
[#] Next page
Go to full version