Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
May 2, 2006, 8:41 pm
rate this thread
access to a system and not have the login from ssh consult the users
.cshrc file. The remote user is setup to use a csh but I would like to
setup so when users access the systems directly the .cshrc file is
consulted but remote access the .cshrc file is not consulted.
Is that possible???
Re: using ssh to log into a server and not source the .cshrc file
There is a relatively simple (yet not completely safe) way to do this.
You write a wrapper for csh in Bourne shell and make it the default
shell for your users. The wrapper checks for the existence of the
SSH_TTY environment variable to determine whether a user is logging
in remotely over ssh. In case of a remote login, the original .cshrc
is moved/renamed in order to prevent csh from reading it. In order
to get .cshrc back to its place, a temporary .cshrc is created, which
simply moves the original back when csh is executed.
Here is the wrapper script ( USE AT YOUR OWN RISK! ):
# Test whether user is logging in through an SSH connection
if [ "$SSH_TTY" ]; then
if mv "$HOME/.cshrc" "$HOME/.cshrc.0"; then
echo mv \"$HOME/.cshrc.0\" \"$HOME/.cshrc\" >"$HOME/.cshrc"
# Finally, execute /bin/csh
- » Using "command" auth keys option to process scp operations
- — Previous thread in » Secure Shell Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — Newest thread in » Secure Shell Forum