rcp error

I'm trying to perform a rcp to a remote machine, but it keeps throwing up "LOGNAME: undefined variable" error. When I echo $LOGNAME, it comes up with my username. I have tried setting both the .rhosts and the .hosts.equiv file but to no avail (on both machines as well out of desperation!). Anyone got any ideas?

My guess is that the error is coming from the remote system where LOGNAME is not defined. What is the rcp command that you are trying?

I have a script that searches for and then copies across new files in a certain directory. When this wasn't working I just resorted to touching a file called hello and trying to copy that across.

rcp hello username@hostname:/

What shell does the remote user have? Switch the remote user to sh or ksh. Does the problem persist? If the remote shell was csh or a clone of csh, post the contents of .cshrc.

Unfortunately we can't change the remote host from csh.
Below are the contents of the .cshrc:

set filec
setenv HOST `hostname`

#set prompt="[`hostname`:`pwd`]% "

   set prompt="[$LOGNAME@\`hostname\`:\\!]% "


    set noclobber
    set filec
    set history = 40
    set autologout = 0
    set ignoreeof
    umask 002

################################################################################
###

alias h history
alias p pushd
alias po popd
alias c clear
alias ll ls -l
alias ltr "ls -ltr"
stty erase ^H
source setup.csh

That is a terrible cshrc file. Remove the set prompt and the stty stuff. And maybe the source csh.setup depending on what's in that file.

ha ha :slight_smile:
no matter how bad, I don't have the authority to change this file! However would you recommend trying to get this moved to say .profile? Is there something in there that you think might be causing my problem - surely the set and stty stuff can't be causing it?

Yeah that's what causing it. .cshrc is run for every shell, interactive or not. And rcp need to launch a shell. Setting a prompt in a non-interactive shell does not make sense. And referencing LOGNAME isn't going to fly since login was not run. Setting up a non-existent controlling terminal isn't going to help either.

Wiping up that mess will take a csh expert and I'm not one. My suggestion is to switch to ksh. In the meantime, you won't be able to use rcp with that disfunctional account. Switch to ftp or something.

You have solved my problem! In that cshrc file, it was trying to use $LOGNAME. The problem being that LOGNAME hadn't been declared a variable.

Many thanks for all your help - you have kept me in a job!!