我对 Linux 的经验有限,作为项目的一部分,我订购了一台 Linux 专用服务器。这是带有 OpenSuSE 13.2 的非托管服务器。当我尝试通过 ssh 进入服务器时,我收到一条连接被拒绝的消息
ssh: connect to host xxx.xxx... port 22: Connection refused
Run Code Online (Sandbox Code Playgroud)
我认为他们的默认图像在启动时没有启用 ssh,但我可能错了。他们提供了一个救援系统,它是一个从 ram 安装和加载的 Linux 系统,用于故障排除。当我加载它时,我可以通过 SSH 连接到系统。我可以挂载硬盘并进行更改。
我想知道如何检查和/或需要做的任何配置更改,以在恢复系统中为 OpenSuSE 13.2 启用 ssh 启动。如果需要,我可以提供任何配置文件内容。我基本上来自 Windows 背景,因此如果您能提供详细的步骤,那将很有帮助。
作为我研究的一部分,我检查了 init.d 文件,那里没有sshd文件,安装了 ssh 我猜是因为存在/etc/ssh像`/etc/ssh/sshd_config 这样的文件。
我有一台用于开发的台式机和笔记本电脑。我在主机(台式机)上为我的 vps 生成了一个使用密码短语的 ssh 密钥。就最佳实践或安全问题而言,最好在我的笔记本电脑上生成一个新的 ssh 密钥到同一个 vps,还是我应该将 ssh 密钥从台式机复制到笔记本电脑。
我读过的关于该主题的所有内容都只是解释了如何将 ssh 密钥从一台计算机复制到另一台计算机。我没有看到任何解释生成新密钥与复制现有密钥的优缺点的内容。(两台机器都由我单独使用)。
要登录ssh我这样做:
ssh -i ~/.ssh/kp1.pem ubuntu@ec2-xxxx.com
Run Code Online (Sandbox Code Playgroud)
我尝试了所有这些mosh:
mosh --ssh='ssh -i ~/.ssh/kp1.pem ubuntu@ec2-xxxx.com'
mosh -i ~/.ssh/kp1.pem ubuntu@ec2-xxxx.com
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
/usr/bin/mosh: could not get canonical name for /home/$USER/.ssh/kp1.pem: Name or service not known
ssh_exchange_identification: Connection closed by remote host
/usr/bin/mosh: Did not find remote IP address (is SSH ProxyCommand disabled?).
Run Code Online (Sandbox Code Playgroud) 我想配置iptables为仅允许端口 22 上的 SSH 来自192.168.*.*来自其他所有 IP 的 IP 和阻止。
我收到以下错误:
sudo ionice -c 3 nice -n +19 rsync -av --progress -e 'ionice -c 3 nice -n +19 ssh -l root -p 22 192.168.0.1' 192.168.0.1:/domains/remote/. /domains/local/;
root@192.168.0.1's password:
bash: 192.168.0.1: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(605) [Receiver=3.0.9]
Run Code Online (Sandbox Code Playgroud)
rsync 工作较早,现在我收到此错误。
编辑1:
root@local-debian7:/root# rsync -av --progress -e 'ssh -l root -p 22 192.168.0.1' 192.168.0.1:/domains/remote/. /domains/local/;
root@192.168.0.1's password:
bash: 192.168.0.1: command not found
rsync: connection unexpectedly …Run Code Online (Sandbox Code Playgroud) 我知道我可以为 root 用户(使用PermitRootLogin)禁用带有明文密码的 SSH 身份验证,并为所有其他用户启用它。但是我需要为某些用户列表禁用文本密码(并且只为他们保留公钥身份验证)。对于那些未包含在列表中的人,我还需要启用密码身份验证。
那么,如何为不同的用户调整不同的 SSH 策略呢?在 sshd_config 我发现只有 2 个参数:
PermitRootLogin without-password # disable text password for root
PasswordAuthentication yes # enable it for all other users
Run Code Online (Sandbox Code Playgroud)
我想要一些字典式的配置,例如:
user1Auth without-password
user2Auth without-password
user3Auth yes
...
Run Code Online (Sandbox Code Playgroud)
PS 我的操作系统是 Ubuntu 14.04。
我通常按如下方式进行 ssh 密钥认证:
# ssh-keygen -t rsa)上生成密钥ssh-copy-id或通过其他方式)我已经看到 AWS 服务器(亚马逊网络服务器)在服务器创建过程中提供了一个密钥,然后客户端可以使用它来登录。
现在我有一台服务器,我想在其中生成密钥并将其分发给我的客户。每个拥有该密钥的人都必须能够访问服务器。
我在这里错过了关于公钥/私钥的任何理论吗?
如果我运行git clone git@github.com:some-org/some-repo.git,我会收到以下提示:
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Run Code Online (Sandbox Code Playgroud)
显然,我根据https://help.github.com/articles/github-s-ssh-key-fingerprints/ 上的列表验证指纹,并回应yes:
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
...etc.
Run Code Online (Sandbox Code Playgroud)
这导致两个条目被添加到我的~/.ssh/known_hosts文件中,都具有相同的密钥,并且都经过哈希处理。
如果我用 确认密钥ssh-keyscan github.com,则密钥匹配。
但是为什么我在 中有两个条目known_hosts,而不是一个?
在虚拟rhel 7.4 上,我在尝试启动sshd 服务时遇到一个奇怪的错误。
无法启动 openssh.service: Unit not found
事实上,我在 sshd 上尝试任何操作时都会遇到同样的错误 - 启用、状态或停止
我确实尝试重新启动实例,但似乎没有任何效果。
我正在尝试将我的 Raspberry Pi 3 (Raspbian) 备份到我的台式计算机 (Windows 10 Pro)。目前我可以通过各种方式 SSH,指定私钥文件。
从 Windows SSH 到 RPi:ssh root@192.168.1.107 -i H:/ssh/BB8.OpenSSH.ppk(root 以确保我在测试期间没有权限错误)。
从 RPi SSH 进入 Windows: ssh matt@192.168.1.100 -i /home/pi/.ssh/RPi3.OpenSSH.ppk
以下 rsync 命令不起作用:(Windows > RPi)
rsync -vvvvna --exclude={"/proc/*","/sys/*","/dev/*","/boot/*","/tmp/*","/run/*","/mnt/*"} -e "ssh -i H:/ssh/BB8.OpenSSH.ppk" root@192.168.1.107:/* /cygdrive/h/Users/Matt/Documents/RPi3_Backup
Run Code Online (Sandbox Code Playgroud)
Rsync 说“连接意外关闭”,而 RPi SSH 日志说它“收到来自 192.168.1.100 的断开连接”。
同步输出:
cmd=ssh -i H:/ssh/BB8.OpenSSH.ppk machine=192.168.1.107 user=root path=/*
cmd[0]=ssh cmd[1]=-i cmd[2]=H:/ssh/BB8.OpenSSH.ppk cmd[3]=-l cmd[4]=root cmd[5]=192.168.1.107 cmd[6]=rsync cmd[7]=--server cmd[8]=--sender cmd[9]=-vvvvnlogDtpre.iLsfxC cmd[10]=. cmd[11]=/*
opening connection using: ssh -i "H:/ssh/BB8.OpenSSH.ppk" -l root 192.168.1.107 …Run Code Online (Sandbox Code Playgroud)