Operating System - HP-UX
1820013 Members
3599 Online
109608 Solutions
New Discussion юеВ

Setting FTP umask per user

 

Setting FTP umask per user

Hi everybody,
the default ftpd permission is 027. Can I set the umask
per user/group basis. If I do ftp from MS-Dos to Unix
the file takes permissions of 640. i want this file to be readable by all. But this has to only for that particular area.

thanks
Prosanjit
4 REPLIES 4
Marcin Wicinski
Trusted Contributor

Re: Setting FTP umask per user

Hi,

1. put -u option to ftp line in /etc/inetd.conf file
2. inetd -c
3. new ftp session will work with new umask

Later,
Marcin Wicinski
Stefan Farrelly
Honored Contributor

Re: Setting FTP umask per user


You can only set the ftp umask globally in /etc/inetd.conf, not for a particular user or area. The only way to do what you want is have a cron job which runs frequently which detects new ftp files to certain areas/users and then changes their permissions.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Santosh Nair_1
Honored Contributor

Re: Setting FTP umask per user

You can do something like this by using the ftpaccess file to designate that all files uploaded to a particular area gets specified permissions and a specified owned/group.

First you have to enable the ftpaccess file by specifying the -a option for the ftp entry in the /etc/inetd.conf file and then restart inetd (inetd -c).

Then set up your ftpaccess file with the upload directive as shown:

upload root-dir dirglob yes|no owner group mode dirs|nodirs

Define a directory with dirglob that permits or denies uploads.

If it does permit uploads, all files will be owned by owner and group and will have the permissions set according to mode.

Directories are matched on a best-match basis.

For example:

upload /var/ftp * no
upload /var/ftp /incoming yes ftp daemon 0666
upload /var/ftp /incoming/gifs yes jlc guest 0600 nodirs


This would only allow uploads into /incoming and /incoming/gifs. Files that were uploaded to /incoming would be owned by ftp/daemon and would have permissions of 0666. File uploaded to /incoming/gifs would be owned by jlc/guest and have permissions of 0600. Note that the root-dir here must match the home directory specified in the password database for the ftp user.

The optional dirs and nodirs keywords can be specified to allow or disallow the creation of new subdirectories using the mkdir command.

The upload keyword only applies to users who have a home directory (the argument to the chroot()) of root-dir.

See the ftpd(1M) and ftpaccess(4) man pages for more details.

-Santosh
Life is what's happening while you're busy making other plans
David Lodge
Trusted Contributor

Re: Setting FTP umask per user

Also, when a user connecting to the server puts a file they can set the file permissions of the file through their session, using the site command, eg:

$ ftp
ftp> open foo
ftp> user username password
ftp> put bar.txt
ftp> site chmod 0764 bar.txt

or:

ftp> user username password
ftp> site umask 022
ftp> put bar.txt

dave