Subject: | |
From: | |
Reply To: | |
Date: | Sun, 15 Sep 2013 16:05:37 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi Olaf,
1) There are lots of implementations of the ftp client that support the -p option to preserve permissions and ownership on transferred files. Unfortunately, HP-UX's (which I assume you are using) does not. If you're willing to go OpenSource, there's Yafc which does (http://yafc.sourceforge.net).
2) That said, you *can* use the chmod and/or umask commands in ftp to explicitly set the permissions of any/all files that you put on a remote system. If all the files need the same values, you can chmod or umask once, followed by the mput and all the files will get the same value. For example:
chmod 444
mput *
results in all remote files having permissions 444
3) For multiple source with differing permissions, you can create a ftp dialogue snippet to issue the commands dynamically (here's a quick-and-dirty version):
perl -le 'printf "chmod %o\nput %s\n",07777 & (stat)[2],$_ for @ARGV' filespec
(where filespec is the list of files you want to process - if you don't include filespec, it will default to *). Let's use a sample filespec of m* (files starting with m). With my current directory:
ll m*
-rwxr-xr-x 1 rgoldman mpe 155 Feb 8 2013 ms
-rwxrwxrwx 1 rgoldman mpe 100 Jul 19 09:56 mt
-rwx------ 1 rgoldman mpe 772 Jun 17 01:55 mu
-rw-r----- 1 rgoldman mpe 393 Jun 18 01:17 mut
-rw-r----- 1 rgoldman mpe 382 Jul 26 03:54 mvt
I run the command against this set of files and get as output:
perl -le 'printf "chmod %o\nput %s\n",07777 & (stat)[2],$_ for @ARGV' m*
chmod 755
put ms
chmod 777
put mt
chmod 700
put mu
chmod 640
put mut
chmod 640
put mvt
Just take the results and include it into your ftp command dialogue.
3) Instead of using ftp, use scp or sftp which DO support the -p option and are much more secure.
Hope this helps.
Ric Goldman
Spellbinder Systems Group
>Date: Fri, 13 Sep 2013 09:13:13 -0400
>From: Olav Kappert <[log in to unmask]>
>Subject: Unix permissions retained through FTP
>
>I know that this forum is for MPE but most of us have had some experience using Unix.
>
>I am using FTP to copy a file from one unix box to another. The target file does not have the same permissions as the source.
>
>Does anyone know how to get the same permissions attached to the source file ?
>
>Remember that multiple files can be transferred through 'mput' so any solution needs to be applied to all the files transferred.
>
>Olav.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|