From owner-freebsd-questions@freebsd.org Sat Sep 14 11:20:44 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 743BCF138F for ; Sat, 14 Sep 2019 11:20:44 +0000 (UTC) (envelope-from mafsys1234@gmail.com) Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Vqn75XQmz3Lv4 for ; Sat, 14 Sep 2019 11:20:43 +0000 (UTC) (envelope-from mafsys1234@gmail.com) Received: by mail-pf1-x429.google.com with SMTP id b13so19669595pfo.8 for ; Sat, 14 Sep 2019 04:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=nW6qMt+VXAY9AWOG5E6/MlyywmaCyvtjRbIFi9FF/O0=; b=rflX3W8n9PmI3oy54e0K3awbGprUU46QkEF1uFzv/CVznKjtA4vwBQUfnojdFtbxL2 uBVFZEVxVBrOvZtw5dweYXCaiSdvvTTqzuMtJRIhdMJSKxOKr+ldgxPqNpKkC5/wN7dF PfrwLSlpcHN+Bglll+Ia+OivO46mPR6nOFYxfQ76RBuJ+djQPIe1w2a9iZRX/+CEN9RV R1BFkbD3zKZlfMPP+SmJKO3J5XEYsLNnfKDk/UzkHHptqpuNSs62STlgF3hl1pGcnMlF QJkky87GiUDlpb6VkqYCOnqkDoLsKTDkux9XuAiOTMzFmYG4ty/QrAdOpAprYmitWK/C QB9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nW6qMt+VXAY9AWOG5E6/MlyywmaCyvtjRbIFi9FF/O0=; b=jg4D139DFPGPXqo8FviIjwp7swHlvbYDJ7k8UJB42+CWLyXU2r2oTwobET9SAIdqI9 NVUSOuUHMnXxlaFvVTg1OkMuGQXnuP2+Jbk/R4a+UtmQNqaQjjiKI8UwjNJnDcw63Aza 6uS4v3hC6lj9+v+RbY8U+aWEy1ipraSYWWSjTh4y4JlSBju4ZPwGNw58BGws19kIcLNX yFjyj6uhSvNq1b8pUHIwf/vsF7wcD5JV+CQLTY7uU79vAQA3XBOSTSRGYuj4ZBLVW/+D WnnY0OxlAXfnriAztuW+Zjyw3wF3D3eeUA7k3ikRpEj62POkueF8wyiBjsfaAWEwpCgH gvrg== X-Gm-Message-State: APjAAAWxdX2zYsfjgJRwaZtwU1FrYpLp0l5/kxHcTHGPre5wXDz65nZM DHBzi9Pt7dAgarq8DICgMxsJ5fZX X-Google-Smtp-Source: APXvYqxiMBJ2aIa8snw1ENfpV0SBOlES5xncIV0TVmUMs61Et5K7XG0INs8ugJJLl2Ezy0lc0QtMEA== X-Received: by 2002:a62:1888:: with SMTP id 130mr23949509pfy.72.1568460042052; Sat, 14 Sep 2019 04:20:42 -0700 (PDT) Received: from [192.168.1.10] (C-59-101-201-178.bur.connect.net.au. [59.101.201.178]) by smtp.gmail.com with ESMTPSA id j9sm6372437pff.128.2019.09.14.04.20.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Sep 2019 04:20:41 -0700 (PDT) Subject: Re: OT: My ssh authorized_keys doesn't work with nfs/nis To: freebsd-questions@freebsd.org References: <0b5eed49-986a-d40e-7df9-971a47cb500e@FreeBSD.org> From: MJ Message-ID: Date: Sat, 14 Sep 2019 21:20:10 +1000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46Vqn75XQmz3Lv4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=rflX3W8n; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mafsys1234@gmail.com designates 2607:f8b0:4864:20::429 as permitted sender) smtp.mailfrom=mafsys1234@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[178.201.101.59.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(0.00)[ip: (-8.23), ipnet: 2607:f8b0::/32(-2.70), asn: 15169(-2.24), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[9.2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2019 11:20:44 -0000 On 14/09/2019 9:09 pm, Aryeh Friedman wrote: > On Sat, Sep 14, 2019 at 6:50 AM Matthew Seaman wrote: > >> On 14/09/2019 08:39, Aryeh Friedman wrote: >>> My ~/.ssh/authorized_keys files works fine on a machine that is not in my >>> NIS domain but when I copy my id_rsa.pub (which is what I did to create >> the >>> non-NIS authorized_keys) to my NIS account and give it the same >> permissions >>> as the working machine it insists on asking for a password. >>> >>> ssh faraway (non-NIS machine) >>> does not ask for a password >>> but >>> ssh nearby (NIS machine) does >>> >>> Both have identical authorized keys and both (and their parent dirs) are >>> set to 644. Both machines are FreeBSD 11 and the machine doing the ssh >>> call is FreeBSD 12 >>> >> >> Check the ownership / permissions on ~/.ssh on the machine where key >> based auth is not working -- sshd will refuse to use authorized_keys if >> it thinks permissions are too loose. >> > > I don't think you can make them any tighter then this and not get errors: > > aryeh% id > uid=1001(aryeh) gid=1001(aryeh) groups=1001(aryeh),0(wheel),1003(aegis) > aryeh% ls -ld .ssh > drwx------ 2 aryeh aryeh 512 Sep 14 06:49 .ssh > aryeh% ls -l .ssh > total 16 > -rw------- 1 aryeh aryeh 792 Sep 14 05:02 authorized_keys > -rw------- 1 aryeh aryeh 1675 Aug 30 11:09 id_rsa > -rw------- 1 aryeh aryeh 396 Aug 30 11:09 id_rsa.pub > -rw------- 1 aryeh aryeh 545 Sep 14 03:19 known_hosts > > >> Also check for authorized_keys related settings in /etc/ssh/sshd_config >> -- it is not uncommon to require authorized_keys to be installed in some >> centralized, root owned directory that individual users don't have write >> access to. >> > > I am using the default out of the box /etc/sshd_config for 11 and 12 that > has only two uncommented out configs: > > AuthorizedKeysFile .ssh/authorized_keys > Subsystem sftp /usr/libexec/sftp-server On mine (2 I looked at): 1 has ~/.ssh/authorized_keys and the other has it commented out. Both work. That path doesn't look right. Shouldn't it be either "~/" or "%h/"? > > So unless I am reading the first one completely wrong then it uses > ~user/.ssh/authorized_keys which is what the ls above is of. > > >> Cheers, >> >> Matthew >> >> >