LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-03-2007, 02:57 PM   #1
rg.viza
Member
 
Registered: Aug 2006
Posts: 74

Rep: Reputation: 15
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
 
Old 07-03-2007, 03:59 PM   #2
i_grok
Member
 
Registered: Jun 2006
Location: Massachusetts
Distribution: Gentoo
Posts: 79

Rep: Reputation: 16
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...
 
Old 07-05-2007, 02:23 PM   #3
rg.viza
Member
 
Registered: Aug 2006
Posts: 74

Original Poster
Rep: Reputation: 15
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

Last edited by rg.viza; 07-05-2007 at 02:24 PM.
 
Old 07-07-2007, 03:00 PM   #4
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SBackup Destination Permissions vba_djs Linux - Newbie 0 05-03-2007 09:07 AM
Strange scp issue while copying files gettons_slack Linux - Software 2 08-26-2006 06:33 AM
Strange scp issue while copying files gettons_slack Slackware 7 08-25-2006 02:53 PM
BSD Mouse not behaving Wumpa Tenshi *BSD 23 06-12-2005 03:12 PM
SCP strange behaviour sbalasuriya Linux - Software 0 09-21-2004 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration