让我们假设以下内容。我们有一个可以通过 SSH 访问的服务器。有一个用户/etc/passwd拥有有效的登录 shell(例如/bin/bash,而不是像 那样的无效登录shell /bin/false)。
此用户*在 的第二个(密码)字段中有一个星号 ( ) /etc/shadow。如果该用户的~/.ssh/文件夹中没有 ssh 密钥,是否可以通过某种方式通过 SSH 登录?
或者,稍微改写一下这个问题:当*密码字段中有一个时,许多在线指南建议禁用登录 shell 的原因是/etc/shadow什么?
我正在使用 CentOS 服务器。
我想测试如何通过踢自己(root)用户来踢用户。
我使用killall -u root了它,正如预期的那样,它把我从服务器上踢了出去。但是我无法再访问服务器:
root@kali:~# ssh 383.123.418.10
ssh: connect to host 383.123.418.10 port 22: Connection refused
Run Code Online (Sandbox Code Playgroud)
并且所有托管在该服务器上的网站(cPanel 和 WHM)都已关闭。
我该如何解决?
今天我发现了一个正在运行的 ssh 进程,而几天前还没有。谁能知道这是在做什么?
ssh -x -a -oClearAllForwardings=yes -2 ssh@172.30.0.56 -s sftp
Run Code Online (Sandbox Code Playgroud) 美好的一天,我一整天都在阅读类似的主题,但不幸的是找不到适合我情况的答案。所以这就是我想要做的。我有很多函数的 shell 脚本,其中一个函数假设调用 ssh-agent:
sh_agent_run () {
case "$(pidof ssh-agent | wc -w)" in
0) echo "SSH agent is not running. Startting SSH agent."
eval `ssh-agent -s`
ssh-add ${ssh_key}
;;
1) echo "SSH agent is running. Nothing to do."
;;
*) echo "Too much instances of SSH agent is running. Stopping SSH agent instances and running just one"
while pidof ssh-agent; do
echo "Stopping ssh-agent..."
killall -9 ssh-agent
sleep 1
done
echo "Starting valid SSH agent instance"
eval `ssh-agent -s` …Run Code Online (Sandbox Code Playgroud) 我正在尝试登录 centos 6.8 服务器,并且我有 IP 地址和正确的密码。它将私钥存储在我的 known_hosts 文件中,但后来我忘记了。我的同事可以从他的计算机登录,他在 id_rsa.pub 文件中拥有他发送给我的私钥。当我存储它时,我仍然无法登录。我删除了那个文件,但我仍然无法登录,我无法理解下面的错误日志,请帮助。
danales-MacBook-Pro:~ danale$ ssh -vvv <ip>
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /Users/danale/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "<ip>" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to <ip> [<ip>] port 22.
debug1: Connection established.
debug1: identity file /Users/danale/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danale/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or …Run Code Online (Sandbox Code Playgroud) 我希望在Windows服务器和客户端之间建立一个没有端口转发的ssh隧道。
我知道用于通过端口转发建立隧道的命令,但我只有一个服务器和一个客户端,因此无法使用转发。
ssh user@serverip -L 5900:localhost:5900
Run Code Online (Sandbox Code Playgroud)
当我使用此命令时,我的 vnc 会话不会通过隧道。因此我希望避免使用端口转发。
我一直在参考这个指南,根据它我的 vnc 应该穿过隧道。https://webcient.com/how-to-use-putty-to-create-a-ssh-tunnel/
但我希望在没有端口转发的情况下做同样的事情。
通过上述命令,我面临着环回接口。
谢谢!!
到目前为止我看到的所有解决方案都假设我想静态使用某个键。而我想动态使用一个键:我想在每次运行 git 命令时指定要使用的键。有一次我希望能够使用一个键,下次 - 另一个。
我试过这个:
# 1
$ git pull origin master -i ~/.ssh/id_ed25519
error: unknown switch `i'
usage: git pull [<options>] [<repository> [<refspec>...]]
# 2
$ git pull -i ~/.ssh/id_ed25519 origin master
error: unknown switch `i'
usage: git pull [<options>] [<repository> [<refspec>...]]
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有一个绑定端口 2222:22 的 docker 容器。可以使用连接ssh -T sub.example.com -p 2222。
我正在寻找一种无需指定端口号即可访问 ssh 容器的方法。我认为这可以通过 DNS 记录来完成。
我SRV _ssh._tcp.sub 5 10022 sub.example.com在提供商的管理界面中为我的域设置了 DNS 记录,这不起作用。
有没有办法做到这一点?
将身份文件重命名id_ed2519_2(.pub)为 后id_ed2519(.pub),
ssh-copy-id可以使用文件id_ed25519(它要求输入密码)连接到远程服务器,而ssh不能,除非我添加一个身份文件选项(它要求输入密码):
$ ssh-copy-id -n remoteserver
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
Enter passphrase for key '/home/helloworld/.ssh/id_ed25519':
/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
$ ssh remoteserver
no such identity: /home/helloworld/.ssh/id_ed25519_2: No such file or directory
Permission denied (publickey).
$ ssh remoteserver -i ./ssh/id_ed25519
Enter passphrase for key 'id_ed25519':
Run Code Online (Sandbox Code Playgroud)
怎么可能ssh-copy-id …
希望有人能帮助我解决这个噩梦。我做了一个关于 vagrant 配置 4 台 ubuntu 机器、1 个控制器和 3 个服务器的项目。在控制器上创建 SSH 密钥,并将 ssh-copy-id 命令创建到 3 个服务器节点。我可以在 3 台服务器上的authorized_keyes 中看到公钥。
根据我在互联网上找到的内容,etc/ssh/sshd_config dump似乎没问题。
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them …Run Code Online (Sandbox Code Playgroud) ssh ×10
linux ×4
ssh-keys ×2
bash ×1
centos ×1
centos6 ×1
connection ×1
docker ×1
git ×1
password ×1
private-key ×1
process ×1
root ×1
security ×1
shell ×1
ssh-agent ×1
ssh-keygen ×1
ssh-tunnel ×1
vnc ×1