The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
file transfer using scp.. KiranKumarKarre Shell Programming and Scripting 5 05-18-2009 05:47 AM
File transfer Shahul Shell Programming and Scripting 2 11-28-2008 02:20 PM
XFB file transfer sais IP Networking 0 11-05-2008 03:02 AM
Transfer the file manas_ranjan UNIX for Dummies Questions & Answers 2 07-27-2007 09:33 AM
transfer of specific file content to another file mem101 Shell Programming and Scripting 1 10-18-2005 02:01 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-30-2009
kumarm kumarm is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 7
File transfer using SCP

I have a shell script which uses SCP command to transfer the files from one server to another server. The files are getting transferred successfully, but the problem is the files transferred to the destination server didnot have the permissions as that of the files on the source server.

Command used: scp file_name username@servername:/dest_directory/

Files permissions on Source server : -rw-r--r--
Files permissions on Destn server : -rw-------

I cannot use "scp -p" or any other variations since there are 40 shell scripts already running daily in the production server(source server)

Please help me to resolve the issue.

Last edited by kumarm; 06-30-2009 at 02:19 PM..
  #2 (permalink)  
Old 06-30-2009
Autocross.US's Avatar
Autocross.US Autocross.US is offline
Registered User
  
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
Did you try scp with the '-p' option?
  #3 (permalink)  
Old 06-30-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
Code:
scp -p [rest of command]
-p preserves the file mode - or permssions
  #4 (permalink)  
Old 06-30-2009
kumarm kumarm is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 7
I cannot use "scp -p" or any other variations since there are 40 shell scripts already running daily in the production server(source server),Since I need to change all of the scripts

Earlier scp without -p option worked fine. We are facing this problem after the OS upgrade on destination server.
  #5 (permalink)  
Old 06-30-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
You mean an sshd upgrade as well. That is your problem.

I am assuming something that conforms to openSSH.

The destination node (server) sets the permissions. SFTP_UMASK is an environment variable that you can add to the sshd process on the server. It does what you think - changes permissions for sftp operations. ssh_config may have a SftpUmask setting as well. I DO NOT KNOW if this affects scp.

1. try changing ssh_config to see if it impacts what you need. Every sshd node needs this change.
2. switch to sftp, SFTP_UMASK ....I know it is a code change.
3. use scp -p ... this is a code change too.

Without getting help from your OS provider, 1, 2, 3 are pretty much your choices. The only one I know above that works is scp -p.

Maybe someone else knows a workaround.

Your choice.
  #6 (permalink)  
Old 06-30-2009
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
in your profile, you could set an alias for scp to be the scp -p command. This would work as long as you didn't do an absolute patch for scp.
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0