Solved: TERM environment variable not set during scp.

One of the interesting issue you may face is while scp, you get an error message and the file copy is skipped.

I. Error Message

[userA@NGEL-userA saket]$ scp userA@10.167.229.11:/tmp/NGEFTP.log_ngelinux001.tar.gz /tmp/
[userA@NGEL-userA saket]$ TERM environment variable not set.
[userA@NGEL-userA saket]$

 

II. Solution
a. Check out the term variable.

$ set | grep TERM
TERM=xterm

 

b. If TERM is set, it means the ssh session read out some commands in login profile file which needs a terminal.
Hence the issue here is with some echo, clear, etc commands in your .bashrc, .cshrc, or .bash_profile file.

Let me clear the text i have in my .cshrc file.

[userA@ngelinux001 ~]$ cat .cshrc
echo "Welcome $USER"
clear

[userA@ngelinux001 ~]$ vi .cshrc
[userA@ngelinux001 ~]$

[userA@ngelinux001 ~]$ logout
Connection to 10.167.229.11 closed.

 

III. Issue resolved: Test now

[userA@NGEL-userA saket]$ scp -P 10022 userA@10.167.229.11:/tmp/NGEFTP.log_ngelinux001.tar.gz /tmp/
NGEFTP.log_ngelinux001.tar.gz                                                            100% 1002KB   1.0MB/s   00:00
[userA@NGEL-userA saket]$
1 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments