[Solved] ssh works but scp does not

Structure of an SSH binary packet
Image via Wikipedia

For quite sometime now, I was having this issue, that for the home system, I was able to connect to is using ssh but it never worked. Fnally after quite some debugging finally I found that the issue was with thebashrc. So, everytime I had to do a scp I would have to move/rename bashrc and do the reverse action after the scp was done.

Finally today I fixed it and the solution was very simple. I put the offending code or rather complete bashrc in the loop as mentioned below:

 

1
2
3
4
5
6
7
if [[ $SSH_CLIENT = "" ]

then

<bashrc code here>

fi

By doing this the <dot>bashrc is never executed when a ssh session is initiated (which is what happens for scp also). 🙂

Enhanced by Zemanta

Try all colors in xterm with script before setting the color

If you are looking for testing the colors on how they would look like in the xterm before you set the color then here is a small script for you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash -
#===============================================================================
#
#          FILE:  xterm_colors-test.sh
#
#         USAGE:  ./xterm_colors-test.sh
#
#   DESCRIPTION:  Test all the colors for xterm bg
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:   Amit Agarwal (amit.agarwal@amit-agarwal.co.in), aka
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  02/18/2011 01:02:51 PM IST
#      REVISION:  1.0
#===============================================================================

cat /usr/share/X11/rgb.txt |sed 's/\([0-9]\{1,3\}[ \t]*\)\{3\}//'|sed 's/^ *//' &gt;~/rgb.txt
while read line
do
bg=$(echo $line)
echo $line
echo "Trying $bg color"
xterm -bg "$bg"&amp;
sleep 5
kill -9 $!
done &lt; ~/rgb.txt

This can be used in various ways but I will leave the choice to you. One option that I should probably still tell is :

Execute a command like ls to see how the settings for dircolors would look like in the terminal. To do this change the line where we are invoking xterm to the below line:

1
xterm -bg "$bg" -e "ls &amp;&amp; sleep 5"

Do remember the sleep to some suitable time according to your needs.

Hope this helps you choose the color you want for your xterm background.

Enhanced by Zemanta