Operating System - HP-UX
1837016 Members
2229 Online
110111 Solutions
New Discussion

ftp download umask and file permission issues.

 
SOLVED
Go to solution
Gulam Mohiuddin
Regular Advisor

ftp download umask and file permission issues.

I have an automated cron script on HP-UX Server which downloads files from Windows server using ftp.

1. On HP-UX Server my umask is 011 but ftp downloads those files with 044 permission instead of 055, I don’t know why?

2. Now I want those ftp downloaded files to have permission 666 or -rw-rw-rw-
How to achieve this?


Thanks for your anticipated assistance on this issue.

Gulam.
Everyday Learning.
3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: ftp download umask and file permission issues.

ftp doesn't login like a normal user so umask settings for normal login don't apply. In /etc/inetd.conf, there is a -u option for ftpd which controls the creation of files on the server. But the -u option has no control over files that are downloaded. ftp (the program running on the local system) creates files based on the user's current umask, so to create files with 666 permission (always a bad idea since anyone can trash the files), you would start ftp in your script like this:

umask 000
ftp where_ever << EOD
...ftp commands...
EOD


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: ftp download umask and file permission issues.

Shalom Gulam,

You might be able to control this in the ftpaccess file. It controls the behavior of the ftp server.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: ftp download umask and file permission issues.

Hi Gulam:

Change or add '-u 000' to your 'ftpd' daemon arguments in '/etc/inetd.conf' and restart the 'inetd' daemon.

# ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -u 000 -a

...for example. Then:

# /usr/sbin/inetd -c

See the man pages for 'ftpd(1M)' for more information.

Regards!

...JRF...