Operating System - HP-UX
1822011 Members
4160 Online
109639 Solutions
New Discussion юеВ

Re: how to set permissions on ftp files ?

 
SOLVED
Go to solution
Q4you
Regular Advisor

how to set permissions on ftp files ?

If I logon to a unix server, my session takes on the specifications based on the commands in the .profile. If I set, for example, the umask in the .profile, then all files I create will take on that permission scheme.

If I connect to the unix server via FTP, and logon with my ID, how do I get any files that I bring over via FTP to take on permissions other than the default. In other words, can I set a umask type of thing for files that I create on the server via an FTP?
13 REPLIES 13
Ken Hubnik_2
Honored Contributor

Re: how to set permissions on ftp files ?

Set your umask for your ftp session
ftp umask xxxx
Steven E. Protter
Exalted Contributor

Re: how to set permissions on ftp files ?

This stuff is set in the ftpaccess file.

defusmask

man ftpaccess for more.

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
Shannon Petry
Honored Contributor

Re: how to set permissions on ftp files ?

If you are using wu_ftpd, then there is a umask option for ftpaccess.

This can be set individual ftp groups, or a global umask.

If your using proftp, it also has a umask option, both global and per ftp group.

Doc's for ftpaccess, or proftp will both give examples for how to use the umask statement.

Regards,
Shannon
Microsoft. When do you want a virus today?
James R. Ferguson
Acclaimed Contributor

Re: how to set permissions on ftp files ?

Hi:

To establish a global 'umask' for 'ftp' add the '-u umask' argument to the daemon's startup in 'etc/inetd.conf':

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

By default, the umask value is 027. Having edited this file, restart the 'inetd' daemon:

# /usr/sbin/inetd -c

To establish a 'umask' on a specific base case, use the 'etc/ftpdftpaccess' mechanism. See the man pages for 'ftpaccess(4)' for more information.

Regards!

...JRF...
Jeff Schussele
Honored Contributor

Re: how to set permissions on ftp files ?

Hi,

Two ways.

Globally:
In the ftp line of /etc/inetd.conf, put the following parm on the ftpd command
-u xxx where xxx=umask default is 027

Per user:
In /etc/ftpd/ftpaccess (you may have to create this file) you'd have a line that looks like

upload /home/user1 /path/to/upload/dir yes user1 group1 0666

This sets files to 666 for user1 who's primary group is group1. The /home/user1 specifies that user's home dir. Warning - when you use ftpacess you must make sure that you have a proper class statement so that you don't exclude other user's ability to ftp - see /usr/newconfig/etc/ftpd/ftpaccess for an example file.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Ravi_8
Honored Contributor

Re: how to set permissions on ftp files ?

Hi,

modify the line in /etc/inetd.conf file

# ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -u 022
(this will set the umask 022 on every ftp file)

#inetd -c

after this every ftp file will have the permission 0755
never give up
Q4you
Regular Advisor

Re: how to set permissions on ftp files ?

 
Q4you
Regular Advisor

Re: how to set permissions on ftp files ?

I think on directory umask operate on 777 scheme and on files it operates on 666 ??

The above is my sample ftpaccess file. am I missiong something to configure ftpaccess. Is this a potential security hole ?
Pelephone System
Frequent Advisor

Re: how to set permissions on ftp files ?

Hi


If u don't want to complicate things there
is the chmod cmd on your ftp session ftp support this command .

Eitan

HPUX sysadmin
Gary Yu
Super Advisor

Re: how to set permissions on ftp files ?

First of all, umask apply against the file creation mask which is 666 for files and 777 for directories(they are not changeable). so if you have umask 022, your new file will be 644.

secondly, umask setting for ftpd will affect files you "put" through ftp only, while files "get" from ftp will be affected by your environment umask, not ftp umask.

thanks,
Gary
Dave La Mar
Honored Contributor

Re: how to set permissions on ftp files ?

Q4you -
Please check the following link:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x09cad7d96cbad711900a0090279cd0f9,00.html

You will find other options here. Whew! That was a fun exercise.

Best of luck,

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Dave La Mar
Honored Contributor

Re: how to set permissions on ftp files ?

As per your reuest -
This is the only section of the ftpaccess file that needs modification.

# specify the upload directory information
upload /var/ftp * no
upload /var/ftp /incoming yes root daemon 0600 dirs
upload /var/ftp /bin no
upload /var/ftp /etc no

sample additional entry -

upload /home/dlamar * yes dlamar adm 0640 dirs

The above entry says "for ftp user dlamar, all files put to any (*) directory on this machine will have permissions of rw-r-----".

You can be more specific by declaring a particular directory instead of * (all)

And yes, after making the change perform
inetd -c to reread the file.

Best of luck.

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Dave La Mar
Honored Contributor
Solution

Re: how to set permissions on ftp files ?

Sorry, should have included that you need the -a option in yor inetd.conf file as well This note that an ftpaccess file will be used.
i.e.

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

Any changes here alos require an inetd -c

dl
"I'm not dumb. I just have a command of thoroughly useless information."