SunOS 4.1.3, ftpd umask

2007-12-25 9:58:00

I've solved the problem by following suggestions from Peter M Allan and

Jochen Bern. Their replies are attached.

Thanks for the following ppl who replied.

From: Alex Soares <alex@nc-rj.rnp.br>

From: meng sher <mcao@freenet.com>

From: Chris Marble <cmarble@orion.ac.hmc.edu>

From: Peter M Allan <peter.allan@aeat.co.uk>

From: Jochen Bern <bern@penthesilea.uni-trier.de>

--- The original question -------

Hi,

How to change the default umask for ftpd daemon. The access mode of

uploaded files are 666. I would like to change the umask to either 022 or

077 to protect the newly uploaded files from being overwritten.

--- Answers ---------------------

>From bern@penthesilea.uni-trier.de Fri Apr 4 01:43:40 1997

Date: Thu, 3 Apr 1997 18:12:17 +0200 (MET DST)

From: Jochen Bern <bern@penthesilea.uni-trier.de>

Reply-To: bern@uni-trier.de

To: tonywu@hades.life.nthu.edu.tw

Subject: Re: SunOS 4.1.3, ftpd umask

> How to change the default umask for ftpd daemon. The access mode of

> uploaded files are 666. I would like to change the umask to either 022 or

> 077 to protect the newly uploaded files from being overwritten.

The plain Vanilla ftpd inherits its umask from inetd, which inherits

it from the Shell running the Boot Scripts (/etc/rc* on SunOS,

/etc/rc?.d/* on Solaris). In other Words: You don't have that Problem

with ftpd alone! It's a good_Thing (tm) to add a "umask 022" as first

Command to all Boot Scripts.

Setting the umask for ftpd alone is a Bit harder, you'ld probably

have to have inetd start a Wrapper instead of ftpd which does

umask 077

exec real.ftpd

or somesuch. Do you really want to do this for *all* FTP Users, or

only for Users of anonymous FTP? wu-ftpd has a separate Setup for

the latter which allows you to disable Overwrites independent from

the Permissions.

Regards,

                                                                J. Bern


--
/\ /""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""\
/ \/ bern@uni-trier.de (Size Limit!) | P.O. Box 1203 | Ham: \/\
/ J. \ bern@ti.uni-trier.de (SUNAttachm.OK) | D-54202 Trier | DD0KZ / \
\Bern/ No Finger etc.; Use Mail (Subj. "##" for Autoreply List) and \ /
\ /\ WWW. /\/
\/ \____________________________________________________________/

>From peter.allan@aeat.co.uk Fri Apr 4 01:43:44 1997
Date: Thu, 3 Apr 97 12:15:07 BST
From: Peter M Allan <peter.allan@aeat.co.uk>
To: tonywu@hades.life.nthu.edu.tw
Subject: Re: SunOS 4.1.3, ftpd umask

Tony,

Beside the methods suggested in this old summary,
tcp wrappers are worth having and do this for you.

> From: andrew@mdlhk.attmail.com (Andrew Law)
> Date: 20 Jun 94 06:56:40 GMT
> Subject: SUMMARY: Attributes of file created by ftp put
>
> 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.

I'm not wild about suggestion 4. I don't think it
even works on recent ftpds.

-- Peter Allan peter.allan@aeat.co.uk

Thanks,
Tony C. Wu
--
"I never think of the future. It comes soon enough." - Albert Einstein

Comments

Got something to say?

You must be logged in to post a comment.