Scp, problem, .bashrc


 
Thread Tools Search this Thread
Operating Systems Solaris Scp, problem, .bashrc
# 1  
Old 11-06-2013
Scp, problem, .bashrc

I have a problem with SCP, trying to use this solution in .bashrc:

Code:
 scp printed an error message: "Write failed flushing stdout buffer. write stdout: Broken pipe." or "packet too long".    
Your shell startup file (e.g., ~/.cshrc, ~/.bashrc), which is run when scp connects, might be writing a message on standard output. 
These interfere with the communication between the two scp1 programs (or scp2 and sftp-server). 
If you don't see any obvious output commands, look for stty or tset commands that might be printing something.    
Either remove the offending statement from the startup file or suppress it for noninteractive sessions:
if ($?prompt) then echo 'Here is the message that screws up scp.' endif
The latest versions of SSH2 have a new server configuration statement, AllowCshrcSourcingWithSubsystems, which should be set to no to prevent this problem.

however, it says '-bash: 0prompt: command not found'.
how to fix it?
thanks.

Last edited by orange47; 11-06-2013 at 04:40 AM.. Reason: err
# 2  
Old 11-06-2013
That is csh syntax, not bash syntax.

Don't blindly copy code into your ~/.bashrc, that would not have fixed the problem even if it was the right code -- just look at your ~/.bashrc, see if it is printing something on login.

Last edited by Corona688; 11-06-2013 at 11:35 AM..
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 11-06-2013
If there is something in your .bashrc file that needs to print something you can use the shopt command to allow it to print and still allow the scp command to function correctly:

Wrap whatever is printing a message like so:
Code:
if shopt -q login_shell; then
    <whatever is printing message>
fi

This User Gave Thanks to in2nix4life For This Post:
# 4  
Old 11-07-2013
thanks, that shopt worked great for scp.
( btw, I had also tried ''if [ -z $PS1 ]" without success )
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

scp command problem

I am trying to copy file . On the remote host I have dir structure as ... /opt/product/11.2.0/ and underneath 11.2.0 I have db and db112 dirs.. and there are sub dirs underneath db and db112.. scp xyx:/tmp/1.sh /opt/oracle/11.2.0/*/hs/admin/1.sh the idea here is copy 1.sh to both db... (2 Replies)
Discussion started by: talashil
2 Replies

2. UNIX for Dummies Questions & Answers

Problem with SCP command

hi, I am successfully running following command from command prompt $ scp oracle@172.16.0.11:/back/crmemo.csv /sales/ but when i am running the same command from a script it copying '?' in sales (destination) folder. Following is the script #!/bin/sh scp... (14 Replies)
Discussion started by: RIAZ
14 Replies

3. UNIX for Dummies Questions & Answers

[Solved] startxwin and .bashrc problem

On my old computer I always used "startxwin.bat". This worked well and when it was executed an xterm window would open and the .bashrc file in my /home/username/ folder had been read correctly and all of my aliases worked. However with the newest version of Cygwin I noticed that startxwin.bat is... (3 Replies)
Discussion started by: lemmy
3 Replies

4. UNIX for Advanced & Expert Users

Problem with ssh and scp

Hi there, I'm working with two linux servers and if I use ssh to connect from 1 to 2 everything works fine ( ..as usual:rolleyes:), while if I try to connect via ssh or to copy files through scp (as I usually do...) from 2 to 1, after the password I get this message: Connection closed by... (6 Replies)
Discussion started by: Giordano Bruno
6 Replies

5. Shell Programming and Scripting

Problem while scp if bashrc calls Perl script

A weird thing, happened today: When i do SCP from a remote server, file is not getting copied to here. Application Server: Here is where i work, and have a login. I have several tweaks in .bashrc, and along with all those, today i called a PERL script from bashrc. So when ever i do scp from a... (4 Replies)
Discussion started by: thegeek
4 Replies

6. UNIX for Advanced & Expert Users

scp problem

I have some problems using scp between a server Sun Solaris and a SecurePlatform Checkpoint. If I try to copy a simple file txt from the server Sun Solaris to the SecurePlatform, I have problems!!!!!!... server:/export/home/appmgt# scp 1.txt admin2@fwtest:~ lost connection ... if I try to... (5 Replies)
Discussion started by: Minguccio75
5 Replies

7. UNIX for Dummies Questions & Answers

problem with SCP

Hi, I want to copy a file from one system to other i done a SCP but it showing error as below .. Can we do it by SCP ? Is it possible ?.. What is the below mean ?. sys1@sys2's password: scp: .: not a regular file Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

8. UNIX for Advanced & Expert Users

scp problem

Hi, I have problem using scp in an AIX machine, where I need to use full path to scp from /dirA but i dont have to from /dirB of the same machine. Below are some details & scp -v output (truncated). I've checked the permission & settings of both dir/FS are the same. Please help. scenario scp... (2 Replies)
Discussion started by: juliehussin
2 Replies

9. Shell Programming and Scripting

problem in getting the path of environment variable set in bashrc in my shell script

hi all i have joined new to the group. i have set an variable in my bashrc file. .bashrc PROGHOME=/home/braf/braf/prog export PROGHOME but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path. in my script... (8 Replies)
Discussion started by: krithika
8 Replies

10. UNIX for Advanced & Expert Users

scp problem

I am using scp to get files from a Windows systemr to a Unix system. The ssh server is on Windows. The problem is that the file permissions for files that come from Windows are 700. Can any one help out with how I can set permissions to anything else? (6 Replies)
Discussion started by: blowtorch
6 Replies
Login or Register to Ask a Question