Sorry if that was a repeated question! all my search results leads to 'SSH' results...

I'm asking about FTP, How can I recursively change mode from FTP using the terminal?

Again: I'm using FTP, not SSH or SFTP, so, I guess these are the only option which I have:

ftp> ?
Commands may be abbreviated.  Commands are:

!           dir         mdelete     qc          site
$           disconnect  mdir         sendport    size
account     exit        mget        put         status
append      form        mkdir       pwd         struct
ascii       get         mls         quit        system
bell        glob        mode        quote       sunique
binary      hash        modtime     recv        tenex
bye         help        mput        reget       tick
case        idle        newer       rstatus     trace
cd          image       nmap        rhelp       type
cdup        ipany       nlist       rename      user
chmod       ipv4        ntrans      reset       umask
close       ipv6        open        restart     verbose
cr          lcd         prompt      rmdir       ?
delete      ls          passive     runique
debug       macdef      proxy       send

I don't have find, so when I tried:

ftp> find

I got:

?Invalid command

When tried:

ftp> chmod 755 $(find /path/to/dir -type d)


550 Could not change perms on $(find: No such file or directory

And I didn't get enough info from help when I tried:

ftp> help chmod

It gives me only:

chmod       change file permissions of remote file

So, how can I recursively do a search for folders/files only to chmod them?

Something like:

chmod 755 $(find /path/to/base/dir -type d)

chmod 644 $(find /path/to/base/dir -type f)

But from FTP ?


This would be much easier with a proper shell.

A standard FTP server won't let you chmod at all. All SITE commands, SITE CHMOD included, are non-standard extensions. So your FTP server might support recursion. It probably doesn't. You'll only find out by figuring out what server it is you're connecting to and then reading its documentation.

However as a workaround, you could just use a client that allowed you to select multiple files and perform batch operations on them. It isn't recursion but it's like recursion.

I'm thinking clients like Filezilla. Select all your files, right click them and go to properties and change all their permissions at once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.