1821539 Members
2829 Online
109633 Solutions
New Discussion юеВ

FTP File Permissions

 
Sam  Lalonde
Occasional Contributor

FTP File Permissions

How can I change the default permissions that files get when a user puts them on a system using FTP?
6 REPLIES 6
Michael Tully
Honored Contributor

Re: FTP File Permissions

There are a few examples in this posting on how.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x29cecf38d6bdd5118ff10090279cd0f9,00.html
Anyone for a Mutiny ?
Sam  Lalonde
Occasional Contributor

Re: FTP File Permissions

Is there a way for me to change the permissions on FTP'd file for only ONE user, without making a global change?
Michael Tully
Honored Contributor

Re: FTP File Permissions

Hi,

There are perhaps only two ways to do this. The first would be utilise the 'class' option which comes with 'ftpaccess'. The second would would be to have a simple script run from cron that updates the file permissions of designated directories.

HTH
Michael
Anyone for a Mutiny ?
Thomas M. Williams_1
Frequent Advisor

Re: FTP File Permissions

Sam:
I am not sure how the FTP is being performed. If the file is being FTP'd within a script you can use "chmod". I have a script I use to ftp files from time to time where I must set proper file permissions. I attached the script. Let me know if there is more detail to your issue.
I Think the Clock is Slow ...
Armin Feller
Honored Contributor

Re: FTP File Permissions

There are a couple of ways to do this:

1. The first method involves altering the definitions for the ftp
daemon. "ftpd" is the DARPA Internet File Transfer Protocol server.
It expects to be run by the Internet daemon "inetd". "inetd" runs
"ftpd" when a service request is received at the port indicated
in /etc/services.

More detailed information on this can be found in the manual pages for
"inetd", "inetd.conf" and "services".

The syntax of "ftpd" is:

/etc/ftpd [-l] [-t timeout] [-T maxtimeout] [-u umask]

To alter the ftp daemon definition change the line in /etc/inetd.conf
from:

ftp stream tcp nowait root /etc/ftpd ftpd -l
to:
ftp stream tcp nowait root /etc/ftpd ftpd -l -u002


Files created by ftpd will have permissions of rw-rw-rw- unless there
is a umask to alter the permissions. By default the umask is 027 which
gives default permissions for files created by ftp as rw-r-----.
So, the example above would cause files created by an ftp user to have
access rights of -rw-rw-r--. For more details on masking refer to the
manual pages for "umask".

Once the /etc/inetd.conf file has been altered it is necessary to force
"inetd" to reread its configuration file. This can be done by:

* Enter "inetd -k". This will kill the current process.
* Enter "/etc/inetd". This will restart the inetd process.


2. From within "ftp", you can use the command "umask" from the "ftp"
prompt:

# ftp hphost
Connected to hpsystem.kkk.lll.com.
220 hphost FTP server
Name (hphost:root):
331 Password required for root.
Password:
230 User root logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> umask 002
200 UMASK set to 002 (was 027)
ftp>
Rory R Hammond
Trusted Contributor

Re: FTP File Permissions


I think the default umask for ftp is 027. you can open your ftp session
then enter

"umask 002" or any over desired value umask for your ftp session.


To make perm change edit /etc/inetd.conf
ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -L -v -u 122

the -u option to change default umask. Change it to what you want
There are a 100 ways to do things and 97 of them are right