简体   繁体   English

openssh 无法创建目录 /home/local/<my username> /.ssh

[英]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.

相关问题 Wordpress文件和目录权限:无法使用我的本地用户打开或保存 - Wordpress fle & directory permissions: cannot open or save with my local user java.io.IOException:在Hadoop安装期间无法创建目录/ home / dataflair / hdata / dfs / name / current - java.io.IOException: Cannot create directory /home/dataflair/hdata/dfs/name/current during Hadoop installation 快门 - 打开目录“/home/username/Pictures”时出错 - Shutter - Error while opening directory '/home/username/Pictures' Docker:无法安装openssh-server - Docker: cannot install openssh-server Ubuntu 16 - Active Directory - 可以 ssh - 不能 rdp - Ubuntu 16 - Active Directory - Can ssh - cannot rdp 无法创建主目录。 这很可能是权限问题 - Unable to create the home directory. This is most likely a permission problem 在public_html文件夹中创建指向主目录的绝对链接 - Create absolute link to home directory in public_html folder 无法建立 ssh 连接,/bin/bash: No such file or directory - cannot establish ssh connection, /bin/bash: No such file or directory 如何允许在主文件夹中创建另一个用户的目录 - How to allow to create a directory in home folder another user 在bash中使用/ home /目录从所有用户创建菜单 - Create menu from all users with /home/ directory in bash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM