Operating System - HP-UX
1752661 Members
6053 Online
108788 Solutions
New Discussion

Permission change while copying from windows to Unix

 
laiju.c.babu
Regular Advisor

Permission change while copying from windows to Unix

Hi Team

We are transferring a file from windows to Unix .

 

Method using for transferring the file:-

============================

From windows to Unix we  made a passwordless sftp using a normal user ( for eg : A) .

 

sftp <file path >  A@unix hostname:/<destination address>  ====> this is the command which we ar using

 

My issue is we had given full permission for Everyone for the file in windows side .  Once it reaches the Unix box the permission will become 600 . Actaully we need to get the permission as 644.

 

I had made the umask for that user A as 022 , After this also the permission of the file which i am copying is not getting changed .

If i am creating a file on Unix box as that user A then the permission of thata file is 644 .

 

So how can i get the permission 644 for all the files moving to that destination.

 

Regards

 

 

P.S. This thread has been moved from HP-UX > System Administration to HP-UX > networking. - Hp Forum Moderator

Laiju.C.Babu
2 REPLIES 2
Dennis Handly
Acclaimed Contributor

Re: Permission change while copying from windows to Unix

>I had made the umask for that user A as 022

 

The user's umask isn't consulted when using rcp, ftp, scp, sftp access.

 I assume there is some config file for the demons to set the default umask?

 

For ftp, there is a umask command.

For sftp, there is a lumask command but unfortunately that is for the local system.

I suppose you could use the chmod 644 command after your put and use -b for a batch file.

 

 

Matti_Kurkela
Honored Contributor

Re: Permission change while copying from windows to Unix

For SFTP, the server-side default umask can be set on the Subsystem line of the sshd_config file (/opt/ssh/etc/sshd_config in HP-UX). Add the -u option and the desired umask value. For more information, see "man sftp-server".

 

The default Subsystem line should look similar to this in HP-UX:

 

Subsystem       sftp    /opt/ssh/libexec/sftp-server

 

To get umask 022 as a default for SFTP transfers, change it to:

Subsystem       sftp    /opt/ssh/libexec/sftp-server -u 022

 

With newish SSH versions, the same options will apply also if "internal-sftp" is used as a SFTP server instead of /opt/ssh/libexec/sftp-server.

 

If the umask is not explicitly set, each new incoming SFTP session will use whatever default umask is applied to new sessions by the PAM libraries. This may be different from the default umask set in /etc/profile and similar shell startup scripts. If the PAM libraries won't modify the umask, then the umask of the master sshd process will be inherited by the new sftp-server processes too.

MK