【发布时间】:2022-12-17 21:25:55
【问题描述】:
我用 debian bullseye 在我的 NAS 上设置了一个 git server 2.30.2。
用户是git,主目录为/media/nas/programming/git_repos/,外壳为/bin/bash。
主目录及其所有子目录/文件都归git:git 所有。
主目录具有770权限,主目录内的目录.ssh具有700权限。
我使用命令ssh-keygen -t ed25519 -C mymail@gmail.com(或第二次尝试ssh-keygen -t rsa -C mymail@gmail.com)创建私钥/公钥。
在 Windows PC 上,公钥变为 /media/nas/programming/git_repos/.ssh/authorized_keys(git:git 所有权,400 个权限),私钥变为 c:/Users/<username>/.ssh/id_ed25519(或第二次尝试 c:/Users/<username>/.ssh/id_rsa)。
在/etc/ssh/sshd_config我有一条线AllowUsers root git ...
现在,使用 Git GUI,我正在尝试使用 url url = git@10.0.0.2:my_project 连接到远程(比如说获取)。
最初它要求密码解密id_ed25519(或第二次尝试id_rsa)。
然后它询问git@10.0.0.2 的密码,这意味着 Git 服务器根本不计算 .ssh/authorized_keys。
我在这里做错了什么?
更新ssh -Tv git@10.0.0.2就不多说了:
....
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\chameleon/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\chameleon/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\chameleon/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\chameleon/.ssh/id_ed25519
debug1: read_passphrase: can't open /dev/tty: No such file or directory
Enter passphrase for key 'C:\Users\chameleon/.ssh/id_ed25519': <---- Here I give the password
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: C:\\Users\\chameleon/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@10.0.0.2's password: <---- Here I give the password. After that, connection established.
【问题讨论】:
-
嗯....我又想了想:StackOverflow适合这个问题吗?
-
ssh -Tv git@10.0.0.2? -
unix.stackexchange.com 或 superuser.com 可能更合适。
-
@chepner 谢谢。人们已经回答了。删帖合适吗?