LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   scp from a linux behaving strange and fubar'ing permissions on destination bsd system (https://www.linuxquestions.org/questions/linux-security-4/scp-from-a-linux-behaving-strange-and-fubaring-permissions-on-destination-bsd-system-566384/)

rg.viza 07-03-2007 02:57 PM

scp from a linux behaving strange and fubar'ing permissions on destination bsd system
 
All,
I'm no *nix admin and don't pretend to be. I'm just an internal programmer that is getting admin responsibility dumped on him.

That being said, one of the things I'm tasked with is some automation.

I have a very simple scp script that copies files from the local linux system to a remote BSD box. I have the modes (775) set on the files the way I want on the source files. They are just text files.

The remote user is very limited but owns the destination directory. It's a key authenticated process user.

Long story short, the permissions are getting fubar'd when I scp files out. I tried using the -p option to preserve the modes but it's not helping.

The permissions start out as
-rwxrwxr-x 1 someuser webdevgrp
They end up on destination as
-rw------- 1 someuser webdevgrp

Very frustrating... now if I don't use the -p option, existing files copy fine but new ones get fubar'd. Prolly because the files aren't getting overwritten since they haven't changed...

Any idea why this might be happening?

-Viz

i_grok 07-03-2007 03:59 PM

Sometimes the way to solve the problem is to find a different solution. Could you use rsync instead? I've had problems with other applications breaking permissions, but rsync always fixes them.

You could even run an rsync after the ssh...

rg.viza 07-05-2007 02:23 PM

bah, got sick of messing with scp.
I followed your advice but instead of using rsync, used sftp. Was done in 10 minutes.

Sftp allows you to do a sftp -b batch_commands_file someuser@someserver.com

and works with key auth since it's ssh. All the plumbing is already there.
I can do all my PUT's and do chmod's within the batch script. Works like a champion. scp is bugged...

Turns out it wasn't permissions on the remote server at all. SCP just doesn't do what the documentation says it does, at least not the ded rat version. sftp is more flexible anyway since you have the whole sftp command set available to you.

-Viz

whistl 07-07-2007 03:00 PM

check umask
 
Chances are your account on the bsd system was getting it's umask set to 077 either in the shell startup file (.profile, .bashrc, .cshrc). This umask overrides the permissions being passed by scp. Setting it to "umask 0" in the shell startup file would fix this.


All times are GMT -5. The time now is 06:42 AM.