delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/02/05/20:36:43

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4C193858D35
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1707183402;
bh=9MKOpHjCrXtf/54RXviMavJi2OFu0XDeukUp/WioSqg=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=Hj3UEaqhJIbe378or00WTHnaFXkkJhxLbUX9jXSoT5RwpB1YUx4KxDQgMhfe+CJpF
ElcFP0QctVQCeGUdZmxKw5VJfIfB5Wl8TI2b7n2ubUu+YTAuaOgTSMorwwt9lqHL1K
kngzjqfFYQT6AABQ+xaJizPQsdcZzA8q9+k2/iac=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05BCF3858D33
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 05BCF3858D33
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707183379; cv=none;
b=WdrN8fOyePLIPFll7oAfgRAe8emk1Y0AViuCB/NHBIF1KYRmTuwDA3MxG9THzesS3qYyLt51rz+ZOsQn2Qd6zzsr/CbOUIuZqSTTLfFF07hxsDHSLVAkTLG+12Lfd+fVu1IW6j7f6M6ztaskDEEQb2OwlrFQBhitZuKh8LBlkIY=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1707183379; c=relaxed/simple;
bh=vbq1zVG2rsnEEdRtGJ1DfK1Z8zCJl/3PUliFz1XiLYs=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=dHcoAi5pLz7eH5CUr2Nc5as5ZhEvuEkRaMnDotA1C0qNC/SDJSuymXPuwuhahiIEz/EuXpocekrkLA5vuce/MSkIFz2YDIrxtGzxDaDgtcGKqf/7KOZUd3E7ZRXqAiE/SB0oseZ2Evec/aI72kOOtM8c2sWxzG88NXOjwfHxSWk=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-ASG-Debug-ID: 1707183376-24039d50683c1720001-w5GHUG
X-Barracuda-Envelope-From: moss AT cs DOT umass DOT edu
X-Barracuda-RBL-Trusted-Forwarder: 128.119.240.136
Message-ID: <439a4aeb-e8f8-42c7-6c35-c303a9366368@cs.umass.edu>
X-Barracuda-RBL-Trusted-Forwarder: 172.24.109.5
Date: Mon, 5 Feb 2024 20:36:16 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: cygsshd fails due to bad ownership or modes of /cygdrive/c/Users
X-ASG-Orig-Subj: Re: cygsshd fails due to bad ownership or modes of
/cygdrive/c/Users
To: Frank-Ulrich Sommer <f-u DOT s AT gmx DOT net>, cygwin AT cygwin DOT com
References: <a2df2105-31b8-425c-a963-4ea98e2f2ffa AT f-us DOT de>
<e10d1c13-b167-46b1-935d-edebcf307e9a AT gmx DOT net>
In-Reply-To: <e10d1c13-b167-46b1-935d-edebcf307e9a@gmx.net>
X-Barracuda-Connect: mailsrv.cs.umass.edu[128.119.240.136]
X-Barracuda-Start-Time: 1707183377
X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256
X-Barracuda-URL: https://barramail.cs.umass.edu:443/cgi-mod/mark.cgi
X-Barracuda-BRTS-Status: 1
X-Virus-Scanned: by bsmtpd at cs.umass.edu
X-Barracuda-Scan-Msg-Size: 3014
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0
QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.7 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.120441
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------
X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL,
KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Eliot Moss via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Eliot Moss <moss AT cs DOT umass DOT edu>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4161ahx2032391

On 2/5/2024 8:28 PM, Frank-Ulrich Sommer via Cygwin wrote:
> Looking at the OpenSSH source code (on Github, not from Cygwin) I found a function "safe_path" that checks that the 
> ownership and access modes for all path components are correct.  This relies on "platform_sys_dir_uid" which checks if a 
> UID may own a system directory. The code checks for UID zero and might also accept an OS specific second value 
> (PLATFORM_SYS_DIR_UID) but for Cygwin this seems not to be set. But I don't know where to find the source code for the 
> excat version that is used in Cygwin and I'm unsure about build settings.
> 
> A comment defines this a safe path as follows:
> "This is defined as all components of the path to the file must be owned by either the owner of the file or root and no 
> directories must be group or world writable."
> 
> The "Users" directory is owned by "SYSTEM" (numeric: 18 according to stat) and only writable by Administrators and 
> SYSTEM. The mode cygwin shows for /cygdrive/c/Users is 0750 which should be OK.
> 
> So my question is: are "Administrators" and "SYSTEM" different users and does cygsshd accept SYSTEM (numeric 18) as a 
> valid user who may own system directories? If the numeric ID is really 18 I can't see how this check can succeed but I'm 
> not sure the code used in Cygwin is the same.
> 
> On 05.02.2024 00:53, Frank-Ulrich Sommer via Cygwin wrote:
>> Hi,
>>
>> I'm trying to run cygsshd on my PC with Windows 11 and connect from a linux machine. I have added the public key to 
>> /cygdrive/c/Users/xxx/.ssh/authorized_keys and created a symbolic link from  /cygdrive/c/Users/xxx/.ssh to 
>> /home/xxx/.ssh. As usual I checked the access rights and mode of the .ssh directory (700 and belongs to user xxx) and 
>> the authorized_keys file (600 and also belongs to user xxx) and also of the home directory (had to change ownership).
>>
>> Now I get the following strange messages:
>>
>> [...]
>> Feb  5 00:35:50 XXXXX sshd: PID 2798: debug1: temporarily_use_uid: 197609/197121 (e=18/18)
>> Feb  5 00:35:50 XXXXX sshd: PID 2798: debug1: trying public key file /home/xxx/.ssh/authorized_keys
>> Feb  5 00:35:50 XXXXX sshd: PID 2798: debug1: fd 5 clearing O_NONBLOCK
>> Feb  5 00:35:50 XXXXX sshd: PID 2798: Authentication refused: bad ownership or modes for directory /cygdrive/c/Users
>> Feb  5 00:35:50 XXXXX sshd: PID 2798: debug1: restore_uid: 18/18
>> [...]
>>
>> Why is cygsshd complaining about the Windows "Users" directory and not about the directory of user xxx 
>> (/cygdrive/c/Users/xxx)? And how can I solve this?
>>
>> Frank

Administrators and SYSTEM are not the same.  And neither is exactly equivalent
to the concept of root in POSIX.  SYSTEM (in my experience) is used for things
like backup tools that needs access to almost every file.  Administrators is for
system administration.  I don't have deep knowledge of all of this - others can
give a deeper / more nuanced answer.

Eliot Moss


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019