SUMMARY: Attributes of file created by ftp put

From: Andrew Law (andrew@mdlhk.attmail.com)
Date: Mon Jun 20 1994 - 01:56:40 CDT


ORIGINAL QUESTION:

I have a problem in transfer files using ftp, the files that I 'put' to
the ftp server are always created with permissions -rw-rw-rw which
is not what I want. Everytime after the ftp, I have to telnet to
the host and chmod the files to -rw-r--r--.

Is there method to change the default permissions to -rw-r--r--?

SOLUTIONS:
1.
Use a wrapper on /usr/etc/in.ftpd,

Wrapper: /usr/etc/in.ftpd.umask

        #!/bin/sh
        umask 022
        exec /usr/etc/in.ftpd.umask $*

Remember to chmod +x on the wrapper.

Change ftp entry in /etc/inetd.conf

ftp stream tcp nowait root /usr/etc/in.ftpd.umask in.ftpd

2.
For wu-ftpd user, use option -u022. In /etc/inetd.conf, writes

ftp stream tcp nowait root /usr/local/sbin/ftpd in.ftpd -l -u022

3.
Add 'umask 022' to /etc/rc to cause all daemons started by /etc/rc
to have umask 022. Subsequently, /etc/rc.local, inetd, in.ftpd will
have umask 022.

4.
Try SITE CHMOD command in ftp.

THANKS TO FOLLOWING RESPONSES:

> From csmoko@relay.nswc.navy.mil Mon Jun 20 10:13:23 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sat Jun 18 10:14:53 -0400 1994
> From: csmoko@relay.nswc.navy.mil (Chuck Smoko - E81)
>
>
> Try this: Replace the /usr/etc/in.ftpd with a shell script that sets umask
> to 022 and calls the "real" ftpd in in.ftpd.exec. Remember to chmod +x
> the script that you create.
>
> chuck smoko
>
> PS: The end of the echo commands have <CR>'s.
>
>
> #!/bin/sh
>
> umask 022
> echo '220-
> '
> echo ' *******************************************************************
> '
> echo ' * UNAUTHORIZED ACCESS TO THIS U.S. GOVERNMENT COMPUTER SYSTEM IS *
> '
> echo ' * PROHIBITED BY PUBLIC LAW 98-473. VIOLATORS MAY BE PROSECUTED. *
> '
> echo ' *******************************************************************
> '
> echo '
> '
>
> exec /usr/etc/in.ftpd.exec $*
>
>

> From ric@Artisoft.COM Mon Jun 20 10:13:25 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sat Jun 18 09:27:17 -0600 1994
> From: ric@Artisoft.COM (Ric Anderson)
>
> in wu-ftpd version 2.4 there is a default umask of "2" used, so
> the file in question (for non-anonymous transfers) should come
> up -rw-rw-r--. You can control this defualt umask using the -u
> command line prarmter in inetd.conf, e.g.
>
> ftp stream tcp nowait root /usr/local/sbin/ftpd in.ftpd -l -u022
>
> For anonymous transfers, This can be altered by the value set in
> ftpaccess on the upload directive. E.g., I have
> # Restrict anonymous uploads to /home/ftp/incoming and forbid
> # creating directories; also set protection of uploaded files
> upload /home/ftp * no
> upload /home/ftp /incoming yes ftp ftp 0244 nodirs
>
> Hope this helps,
> Ric (<ric@Artisoft.COM> "Ric Anderson", speaking for himself)

> From rpeck@nas.nasa.gov Mon Jun 20 10:13:28 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sat Jun 18 09:30:47 -0700 1994
> From: rpeck@nas.nasa.gov (Rodney C. Peck)
>
>
> The default permissions are the result of the default umask. The system
> default umask appears to be 000. If you are the administrator of the
> destination machine, there are a couple things you can do.
>
> You can put a wrapper around the ftpd program run from inetd which sets the
> umask and then runs ftpd.
>
> or
>
> You can find where the system default umask is set and change that.
>
> I'd suggest the inetd solution since it's hard to guess the effects of
> changing the system wide default umask.
>
> --
>
> In /etc/inetd.conf, look for this line:
>
> ftp stream tcp nowait root /usr/etc/in.ftpd -l
> and change it to:
> ftp stream tcp nowait root /usr/etc/ftpd-umask in.ftpd -l
>
> put this script in /usr/etc/ftpd-umask:
> ---
> #!/bin/sh
> # set the umask and then run the regular ftpd. To be run from inetd
> umask 022
> prog=$1
> shift
> exec /usr/etc/$prog !*
> ---
>
> don't forget to chmod +x /usr/etc/ftpd-umask so it's executable.
>
> That's it -- now, files ftped to the site will have -rw-r--r-- permission.
> If you want something more restrictive, use a tighter umask.
>
> There may also be replacement ftpds around on the public archives which
> change their umask to something reasonable.
>
> Rodney
>

> From rwing!pat@ole.cdac.com Mon Jun 20 10:13:30 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sat Jun 18 09:01:10 -0700 1994
> From: rwing!pat@ole.cdac.com (Pat Myrto)
>
> Not that I know of as far as the person on the remote system sending
> files is concerned. On the host that people are ftp'ing to one might
> be able to affect the default permissions for ftp (or any process started
> by inetd or that are started by the rc.* files in /etc by placing the
> line 'umask 022' at the top of /etc/rc and shutting down and rebooting
> the system.
>
> The system comes up with a default umask of 0, whicdh means all perms
> get activated. Putting the umask 022 in the top of /etc/rc esnures that
> files created by daemons launched during the boot process have a decent
> default umask value. As inetd is launched by /etc/rc (actually rc.local,
> which in turn is launched by /etc/rc), so it would be running under
> whatever umask rc ran at, and the ftp daemon ftpd is launched as required
> by inetd, so putting the line 'umask 022' at the top of /etc/rc and then
> shutting down and rebooting the system may will result in sane default
> permissions on files put via the ftp command. This doesn't affect
> logins, of course, as login is started by init, which is started before
> any of the rc files get read. Otherwise, the only way I can think of
> would be to get source for the ftpd program (ftp daemon) and add the
> umask() function call to the code.
>
> Hope this helps...
>
> --
> pat@rwing [If all fails, try: rwing!pat@eskimo.com] Pat Myrto - Seattle WA
> "No one has the right to destroy another person's belief by demanding
> empirical evidence." -- Ann Landers, nationally syndicated advice columnist
> and Director at Handgun Control Inc.
>

> From pluto!perryh@qiclab.scn.rain.com Mon Jun 20 10:13:41 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sat Jun 18 12:58:06 -0700 1994
> From: perryh@pluto.rain.com (Perry Hutchison)
>
> This sounds like a matter of the ftp server's umask setting. You
> would need administrative capability on the server to change it.
>
> The details will depend on the server's OS version. Generically you
> would need to find the place where the ftp server is started, and
> arrange to change the umask appropriately. As an example, my system
> starts ftpd from inetd so one method would be to have inetd invoke a
> script instead. The change in /etc/inetd.conf would be something like:
>
> < ftp stream tcp nowait root /usr/etc/in.ftpd in.ftpd
> ---
> > ftp stream tcp nowait root /usr/etc/in.ftpd.sh in.ftpd
>
> and /usr/etc/in.ftpd.sh would be something like
>
> #!/bin/sh
> umask 022
> exec /usr/etc/in.ftpd $*
>
> Another approach would be to replace the system-supplied ftpd with the
> wuarchive version, which is more configurable and is distributed as
> source. Ask archie for "wuftp".
>

> From CL6798@TAMUG3.TAMU.EDU Mon Jun 20 10:13:52 1994
> From: CL6798@TAMUG3.TAMU.EDU
> Message-Version: 2
> >To: mdlhk!andrew
>
> you can try useing the SITE command if it is implemented on the machine your ftping to. try SITE CHMOD 777 file to make it rwxrwxrwx.
>
> laters,
> jay
>

> From barmar@Think.COM Mon Jun 20 10:13:57 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sun Jun 19 14:31:54 -0400 1994
> From: barmar@Think.COM (Barry Margolin)
>
> I think the WU ftpd provides a config file entry for the umask.
>
> You could also use the following script to run ftpd:
>
> #!/bin/sh
> umask 022
> exec /usr/etc/in.ftpd
>
> Put the pathname of this script in the ftp entry in /etc/inetd.conf.
> --
> Barry Margolin
> System Manager, Thinking Machines Corp.
>
> barmar@think.com {uunet,harvard}!think!barmar
>

> From mike_raffety@il.us.swissbank.com Mon Jun 20 10:14:02 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Sun Jun 19 16:13:23 -0500 1994
> From: mike_raffety@il.us.swissbank.com (Mike Raffety)
>
> Start the in.ftpd on the server inside a shell script that does a "umask 022".
>

> From markus@octavia.anu.edu.au Mon Jun 20 10:14:07 1994
> Message-Version: 2
> >To: mdlhk!andrew
> Date: Mon Jun 20 10:00:46 -0400 1994
> From: markus@octavia.anu.edu.au (Markus Buchhorn)
>
> ftpd uses the umask of the user that it runs as - usually root. In
> /etc/rc (or equivalent under Solaris) add a line 'umask 022' or
> similar before inetd is started.
>
> Cheers,
> Markus
>
> Markus Buchhorn, Parallel Computing Research Facility
> email = markus@octavia.anu.edu.au snail = CISR, I Block, OAA, ANU
> Australian National University, Canberra, 0200 , Australia.
> [International = +61 6, Australia = 06] [Phone = 2492930, Fax = 2490747]
>



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:04 CDT