Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 12:24:29 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Please explain FTP file permissions  (Read 3223 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Please explain FTP file permissions
« on: January 03, 2011, 07:38:48 AM »
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

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 571
  • The Gent with the White Hat
    • View Profile
    • Donate to Member
Re: Please explain FTP file permissions
« Reply #1 on: January 03, 2011, 07:45:01 AM »
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

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Re: Please explain FTP file permissions
« Reply #2 on: January 03, 2011, 07:57:31 AM »
Interesting.  Thanks!

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,220
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Please explain FTP file permissions
« Reply #3 on: January 03, 2011, 08:16:20 AM »
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.copyandwa...s-and-listdirectory/

And once again, MSDN turns up a big turd:

http://msdn.microsof...irectorydetails.aspx

They're probably server specific, so check that avenue.
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,473
    • View Profile
    • Donate to Member
Re: Please explain FTP file permissions
« Reply #4 on: January 03, 2011, 05:36:08 PM »
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.
« Last Edit: January 03, 2011, 05:37:52 PM by 4wd »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Re: Please explain FTP file permissions
« Reply #5 on: January 03, 2011, 06:06:09 PM »
Thanks 4wd.

It appears that, in most cases, it will show 4096, as most servers you'd be FTPing to would be running a Unix shell, right?