DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Please explain FTP file permissions  (Read 8,235 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Please explain FTP file permissions
« on: January 03, 2011, 01:38 PM »
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"?
Code
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
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

worstje

  • The Gent with the White Hat
  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 589
    • Coding Snacks
    • Participated in NANY Challenge Three Times
Re: Please explain FTP file permissions
« Reply #1 on: January 03, 2011, 01:45 PM »
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,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: Please explain FTP file permissions
« Reply #2 on: January 03, 2011, 01:57 PM »
Interesting.  Thanks!
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: Please explain FTP file permissions
« Reply #3 on: January 03, 2011, 02:16 PM »
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.
Slow Down Music - Where I commit thought crimes...

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

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: Please explain FTP file permissions
« Reply #4 on: January 03, 2011, 11:36 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.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903
« Last Edit: January 03, 2011, 11:37 PM by 4wd »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: Please explain FTP file permissions
« Reply #5 on: January 04, 2011, 12:06 AM »
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?
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

Original address: https://www.donationcoder.com/forum/index.php?topic=25101.0