# [Solved] Message from scp:  setterm:  $TERM is not defined.

## John R. Graham

Following the instruction in the ssh man pages, I've set up an RSA authenticated login from one of my Gentoo boxes to another.  This works fine:  I can SSH into the box with no error messages at all:

```
ceres ~ # ssh mercury

Last login: Sun Mar 18 12:03:42 2007 from graham.homelinux.net

mercury ~ # exit

logout

Connection to mercury closed.
```

But, if I copy a file between the machines with scp, I get an error message, although the copy succeeds:

```
ceres ~ # scp portage.py.patch mercury:/root/

setterm: $TERM is not defined.

portage.py.patch                              100%  518     0.5KB/s   00:00

ceres ~ #  
```

The return code from scp is zero and the file is copied okay.  I also get this message from certain other tools that use SSH.

Surely this is just a configuration setting somewhere that I'm missing, but I've looked and I can't seem to track it down.  Have any of you all encountered this?

- JohnLast edited by John R. Graham on Mon Mar 19, 2007 11:56 am; edited 1 time in total

----------

## Hu

Are you invoking setterm in your login scripts?  scp apparently does not set the environment variable TERM, and setterm is reacting to that by printing a diagnostic.  Try having your login script not call setterm for non-interactive shells.

----------

## John R. Graham

Yes, I am.  The /etc/skel/.bashrc contains the following snippet before anything else:

```
# Test for an interactive shell.  There is no need to set anything

# past this point for scp and rcp, and it's important to refrain from

# outputting anything in those cases.

if [[ $- != *i* ]] ; then

    # Shell is non-interactive.  Be done now!

    return

fi
```

but my ~/.bashrc didn't.  It's not something I think I would've deleted, but, well, it was missing.  Adding it back fixed the problem, though.  Thanks.

- John

----------

