Discussion:
scp sourcing .tcshrc???
(too old to reply)
jonathan
2003-11-12 01:00:08 UTC
Permalink
hey,

I just noticed whilst copying items that scp sources my cshrc file, goes through
the tcshrc file as well - just to copy some files.

my question is:

1) why?
2) how do I stop this from happening?

Thanks much,

jon
Neil W Rickert
2003-11-12 01:08:47 UTC
Permalink
Post by jonathan
I just noticed whilst copying items that scp sources my cshrc file, goes through
the tcshrc file as well - just to copy some files.
1) why?
It is part of unix security, that commands are executed using your
login shell.

Your shell sources these files on startup.
Post by jonathan
2) how do I stop this from happening?
Maybe change to a different shell. Or delete the files that you
don't want sourced.
jonathan
2003-11-12 19:42:38 UTC
Permalink
Post by Neil W Rickert
Post by jonathan
I just noticed whilst copying items that scp sources my cshrc file, goes through
the tcshrc file as well - just to copy some files.
1) why?
It is part of unix security, that commands are executed using your
login shell.
Your shell sources these files on startup.
Post by jonathan
2) how do I stop this from happening?
Maybe change to a different shell. Or delete the files that you
don't want sourced.
... or maybe just putting a hook into SSH/SCP which tells you what
command you are using, and put it in the environment so that I could
say in your .tcshrc:

if ($?SCP_CONNECTION) then
exit
endif

? That seems a little bit more promising an idea than forcing people
to change their environment just to fit the tool, rather than the
other way around?

jon
Nico Kadel-Garcia
2003-11-15 15:12:42 UTC
Permalink
Post by Neil W Rickert
Post by jonathan
I just noticed whilst copying items that scp sources my cshrc file, goes through
the tcshrc file as well - just to copy some files.
1) why?
It is part of unix security, that commands are executed using your
login shell.
Your shell sources these files on startup.
This is because the "scp" function rely lives on top of "ssh", which uses a
shell. Also, the .tcshrc or .profile or other .files depending on your shell
may set alternative $HOME or umask settings on an individual user basis.
This would affect the behavior of both ssh and scp.
Post by Neil W Rickert
Post by jonathan
2) how do I stop this from happening?
Maybe change to a different shell. Or delete the files that you
don't want sourced.
Or check in your .tcshrc if you're in an interactive session (look for a
$TERM) before executing whatever bit of fun is interfering with your scp
sessions. I've seen way, way, way too many badly written .cshrc files that
interfere with ssh and scp and cvs or rsync over ssh because they spewed
"announcements" for no reason on non-interactive connections.

Loading...