我刚刚在我的服务器上安装了 Ubuntu 14.04,当我在我的sshd_config
文件中遇到这个时,我正在设置我的所有配置文件:
# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
Run Code Online (Sandbox Code Playgroud)
这让我非常担心。我认为有人可以在没有密码的情况下以 root 身份登录我的服务器。
我尝试通过以下方式以 root 用户身份连接到我的服务器:
johns-mbp:~ john$ ssh root@192.168.1.48
The authenticity of host '192.168.1.48 (192.168.1.48)' can't be established.
RSA key fingerprint is 40:7e:28:f1:a8:36:28:da:eb:6f:d2:d0:3f:4b:4b:fe.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.48' (RSA) to the list of known hosts.
root@192.168.1.48's password:
Run Code Online (Sandbox Code Playgroud)
我输入了一个空白密码,但它没有让我进入,这让我松了一口气。所以我的问题是:没有密码意味着什么,为什么这是 Ubuntu 14.04 中的默认设置?
我尝试按照此处的说明进行操作:http : //lani78.wordpress.com/2008/08/08/generate-a-ssh-key-and-disable-password-authentication-on-ubuntu-server/
只允许在服务器上使用公钥的用户进行身份验证,但我无法让 SSH 禁止仅使用用户名/密码登录。
这是我的 sshd_config 文件 - 我错过了什么吗?我已经尝试重新启动 SSH 和计算机本身。
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size …
Run Code Online (Sandbox Code Playgroud) 我改变了配置:
/etc/ssh/sshd_config
Run Code Online (Sandbox Code Playgroud)
但更改仅在重新启动服务器后应用。如何在不重新启动的情况下应用更改?
我是 Ubuntu 的新手并尝试启动 sshd,但遇到了很多问题。我尝试通过运行sudo apt-get remove openssh-client openssh-server
和 来卸载并重新安装 ssh
sudo apt-get install openssh-client openssh-server
。当我运行时,sudo service ssh restart
我得到:
stop: Unknown instance:
ssh start/running, process 3638
Run Code Online (Sandbox Code Playgroud)
sudo service sshd start
给我unrecognized service
。
当我跑步时,ps -A | grep ssh
我什么也得不到。运行ssh localhost
让我连接被拒绝。
安装 openssh-server 后,每次启动时服务器都会启动。如果我希望它是手动的,我需要做什么?
在 upstart 的 0.6.7+ 版本中,我会在作业文件中添加一个“手动”节。
10.04 有新贵 0.6.5-8。在这种情况下,禁用 ssh 自动启动的首选方法是什么?
When I try to tail -f catalina.out
, I get the error:
tail: inotify cannot be used, reverting to polling: Too many open files
Run Code Online (Sandbox Code Playgroud)
I tried the answer in this post: Too many open files - how to find the culprit
lsof | awk '{ print $2; }' | sort -rn | uniq -c | sort -rn | head
Run Code Online (Sandbox Code Playgroud)
When I ran the above command, the output was
17 6115
13 6413
10 6417
10 6415
9 6418
9 6416 …
Run Code Online (Sandbox Code Playgroud) 我的问题是:我从系统上成功开发了基于 RSA 密钥的 ssh 登录。当客户端第一次登录时,询问私钥和密码也可以正常工作。第二次登录时,ssh 不询问私钥或密码,直接在船上登录。
客户端使用 Ubuntu 16.04 并在板上自定义 Ubuntu。
首次使用以下命令登录:
ssh -i ~/.ssh/id_rsa user@board_ip
//工作正常
第二次:
ssh user@board_ip
//从不询问密码和公钥 -问题
第一次:
ssh user@board_ip
//没有密钥无法登录 - 工作正常
根据我的理解,我在板上的sshd_config文件中出错了。我玩了以下设置,但一直失败。
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#PasswordAuthentication yes
PermitEmptyPasswords no
Run Code Online (Sandbox Code Playgroud)
项目要求是安全登录,主要是ssh。为了实现更安全的基于 SSH 密码的登录,我们转向了基于密钥的登录。如上所述,更改所有配置后。SSH 登录也需要私钥和密码。注销后重新登录一段时间后,ssh不需要密钥或密码,项目要求每次都需要密钥和密码。
在旧版本的 Ubuntu 中,我注释掉了 /etc/init/ssh.conf 中的“start on ...”行。这运行良好,但不适用于 Ubuntu 15.04。
我有一台运行 Ubuntu 18.04 LTS 的机器,但我似乎无法让 SSH 服务器工作。
我使用以下命令安装了 SSHServer:
sudo apt install openssh-server
Run Code Online (Sandbox Code Playgroud)
但当我尝试启动和/或检查状态时,我收到以下信息:
sudo systemctl start sshd
Failed to start sshd.service: Unit sshd.service not found.
Run Code Online (Sandbox Code Playgroud)
。
sudo systemctl status sshd
Unit sshd.service could not be found.
Run Code Online (Sandbox Code Playgroud)
我想我安装时一定做错了什么(打字错误?),所以我尝试再次安装:
sudo apt install openssh-server
Run Code Online (Sandbox Code Playgroud)
我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssh-server is already the newest version (1:7.6p1-4ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)
所以,看起来它已经安装了,但由于某种原因 Ubuntu 找不到它。
我不知道从这里去哪里,所以欢迎任何建议。
谢谢,
艾伦.