LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-11-2010, 12:05 AM   #1
bluethundr
Member
 
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 122

Rep: Reputation: 15
Thumbs down scp to this one host fails


If I attempt to SCP any file (like say, my public RSA key) to my home server I am dumped into a non-interactive bash prompt and the transfer fails. I have looked at the output of the -vvv option to SCP and included it with this post. Nothing about this failure is jumping out at me and a fresh analysis would be appreciated.

Code:
bluethundr@walmac~:scp ~/.ssh/id_rsa.pub bluethundr@$HOMEIP:/home/bluethundr
bluethundr@xx.xx.xxx's password: 
This shell is not interactive
bluethundr@walmac~:

And this is my .bashrc on my local host from which I scp.

Code:
export HOMEIP=xx.xxx.xx.xxx
export PS1="\u@\h\W:"
ENV=~/.env
export ENV
. $ENV

this is the .bashrc on the host i try to scp to:

Code:
# .bashrc 
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
 
# User specific aliases and functions
if [ -z "$PS1" ]; then
             echo This shell is not interactive
     else
             echo This shell is interactive
fi
 
 
PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/local/lib/:/usr/kerberos/sbin:/usr/kerb
eros/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/NX/bin
 
export PATH
Attached Files
File Type: txt ssh-key-prob.txt (9.5 KB, 4 views)
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-11-2010, 04:45 AM   #2
Lexus45
Member
 
Registered: Jan 2010
Location: Kurgan, Russia
Distribution: Slackware, Ubuntu
Posts: 339
Blog Entries: 3

Rep: Reputation: 47
is the sshd on the $HOMEIP running?
is bluethundr user allowed to log in via ssh ?
 
Old 04-11-2010, 11:20 AM   #3
bluethundr
Member
 
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 122

Original Poster
Rep: Reputation: 15
scp FAIL

yes, ssh works. just not allowed to scp for some bizarre reason:


Code:
[bluethundr@cloud1 ~]$ ssh bluethundr@$HOMEIP
bluethundr@xx.xx.xx.xxx's password: 
Last login: Sun Apr 11 12:21:06 2010 from ec2-184-73-184-128.compute-1.amazonaws.com
#########################################################
#               SUMMITHOME.COM                          #
#               TITLE:       LCENT5-1 BOX               #
#               LOCATION:    SUMMIT BASEMENT            #
#                                                       #
#########################################################


This shell is interactive
-bash-3.2$
:
 
Old 04-11-2010, 11:35 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,506

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
What if you remove the echo statements from the remote .bashrc? Is the file copied in that case?
 
2 members found this post helpful.
Old 04-11-2010, 11:49 AM   #5
bluethundr
Member
 
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 122

Original Poster
Rep: Reputation: 15
yep! removing those echo statements from .bashrc (which I reference in the first post) cleared up the issue! Thanks! Any clue on why those statements would muck up scp and not ssh? ::shrug::
 
Old 04-11-2010, 12:03 PM   #6
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,506

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You're welcome! Actually I didn't ever understand if this is an unresolved bug or an expected behavior. Anyway, it is reported in the openssh FAQ, here and involves non-interactive shells.

Indeed, if you need to receive some output from the remote .bashrc upon login sessions, you can do something similar to your original script: just exit if non-interactive OR don't send output OR invert the logic, e.g.
Code:
if [ -n "$PS1" ]
then
  echo Welcome!
fi
Moreover, non-interactive bash sessions don't execute .bash_profile, so that it is a good place for echoing messages or executing commands that write to standard output.
 
  


Reply

Tags
centos5, scp, ssh


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
scp: port 22: No route to host xpucto Linux - Networking 4 10-22-2013 09:58 PM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
Using vsftpd to host web images fails for some IE users only MQMan Linux - Networking 0 05-02-2008 12:55 PM
After copying 6 GB, scp fails (lost connection) augustosup Red Hat 2 01-26-2007 11:10 AM
scp between 2 hosts from a 3rd host noir911 Linux - Networking 3 05-12-2006 05:55 AM


All times are GMT -5. The time now is 07:35 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration