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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-06-2004, 05:10 AM
|
#1
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Rep:
|
scp: copy a file from local machine to remote machine
Hi,
This is Seran. I tried to copy a file from my local machine to a remote machine using the scp (Secure Copy) linux command. This is what I gave:
$ scp <filename> seran@<ip address of remote>:<target dir>
It asked my password and after entering it, I got the following error message.
TERM environment variable not set
In my machine the value of the TERM environment variable is 'linux'.
Using ftp I was able to copy. Why scp is giving problem.
Can any one explain me how to trace the problem.
Thanks
Seran
seran@mindteck.com
|
|
|
08-06-2004, 05:44 AM
|
#2
|
LQ Guru
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522
Rep:
|
hi there
just check that if u can login with ssh on that machine
i think ssh needs to b running for scp to work
regards
|
|
|
08-06-2004, 09:12 AM
|
#3
|
Member
Registered: Oct 2003
Location: the Netherlands
Distribution: Arch Linux, Ubuntu server
Posts: 145
Rep:
|
If he is asked for his password, I suspect ssh is running on the destination host. If not, it's a trick I would love to learn
First of all, whenever I run into weird stuff with ssh or scp, I use the -v (verbose) option. It often enables you to see where something goes wrong and where you might find the solution. It also provides people that could help you with useful information.
Also, try to log on to the server with ssh and type
I'm just taking a poke here, but perhaps the term variable of your login is not set on the destination server. If it is not, you could edit the .profile file in your homedir yourself and add it.
|
|
|
08-06-2004, 12:50 PM
|
#4
|
LQ Guru
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522
Rep:
|
hi there
what i was saying is that is he able to log in to that machine using ssh
so we can say that ssh is running fine
regards
gaurav
|
|
|
08-09-2004, 02:00 AM
|
#5
|
LQ Newbie
Registered: Jul 2004
Posts: 13
Rep:
|
Try to set the env variable TERM using the following comand:
TERM=xterm; export TERM
Try scp now..it should work...
Cheers,
rkdugar
|
|
|
08-09-2004, 02:12 AM
|
#6
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Original Poster
Rep:
|
I did. I set the TERM env variable to xterm.
And I tried to scp. But I got the same message.
TERM environment variable not set.
In my remote machine the value of TERM is 'xterm'.
I was able to use ssh and login without any problem,
but what's wrong with scp?
Thanks
Seran
|
|
|
09-01-2005, 07:57 AM
|
#7
|
LQ Newbie
Registered: Sep 2005
Location: Durham, UK
Distribution: Fedora, Scientific Linux & Debian
Posts: 1
Rep:
|
It's a year later, so guess this isn't a directly useful answer, but I just encountered a similar problem and, since this is one of the very few places online to mention the scp / TERM variable problem, I thought I'd post the solution I found.
My problem was that in my .bashrc file I had used the "clear" shell builtin command to refresh the terminal, but the "dumb" terminal type used by scp doesn't support that operation, hence the (rather misleading) error. The answer was to only execute the "clear" if the terminal is not "dumb":
Code:
## in .bashrc
test "dumb" != $TERM && clear
## as opposed to just calling "clear" without thinking about terminal support
I initially tried to solve this by only calling clear from within an "if [ $PS1 ]; then ..." block (to detect an interactive shell) but that didn't work on all machines... some systems still set the PS1 variable even if it isn't an interactive shell.
You may also need to do a similar protection on the "trap" command, if you use that to clear the terminal on logout from a remote machine.
Hope that's helpful to someone, eventually!
Andy
|
|
|
03-22-2006, 11:37 PM
|
#8
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Original Poster
Rep:
|
I just wanted to share my solution which I found. In my remote machine's /etc/bashrc file the following three lines were present at the end.
.....
clear
/usr/games/fortune
echo
I know the root passwd of the remote machine, so I commented first, "clear" and then tried to scp from my machine. I didnt get the "TERM environment variable not set" error, but I got the fortune message on my screen and file was also not copied. Then I commented "/usr/games/fortune"(now both clear and fortune lines are commented) and tried, no error message was displayed and file was not copied.
At last I commented all the last three lines "clear", "fortune", and "echo". Now I was able to do scp.
Thanks for taking interest and giving some suggestions.
|
|
|
10-30-2007, 01:23 PM
|
#9
|
LQ Newbie
Registered: Jun 2005
Location: Spain
Distribution: SuSE 9.3, Ubuntu 5.04, FC3/4
Posts: 2
Rep:
|
For what it is worth, nearly three years on from the original thread. Bash has a variable that indicates whether the shell is interactive or not. Have a look at http://www.gnu.org/software/bash/man...ref.html#SEC75. I used the following example to detect if my shell was interactive or not:
Code:
case "$-" in
*i*) echo This shell is interactive ;;
*) echo This shell is not interactive ;;
esac
regards
grant
|
|
|
All times are GMT -5. The time now is 08:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|