4 Replies Latest reply on May 17, 2019 1:13 PM by Steve H -Oracle

    Change file permission when ftp

    900039

      Hi

      I a sending a file using ftp script in windows to UNIX server  but I cannot change the file permission when the file is copied in the UNIX server.

       

      The script is as below

       

      open 130.1.8.999

      xxx

      xxxx

      binary

      cd /u01/appl/cbris/att

      lcd C:\Dinesh\att

      put 123.pdf

      chmod 777 123.pdf

      quit

       

      The command chmod 777 123.pdf is not working and displaying "invalid command"

       

      Is there another way to set the permission?

       

      Regards

        • 1. Re: Change file permission when ftp
          Nik

          Hi.

          From which OS you start ftp ?  On linux you can run chmod from ftp.

          List available commands depend from ftp client.  Try use another ftp-client.

          Regards,

          Nik

          • 2. Re: Change file permission when ftp
            900039

            Hi Nik,

             

            I am running the script in windows 8.

             

            Regards,

            Dinesh

            • 3. Re: Change file permission when ftp
              Gaz in Oz

              Set the file permissions properly before ftp'ing.

              chmod is a unix/linux command.

              For a .pdf file, linux/unix 777 privilege looks wrong anyway. 7 denotes read/write/execute and for owner, group, world it would be 777.

              At most a pdf needs read/write which in unix would be 6, so chmod 666 file.pdf would grant read/write to owner, group, world.

              Anyway as said set the appropriate, read/write file permissions in windows on the file BEFORE ftp'ing the file to anywhere.

              Perhaps the file already has the correct permissions so you don't need to try and change them anyway.

              As stated elsewhere, other ftp clients offer file permission functionality in the client itself, filezilla, for example.

              • 4. Re: Change file permission when ftp
                Steve H -Oracle

                Hi,

                Here is some additional info that may help.

                 

                Solaris proftpd.conf has option for umask.

                Files uploaded to a proftpd server will never have the execute permission  enabled by default

                 

                The default in /etc/proftpd.conf is :

                 

                umask   022

                 

                A better option is to use sftp | scp (ssh ) which is more secure and will preserve permissions of the file transferred.