Operating System - HP-UX
1833958 Members
2319 Online
110063 Solutions
New Discussion

SCP from MS Windows to HPUX

 
SOLVED
Go to solution
hmorrison
Advisor

SCP from MS Windows to HPUX

I have extablished secure connection between the windows and unix environment, however when a secure copy is done from windows to unix the file is transfered to the unix environment with 700 permissions with the unix transfer user owning the file. How can I get the permission to be different when transfering the file. When the unix user creates a file in the unix environment the permission on the file is 644 as is expected based on the umask. Can anyone assist?
10 REPLIES 10
Court Campbell
Honored Contributor

Re: SCP from MS Windows to HPUX

I don't believe you can set a umask setting for scp.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
hmorrison
Advisor

Re: SCP from MS Windows to HPUX

Thanks for responding. Does that mean that I will be unable to make the mode different from 700 when the file is transfered? Ohh I hope not.
Ollie Rowland
Frequent Advisor

Re: SCP from MS Windows to HPUX

Hi,

I believe the permissions are copied across from the Windows system to the Unix system. At least that's true for Unix to Unix copying.

Try setting the required permissions in Windows before you do the scp and see if that makes any difference.
Court Campbell
Honored Contributor

Re: SCP from MS Windows to HPUX

You are going to have to change the perms after the transfer.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Court Campbell
Honored Contributor
Solution

Re: SCP from MS Windows to HPUX

Nevermind, I take that back. I changed the perms locally on my laptop and it kept the perms. I use cygwin so I was able to use chmod in the windows environment. i am not sure what perms you would have to change if you use the windows gui.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Ollie Rowland
Frequent Advisor

Re: SCP from MS Windows to HPUX

I guess that's where trial and error raises it's ugly head!
hmorrison
Advisor

Re: SCP from MS Windows to HPUX

Thanks for your assistance and concern. I was able to change the mode from the windows environment, so now the secure copy has the correct permissions.
GlennBroSitel
Occasional Advisor

Re: SCP from MS Windows to HPUX

I just encountered this on 11.31 and found a resolution the problem is related to the SFTP subsystem in OpenSSH not inheriting the umask.

On the UNIX box create a script like /usr/local/bin/sftp-server.sh

In that script enter..
-bash-3.2$ cat /usr/local/bin/sftp-server.sh
#!/usr/bin/sh

umask 000
exec /opt/ssh/libexec/sftp-server

Obviously change umask to what you want.

The in /opt/ssh/etc/sshd_config (maybe different on yours) make the following change...

# override default of no subsystems
#Subsystem sftp /opt/ssh/libexec/sftp-server
Subsystem sftp /usr/local/bin/sftp-server.sh

Restart sshd... should be good to go.

Hope this helps!
GlennBroSitel
Occasional Advisor

Re: SCP from MS Windows to HPUX

Oh sorry just misread this is scp, you could try something similar for the sshd startup to get around that. I never test scp myself.
hmorrison
Advisor

Re: SCP from MS Windows to HPUX

Thanks all Court Campbell's suggestion helped me yesterday.