This discussion is archived
5 Replies Latest reply: Aug 9, 2012 2:37 PM by Dude! RSS

ftp quote commnand

EdStevens Guru
Currently Being Moderated
OL 5.6 x86-64

Running a cmd file on a Windows server, doing an ftp file transfer to the Linux box. The mput works fine, but we also need to change the permissions on the files once they are on the linux box. Right now the apps people have come up with a clumsy method of running the .cmd file to ftp the files to the linux box, then a job on the linux box does the chmod, then a procedure in the Oracle database processes the files, including a rename of them to get them out of the way for the next run. The coordination of all this is dependent on 3 different job scheduling mechanisms on two different servers, and the entire cycle is repeated every 10 minutes. Obviously a very good chance of the sequence not coming out right if something takes a little longer than expected, or the clocks between the two servers aren't in synch.

I'd like to at least get the ftp and chmod into a single job and thougth it would be simple to add a 'quote chmod ...' command to the ftp script. However, it keeps rejecting with 'Unknown command'. Trying it out interactively it looks like this:
C:\temp\upload>ftp myserver
Connected to myserver.myorganization.org.
220 (vsFTPd 2.0.5)
User (myserver.myorganization.org:(none)): estevens
331 Please specify the password.
Password:
230 Login successful.
ftp> pwd
257 "/home/estevens"
ftp> cd upload
250 Directory successfully changed.
ftp> pwd
257 "/home/estevens/upload"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
test1.lis
testit
upltst1.txt
upltst2.txt
upltst3.txt
upltst4.txt
226 Directory send OK.
ftp: 71 bytes received in 0.00Seconds 71000.00Kbytes/sec.
ftp> quote chmod 777 upl*.txt
500 Unknown command.
ftp> quote chmod 777 upltst1.txt
500 Unknown command.
Have I just got the syntax of the quote command wrong, or am I looking at something configured with ftp on one end or the other? I don't have access to look at vsftpd.conf and the SA is out on vacation, but I really dont' think that's it.

yeah, I've read the man page for ftp, and at least a couple of dozen web pages that ended up really shedding no light ... just someone's restatement of the man page.

Just looking for some comments on somthing I'm not seeing or haven't considered.
  • 1. Re: ftp quote commnand
    sabre150 Expert
    Currently Being Moderated
    Have you considered using ssh and scp (both part of OpenSSH) rather than ftp? You can use scp to securely copy the files from your client to the server (ftp is not secure) and ssh to securely change the permissions if you need to change them.
  • 2. Re: ftp quote commnand
    EdStevens Guru
    Currently Being Moderated
    sabre150 wrote:
    Have you considered using ssh and scp (both part of OpenSSH) rather than ftp? You can use scp to securely copy the files from your client to the server (ftp is not secure) and ssh to securely change the permissions if you need to change them.
    Obsolutely. In fact, ssh was and still is my first choice, but if we run into resistance (don't ask ...) I was looking for something that could be done without haveing to get the SA involved to do any more configuration (gen the keys, place them in secured directories, etc). Everthing I've seen says the 'quote' command should work.
  • 3. Re: ftp quote commnand
    Dude! Guru
    Currently Being Moderated
    The FTP quote command sends a command to the remote FTP server, not the remote operating system. What you are most likely experiencing is that the remote FTP server does not understand the chmod command.

    You can see what the remote FTP server understands by typing quote help.

    To solve your problem, you may have to edit /etc/vsftpd/vsftpd.conf on FTP server and set
    chmod_enable=YES
  • 4. Re: ftp quote commnand
    EdStevens Guru
    Currently Being Moderated
    Dude wrote:
    The FTP quote command sends a command to the remote FTP server, not the remote operating system. What you are most likely experiencing is that the remote FTP server does not understand the chmod command.

    You can see what the remote FTP server understands by typing quote help.
    And so it does. I had been using "help quote" or "? quote", which just told me what quote does . Duh! The result of "quote help" explains the mixed results I was seeing.
    >
    To solve your problem, you may have to edit /etc/vsftpd/vsftpd.conf on FTP server and set
    chmod_enable=YES
    Yep, I'd gone as far down that road as I could, but I don't have root access to even see how it is configure.

    I sent the interested parties another email urging them to set up the key-pairs and use ssh (also threw in a suggestion they use sftp as well), but also had to mention that this is really outside of my lane as a dba - I was just trying to bring some extra experience to a situation that I was just tangentially involved in.

    Thanks again. Everything I get here goes into my toolkit.
  • 5. Re: ftp quote commnand
    Dude! Guru
    Currently Being Moderated
    If I remember correctly, SFTP does not support scripting the password. You can however use cURL, which can. e.g.: curl -u name:passwd

    You can downlod cURL for various platforms from http://curl.haxx.se/download.html

    cURL can do a lot of things over ssh. Perhaps the below link will be useful. It also covers how to setup ssh/sftp login without password.

    Oracle Linux 5 Howto: Installing and using cURL with support for SCP and SFTP
    OL5 Howto: Installing and using cURL with support for SCP and SFTP

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points