I have installed CygWin v1.7.28.
The problem quickly explained: Basically, when starting a CygWin shell via remote login, the $HOME is not where it should, with all derivated (bad) consequences of it. Local consoles performs OK.
And now for the details:
If on the GUI (Windows XP) I do:
c:\CygWin\bin\bash.exe --login -i
or (same way, practically):
c:\CygWin\Cygwin.bat
I start at the correct $HOME with all my config files:
LuisRivas@portatilacer ~
$ pwd
/home/LuisRivas
LuisRivas@portatilacer ~
$ ls .* -la
-rw------- 1 LuisRivas Ninguno 108 mar 3 14:34 .bash_history
-rwxr-xr-x 1 LuisRivas Ninguno 1494 mar 3 03:00 .bash_profile
-rwxr-xr-x 1 LuisRivas Ninguno 6127 mar 3 14:28 .bashrc
-rwxr-xr-x 1 LuisRivas Ninguno 1919 mar 3 03:00 .inputrc
-rwxr-xr-x 1 LuisRivas Ninguno 1236 mar 3 03:00 .profile
$ echo $HOME
/home/LuisRivas
But if I log via SSH (Bitvise SSH Server v6 installed on Windows XP SP3) and I repeat the process (same user):
c:\CygWin\bin\bash.exe --login -i
Now the Bash Shell does not start where it should:
LuisRivas@portatilacer ~
$ echo $HOME
/cygdrive/c/Documents and Settings/LuisRivas
LuisRivas@portatilacer ~
$ pwd
/cygdrive/c/Documents and Settings/LuisRivas
LuisRivas@portatilacer ~
$ ls .* -la
-rw-------+ 1 LuisRivas Ninguno 197 mar 3 14:36 .bash_history
.:
total 1211
drwxrwx---+ 1 Administradores SYSTEM 0 mar 3 14:30 .
drwxrwxr-x+ 1 Administradores SYSTEM 0 mar 1 04:06 ..
-rw-------+ 1 LuisRivas Ninguno 197 mar 3 14:36 .bash_history
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:12 Configuración local
drwx------+ 1 LuisRivas Ninguno 0 dic 25 15:41 Cookies
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:17 Datos de programa
drwx------+ 1 LuisRivas Ninguno 0 dic 25 13:56 Entorno de red
drwx------+ 1 LuisRivas Ninguno 0 dic 25 13:56 Escritorio
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:12 Favoritos
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:02 IETldCache
drwx------+ 1 LuisRivas Ninguno 0 dic 25 13:56 Impresoras
drwx------+ 1 LuisRivas Ninguno 0 dic 25 13:56 Menú Inicio
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:12 Mis documentos
-rwx------+ 1 LuisRivas Ninguno 786432 mar 3 14:17 NTUSER.DAT
-rwx------+ 1 LuisRivas Ninguno 1024 mar 3 14:34 NTUSER.DAT.LOG
-rwxrwx---+ 1 Administradores SYSTEM 192 mar 3 14:03 ntuser.ini
drwx------+ 1 LuisRivas Ninguno 0 dic 25 15:33 Plantillas
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:12 Reciente
drwx------+ 1 LuisRivas Ninguno 0 mar 3 14:12 SendTo
That is: CygWin started the shell at my Windows home directory, so I don't have my personalizations (.bashrc, .bash_profile ... etc), like aliases.
Maybe this strange behavior is just caused by some kind of missing environment variable (that exists on GUI, but not on remote console), but I have not been able to locate it.
How could I do to make my remote console to start the Bash Shell included in CygWin where it should?
- EDIT: here some extra data upon request:
At local Bash Shell:
LuisRivas@portatilacer ~
$ id
uid=1004(LuisRivas) gid=513(Ninguno) grupos=513(Ninguno),0(root),544(Administradores),545(Usuarios)
At remote Bash Shell (nothing differs):
LuisRivas@portatilacer ~
$ id
uid=1004(LuisRivas) gid=513(Ninguno) grupos=513(Ninguno),0(root),544(Administradores),545(Usuarios)
And this is the content of /etc/passwd (only shown the user "LuisRivas" line):
LuisRivas@portatilacer ~
$ cat /etc/passwd
[Lines not needed (I think)]
LuisRivas:unused:1004:513:U-PORTATILACER\LuisRivas,S-1-5-21-789336058-1957994488-1417001333-1004:/home/LuisRivas:/bin/bash
[Lines not needed (I think)]
EDIT 2: In a first writing I was wrong: the file .bashrc at the starting path (wherever this path is) is read OK by CygWin when starting its shell. That info is deleted now.
EDIT 3: My tests have only been made on SSH remote logins, not Telnet. So came the problem: precisely from some behavior of Bitvise SSH Server (read response below).
/etc/passwd
say? Also try to issueid
in each case and let us know the result. Last, if you send remote commands via SSH, then they might be executed ascyg_server
and not as the SSH user.editrights.exe -l -u LuisRivas
andmkpasswd --local |grep LuisRivas
.