SUMMARY: changing file modes with ftp client

From: Karl Amrhein (ksa@ucolick.org)
Date: Fri Dec 05 1997 - 12:43:45 CST


Thanks for all the quick responses:

Drexx Laggui <drexx@pspi.com.ph>
David Thorburn-Gundlach <david@bae.uga.edu>
Jafar Shameem <Jafar.Shameem@East.Sun.COM>
Christophe Colle <christophe.colle@telenet.be>
Steve Allen <sla@ucolick.org>
Brian Sherwood <sherwood@alux4.micro.lucent.com>

My question:
>
> Is it possible use an ftp client to change the mode of a remote file?
>

To clarify: I was not interested in changing the default file creation mode
(the umask) of the client-side ftpd. Instead, I was just intersted in
changing the mode of a few files--adding execute permissions on some, taking
away write permission on some directories, adding write permissions on some
files, etc.

I found out that the ftp client on our DEC OSF/1 V3.2 machines had an
option 'site chmod' which did just what I wanted:

  ftp> site help
  214-The following SITE commands are recognized (* =>'s unimplemented).
     UMASK CHMOD GROUP NEWER INDEX ALIAS GROUPS
     IDLE HELP GPASS MINFO EXEC CDPATH

I did not find this 'site' option on our SunOS 4.x or Solaris 2.x machines:

  ftp> site help
  ?Invalid command

Thanks again,

-- 
        Karl Amrhein
        ksa@ucolick.org

Responses follow:

======================

I wish it were. You probably want to do that because all files you drop in place (or directories you make) are world-writable, right? That's because the in.ftpd is run by a process which has no umask (I forget how it all gets kicked off, but I think that this has appeared before as a summay...). You can set the umask in a /etc/rc?.d/S00umask.sh script (the .sh means that it will get sourced by the calling shell and thus passed on to following shells) so that this isn't a problem...

David Thorburn-Gundlach

====================

The file permission modes of the ftp-downloaded files are inherited from the umask setting of the client-side user. So yes, the file modes can be changed that way. Not unless you wanna use the -p option of FTP.

Hope this helps,

Drexx Laggui <drexx@pspi.com.ph> Senior Systems Engineer

========================

on the ftp prompt while connected to the site, type: ftp> quote site chmod <mode> <filename> for example:

ftp> quote site chmod 777 /tmp/test

the site command should be implemented on the ftp server though, i think.

Jafar Shameem

================

Sure you can, but your ftpd should allow it. wu-ftpd allows you to change the file permission (if you explicitely enable the feature). You can use any unix client. You should execute the command: quote site chmod 777 file....

I hope this helps

Christophe

=====================

The man page for ftpd on most systems contains a very nice summary of the FTP protocol, and a reference to the RFC which defines it. It's a very old protocol, not specific to Unix.

Some ftp clients and servers may support the SITE command, which syntax you can see in the alpha man page for ftpd. In the case of the alpha software it does permit "site umask nnn"

-- Steve Allen UCO/Lick Observatory Santa Cruz, CA 95064

====================

I have not been able to find a way. (I briefly scanned the source code for a ftpd server)

It appears that the file creation mode is controled by the UMASK of the process running ftpd.

Brian Sherwood

====================

-- Karl Amrhein



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:11 CDT