1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FTP permissions

Discussion in 'Suggestions' started by Charles Dye, Jan 4, 2017.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    I'd like a way to set Unix permissions when uploading files via FTP, creating directories, etc.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,032
    Likes Received:
    84
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    That functionality, yes. Syntax can certainly differ -- I'm not hung up on octal.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,032
    Likes Received:
    84
    There's no way to do that in FTP. I'd have to do it with something like SSH, which means (1) knowing the OS the ftp server is running, (2) logging in as root (or at least some kind of admin user), (3) navigating to the appropriate directory, and (4) running the appropriate chmod/attrib/acl/whatever command.

    That's not likely to happen. But feel free to implement it as a plugin!
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    I'm not sure what command Unix servers implement, but supposing it's CHMOD, couldn't you (Charles) cook up something using "IFTP /S" (which uses "QUOTE", I believe) and an alias?

    Code:
    alias ftpchmod `iftp /s chmod ...`
    ????
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,032
    Likes Received:
    84
    Unlikely. /S sends commands to FTP servers, not to the underlying Linux / Windows / whatever server. Unless you know what FTP software the server is running, and that it will pass those commands on to the OS (which would be a really really bad idea if it was a public server!).
     
  7. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Ah. I had ass-u-med that that functionality was exposed by the FTP protocol.
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    It might be ... via the SITE command. I googled a couple examples of "SITE CHMOD ...". As an anonymous user, I don't have access to prospero's SITE command.

    Code:
    v:\> iftp /v anonymous:jpuser@prospero.unm.edu
    Connecting to FTP server.
    Connected.
    220 (vsFTPd 3.0.2)
    USER anonymous
    331 Please specify the password.
    230 Login successful.
    PWD
    257 "/"
    
    v:\> iftp /s help
    help
    214-The following commands are recognized.
     ABOR ACCT ALLO APPE CDUP CWD  DELE EPRT EPSV FEAT HELP LIST MDTM MKD
     MODE NLST NOOP OPTS PASS PASV PORT PWD  QUIT REIN REST RETR RMD  RNFR
     RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD
     XPWD XRMD
    214 Help OK.
    
    v:\> iftp /s site
    site
    550 Permission denied.
    TCC: FTP protocol error: 550 Permission denied. "site"
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    On my server (Windows/Serv-U), when logged in as admin:
    Code:
    ftp> quote help site
    214 Syntax: SITE <sp> subcommand <sp> parameters (issues a server specific FTP command)
    or
    Code:
    v:\> iftp /s help site
    help site
    214 Syntax: SITE <sp> subcommand <sp> parameters (issues a server specific FTP command)
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    Accordind to Serv-U's help, the following are implemented via the SITE command:

    CHMOD, EXEC, HELP (for SITE), INDEX, MSG, PSWD, SET, ZONE

    I don't know how to use CHMOD, but at least one of the site commands works.
    Code:
    v:\> iftp /s site zone
    site zone
    210 UTC-300
     
  11. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    I don't know exactly what it did, but this seems to have worked here (Windows/Serv-U).
    Code:
    v:\> iftp /s site chmod 664 xxx.txt
    site chmod 664 xxx.txt
    253 /E:/Workplace/xxx.txt: Attributes changed okay.
     
  12. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Thank you, Vince. I'll play with it sometime tomorrow, but I suspect that's exactly what I wanted. (Probably doesn't even deserve a plugin; a simple alias would suffice.)
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,071
    Likes Received:
    30
    I hope it works. FWIW, CHMOD seems to be built-into SFTP (client side); at least it is in my PSFTP (Putty) client.
     
  14. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    FileZilla lets you set permissions when using FTP. You right-click a file and select "File permissions..."
     

Share This Page