我注意到关于密码的一个奇怪的(好吧,据我所知)事情。例如,如果我在登录时输入了错误的密码,系统会延迟几秒钟才告诉我。当我尝试sudo使用错误的密码时,我还必须等待 shell 说“对不起,再试一次”。
我想知道为什么“识别”不正确的密码需要这么长时间?这已经在我使用的几个发行版(甚至 OSX)上看到了,所以我认为这不是发行版特定的东西。
我们有一个 Windows 批处理脚本,它通过 PLINK(腻子)自动连接到 linux 服务器。没有公私钥认证,用户和密码在脚本中。
在我们的 linux 服务器上,我们有几个 sshd 日志条目(/var/log/messages):
sshd[7645]: Connection closed by xxx [preauth]
Run Code Online (Sandbox Code Playgroud)
出现这种消息的原因可能是什么?
“preauth”应该是“预认证”的意思吗?
有时在条目中,“关闭者”中有windows客户端的ip地址,另一种时候在“关闭者”中有linux服务器的ip地址。有人知道消息中客户端IP地址和主机IP地址的区别吗?
我需要允许用户martin切换到martin-test没有密码的用户
su - martin-test
Run Code Online (Sandbox Code Playgroud)
我认为这可以在/etc/pam.d/su. 该文件中已经有一些可以取消注释的行。但是,我不喜欢将 user 添加martin到 group的想法wheel。我不希望给martin任何更多的特权,而不是能够切换到martin-test。我也不想用sudo。
在保持用户权限martin最小的情况下,最好的方法是什么?
是否可以找出用于访问帐户的 ssh 密钥?我在服务器上有一个帐户,我让几个(受信任的!)人可以通过 ssh 访问该帐户。我发现能够知道谁登录以及何时登录很有用。我有 root 访问权限,所以我可以查看日志,但那里似乎没有任何内容。是否有一些配置开关可以通过某种方式识别日志中的密钥?
我对/etc/ssh/sshd_config. 我想要下一个行为:
如果我设置PasswordAuthentication no我的第一点是满意的,但不是第二点。有没有办法PasswordAuthentication no只为root设置?
我想向 Red Hat Linux 添加一个用户,该用户不会使用密码登录,而是使用公钥进行 ssh。这将在命令行上。
每次通过 ssh 连接到远程服务器时,我都需要提供密码。我使用以下命令将我的公钥 (id_dsa.pub) 复制到远程服务器:
ssh-copy-id -i id_dsa.pub user@server
Run Code Online (Sandbox Code Playgroud)
我检查它是否正确添加到authorized_keys。所有文件/目录权限都正确:
~user 755
~user/.ssh 700
~user/.ssh/authorized_keys 640
~user/.ssh/id_dsa.pub 644
Run Code Online (Sandbox Code Playgroud)
/etc/ssh/sshd_config 中的 PasswordAuthentication 字段设置为 yes。我将 sshd 置于调试模式并将详细开关添加到 ssh 命令。我的印象是服务器没有尝试使用 id_pub.dsa 因为线路
Skipping ssh-dss key: ........... not in PubkeyAcceptedKeyTypes
Run Code Online (Sandbox Code Playgroud)
服务器端没有加密光盘。任何想法如何进步?这是 ssh 守护进程调试信息:
sudo /usr/sbin/sshd -d
====
debug1: sshd version OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: key_parse_private2: missing begin marker
debug1: read …Run Code Online (Sandbox Code Playgroud) 当我尝试使用 mutt 登录 gmail 时,它会闪烁一个带有 url 的快速 Webalert,例如 accounts.gmail.com 之类的。我看或复制它太快了。然后它说登录失败。
然后我收到一封来自 Gmail 的电子邮件,内容是:
Google Account: sign-in attempt blocked
Hi Adam,
We recently blocked a sign-in attempt to your Google Account [a...@gmail.com].
Sign in attempt details
Date & Time: Wednesday, December 10, 2014 11:55:21 PM UTC
Location: Utah, USA
If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that …Run Code Online (Sandbox Code Playgroud) 编辑
此处暴露的问题已解决(关于文件
.ssh夹的文件模式。但另一个问题仍然存在,所以我创建了一个新问题:>无法使用 SSH-RSA 密钥登录
我无法再连接特定用户的 ssh-rsa 密钥,但它仍然适用于其他用户。
该git定义如下用户:
# cat /etc/passwd | grep git
git:x:1002:1002:,,,:/var/git:/bin/bash
Run Code Online (Sandbox Code Playgroud)
所以你注意到这是 git 用户,因此它的家是/var/git,它不在/home.
现在,ssh 总是提示我输入密码:
$ ssh git@srv
git@srv's password:
Run Code Online (Sandbox Code Playgroud)
我检查了日志:
# tail -n 1 /var/log/auth.log
[...] Authentication refused: bad ownership or modes for file /var/git/.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)
因此authorized_keys,某些所有权或模式配置错误。我不明白,因为这里是这个文件的 conf :
# ls -l /var/git/.ssh/ | grep auth
-rw-rw-r-- 1 git git 394 mai 22 17:39 authorized_keys
Run Code Online (Sandbox Code Playgroud)
这是(以防……)父.ssh目录:
# ls -al /var/git/ | …Run Code Online (Sandbox Code Playgroud) 是ssh abc@servername从不同ssh Abc@servername?用户名的大小写在 Unix 中重要吗?
我的用户通过 LDAP 进行身份验证。