[英]openssh cannot create directory /home/local/<my username>/.ssh
When I try ssh [IP]
openssh warns Could not create directory '/home/local/[my username]/.ssh'
.当我尝试ssh [IP]
openssh 警告Could not create directory '/home/local/[my username]/.ssh'
。
I do have an .ssh
directory, in another path, in my actual home directory, at /home/[myusername]/.ssh
.我确实有一个.ssh
目录,在另一个路径中,在我的实际主目录中,在/home/[myusername]/.ssh
。
Why is openssh adding a local
to that home path?为什么 openssh 将local
添加到该主路径? That path does not exist.那条路不存在。 I'm on Ubuntu 16.04 my $HOME
is set properly, ie /home/[my username]
.我在 Ubuntu 16.04 上,我的$HOME
设置正确,即/home/[my username]
。
I can't find where openssh is configured to even look for that 'local' path.我找不到 openssh 的配置位置,甚至找不到那个“本地”路径。 I've grep'ed for local
under /etc/ssh/
which did not return anything.我已经在/etc/ssh/
下搜索了local
,但没有返回任何内容。
Update:更新:
getent passwd $USER
shows the wrong home path, with the 'local' in the path. getent passwd $USER
显示错误的主路径,路径中包含“本地”。 Apparently openssh uses the home path as output by that command, instead of the $HOME
environment variable to find the home directory.显然 openssh 使用主路径作为该命令的输出,而不是$HOME
环境变量来查找主目录。 I can't just edit /etc/passwd
as $USER comes from an LDAP.我不能只编辑/etc/passwd
因为 $USER 来自 LDAP。 Not sure if my IT department can edit my home path in LDAP, is there a way I can tell openssh what home path to use, ie $HOME not getent passwd $USER
?不确定我的 IT 部门是否可以在 LDAP 中编辑我的主路径,有没有办法告诉 openssh 要使用的主路径,即 $HOME 不是getent passwd $USER
?
Apparently openssh uses the home path as output by that command显然 openssh 使用主路径作为该命令的输出
I use quite often openssh
with HOME
set to a different folder than the default one, and it works without any issue.我经常使用openssh
并将HOME
设置为与默认文件夹不同的文件夹,并且它可以正常工作。
Check your other environment variables to see if there are other mentions of the wrong path in one of them.检查您的其他环境变量以查看其中一个中是否还有其他提及错误路径的内容。
As the OP comments, the issue was in the LDAP managing the account.正如 OP 所评论的,问题出在管理帐户的 LDAP 中。
It is true you can store ssh keys in LDAP, which allows SSH connection from any server where you are logged on (since your keys are fetched from LDAP)您确实可以将 ssh 密钥存储在 LDAP 中,这允许从您登录的任何服务器进行 SSH 连接(因为您的密钥是从 LDAP 获取的)
Example of LDAP schema: LDAP 架构示例:
In /usr/local/lib/ldap/schema/openssh-ltk.ldif
:在/usr/local/lib/ldap/schema/openssh-ltk.ldif
:
dn: cn=openssh-lpk,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: openssh-lpk
olcAttributeTypes: ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey'
DESC 'MANDATORY: OpenSSH Public key'
EQUALITY octetStringMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
olcObjectClasses: ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' SUP top AUXILIARY
DESC 'MANDATORY: OpenSSH LPK objectclass'
MAY ( sshPublicKey $ uid )
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.