public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ssh confused about home directory?
@ 2019-02-19 19:25 Boylan, Ross
  2019-02-19 19:28 ` Boylan, Ross
  2019-02-19 20:42 ` Andrey Repin
  0 siblings, 2 replies; 5+ messages in thread
From: Boylan, Ross @ 2019-02-19 19:25 UTC (permalink / raw)
  To: cygwin

I recently installed cygwin on Win 10, both 64 bit.
When I run ssh in a cygwin shell it complains
             Could not create directory '/home/rdboylan/.ssh'.
The /home directory is empty--that is, it has no rdboylan subdirectory.
My home directory appears to be /cygdrive/c/Users/rdboylan; that is the value of $HOME and where I end up when I do cd.
As far as I can tell from the docs, having c:/Users/rdboylan as home is fine, but ssh doesn't seem to be respecting it.

/etc/nsswitch.conf has no uncommented lines and /etc/passwd does not exist (both being ways to define the home directory on cygwin according to the internet).

In a Windows Command Prompt %HOME% is C:\Users\rdboylan

What's the most appropriate way to fix this problem?

Thanks.
Ross

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ssh confused about home directory?
  2019-02-19 19:25 ssh confused about home directory? Boylan, Ross
@ 2019-02-19 19:28 ` Boylan, Ross
  2019-02-20 12:01   ` Houder
  2019-02-19 20:42 ` Andrey Repin
  1 sibling, 1 reply; 5+ messages in thread
From: Boylan, Ross @ 2019-02-19 19:28 UTC (permalink / raw)
  To: cygwin

[Answering my own question after better searching]
Same question asked and answered in the thread starting https://cygwin.com/ml/cygwin/2016-06/msg00400.html.
The answer is to set db_home in nsswitch.conf.

Comment: the current behavior strikes me as unfortunate and surprising.

________________________________________
From: Boylan, Ross
Sent: Tuesday, February 19, 2019 11:15:47 AM
To: cygwin@cygwin.com
Subject: ssh confused about home directory?

I recently installed cygwin on Win 10, both 64 bit.
When I run ssh in a cygwin shell it complains
             Could not create directory '/home/rdboylan/.ssh'.
The /home directory is empty--that is, it has no rdboylan subdirectory.
My home directory appears to be /cygdrive/c/Users/rdboylan; that is the value of $HOME and where I end up when I do cd.
As far as I can tell from the docs, having c:/Users/rdboylan as home is fine, but ssh doesn't seem to be respecting it.

/etc/nsswitch.conf has no uncommented lines and /etc/passwd does not exist (both being ways to define the home directory on cygwin according to the internet).

In a Windows Command Prompt %HOME% is C:\Users\rdboylan

What's the most appropriate way to fix this problem?

Thanks.
Ross

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ssh confused about home directory?
  2019-02-19 19:25 ssh confused about home directory? Boylan, Ross
  2019-02-19 19:28 ` Boylan, Ross
@ 2019-02-19 20:42 ` Andrey Repin
  2019-02-20  6:31   ` Thomas Wolff
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Repin @ 2019-02-19 20:42 UTC (permalink / raw)
  To: Boylan, Ross, cygwin

Greetings, Boylan, Ross!

> I recently installed cygwin on Win 10, both 64 bit.
> When I run ssh in a cygwin shell it complains
>              Could not create directory '/home/rdboylan/.ssh'.
> The /home directory is empty--that is, it has no rdboylan subdirectory.
> My home directory appears to be /cygdrive/c/Users/rdboylan; that is the
> value of $HOME

This is the answer.
You rely on your shell being smart enough to pick environment variable as
operational directive, but SSH knows nothing about it and fails.

> and where I end up when I do cd.
> As far as I can tell from the docs, having c:/Users/rdboylan as home is
> fine, but ssh doesn't seem to be respecting it.

> /etc/nsswitch.conf has no uncommented lines and /etc/passwd does not exist

Which explains the failure.

> (both being ways to define the home directory on cygwin according to the internet).

> In a Windows Command Prompt %HOME% is C:\Users\rdboylan

> What's the most appropriate way to fix this problem?

Configure Cygwin's NSS to your heart's content.

Speaking of which, if you move $HOME outside Cygwin root, I would strongly
suggest spending some time in fstab, setting up cygdrive to noacl mode.
F.e.
none /cygdrive cygdrive noacl,binary,nouser,posix=0 0 0


-- 
With best regards,
Andrey Repin
Tuesday, February 19, 2019 23:04:19

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ssh confused about home directory?
  2019-02-19 20:42 ` Andrey Repin
@ 2019-02-20  6:31   ` Thomas Wolff
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Wolff @ 2019-02-20  6:31 UTC (permalink / raw)
  To: cygwin

Am 19.02.2019 um 21:08 schrieb Andrey Repin:
> Greetings, Boylan, Ross!
>
>> I recently installed cygwin on Win 10, both 64 bit.
>> When I run ssh in a cygwin shell it complains
>>               Could not create directory '/home/rdboylan/.ssh'.
>> The /home directory is empty--that is, it has no rdboylan subdirectory.
>> My home directory appears to be /cygdrive/c/Users/rdboylan; that is the
>> value of $HOME
> This is the answer.
> You rely on your shell being smart enough to pick environment variable as
> operational directive, but SSH knows nothing about it and fails.
>
>> and where I end up when I do cd.
>> As far as I can tell from the docs, having c:/Users/rdboylan as home is
>> fine, but ssh doesn't seem to be respecting it.
>> /etc/nsswitch.conf has no uncommented lines and /etc/passwd does not exist
> Which explains the failure.
But it does not excuse it. That's background information while the 
authoritative guide for users should be the manuals. The ssh manual 
refers to ~, without defining what that exactly means. The bash manual 
defines ~ to be equivalent with $HOME which also sometimes fails in 
bash. Documentation and behaviour is inconsistent, probably because in 
other POSIX systems, there are typically not so many variations in 
setting up $HOME, or ~, whichever...

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ssh confused about home directory?
  2019-02-19 19:28 ` Boylan, Ross
@ 2019-02-20 12:01   ` Houder
  0 siblings, 0 replies; 5+ messages in thread
From: Houder @ 2019-02-20 12:01 UTC (permalink / raw)
  To: cygwin

On Tue, 19 Feb 2019 19:24:38, Boylan, Ross"  wrote:
> [Answering my own question after better searching]
> Same question asked and answered in the thread starting https://cygwin.com/=
> ml/cygwin/2016-06/msg00400.html.
> The answer is to set db_home in nsswitch.conf.
> 
> Comment: the current behavior strikes me as unfortunate and surprising.

Surprisng?

.. and you have read?

    https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-passwdinfo

where it reads:

So, what settings can we perform with /etc/nsswitch.conf? Let's start with
 an example /etc/nsswitch.conf file set up to all default values:

  # /etc/nsswitch.conf
  passwd: files db
  group:  files db

  db_enum:  cache builtin
  db_home:  /home/%U <=========
  db_shell: /bin/bash
  db_gecos: <empty>

Perhaps you can infer this default from:

    https://cygwin.com/

where it reads: Cygwin - Get this __Linux__ feeling ...

Henri


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-20  8:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 19:25 ssh confused about home directory? Boylan, Ross
2019-02-19 19:28 ` Boylan, Ross
2019-02-20 12:01   ` Houder
2019-02-19 20:42 ` Andrey Repin
2019-02-20  6:31   ` Thomas Wolff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).