[KLUG Members] Putty and ssh

Peter Buxton somercet at fastmail.fm
Thu Feb 9 17:04:03 EST 2006


> agencies_ad1 at sancharnet.in agencies_ad1 at sancharnet.in said:
>
> When i try to login i get the following error .it logs in ok but it gives me
> this message. It works fine when i login to the server.  

> This only happens when i try to login to the server remotely using putty.

I assume you mean that local console or xdm/gdm/&c. logins work
properly, but not SSH connections (using PuTTY as an SSH client).

> ogin as: root
> Sent username "root"
> root at 67.106.233.40's password:
> Last login: Tue Feb  7 15:43:09 2006 from 67.106.233.34
> -bash: [root: command not found
> [root at ias03 ~]# 

Hmm. At a guess, you have an rc file with a line in it like:

[ $SSH_CLIENT ] && [$USER == "root" ] && do_this_command

The first use of the '[' command/operator (man bash or man test) is true
only when sshd sets the environment variable, so you don't get it at
local console. Then, the lack of a space between '[' and '$USER' borks
the second, producing your error.

Or perhaps the PS1 environment variable is misconfigured. You will need
to go through /etc/bash_profile, /etc/bashrc, and/or /etc/profile, then
in root's home dir. Placing the 'exit' command at the top of each file,
one file at a time will isolate it, if the error is not immediately
visible. And don't forget to look in any file these files source:

source foo.sh
. bar.sh

-- 
War is God's way of teaching Americans geography. -- Ambrose Bierce



More information about the Members mailing list