我\xe2\x80\x99m 在 Windows 上运行 Apache Netbeans 12,并且我\xe2\x80\x99m 很难使用 SSH 连接连接到我的 github 存储库。\n我强烈地感觉到,这对于 Netbeans 用户来说一直是一个问题很长一段时间。\n到目前为止我\xe2\x80\x99已经尝试过:
\n我正在尝试制作可以sshd_config正确处理的 ansible 任务。我从其他问题中找到了类似的正则表达式,但它们什么也没做。
name: Disable SSH password authentication
become: true
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^#?\s*PasswordAuthentication\s'
line: 'PasswordAuthentication no'
state: present
Run Code Online (Sandbox Code Playgroud)
问题是它应该处理重复的通道和注释。例如:
PasswordAuthentication no
PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)
或者
PasswordAuthentication no
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
或者
PasswordAuthentication yes
PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)
或者
PasswordAuthentication no
#PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
或者
PasswordAuthentication no
# PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
或者
# PasswordAuthentication no
# PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
等等这么多的组合。但我只想有一个未注释的行PasswordAuthentication no
这可能吗?
当我尝试使用 powershell 7 来使用 ssh 时,它会抛出错误:
ssh: The term 'ssh' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)
但它在 cmd 和 windows powershell 上运行良好

我还注意到我无法将目录更改为 OpenSSH (C:\Windows\System32\OpenSSH)

我尝试将 Openssh 添加到系统路径,安装 openssh 客户端和服务器,但没有成功。
我该如何修复它?
我刚刚在我的新 amazon linux 2023 机器上安装了 mongodb 7。Mongodb 本身似乎运行良好,但我无法运行 mongosh,因为出现以下错误。我已多次重新安装所有内容(包括 openssh),但没有任何帮助。非常感谢任何建议。
[ec2-user@ip-172-31-35-26 ~]$ mongosh
mongosh: OpenSSL configuration error:
00590487347F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:../deps/openssl/openssl/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes
Run Code Online (Sandbox Code Playgroud)
当我安装 MongoDB 时,我看到这个:
Installed:
cyrus-sasl-2.1.27-18.amzn2023.0.3.x86_64 cyrus-sasl-gssapi-2.1.27-18.amzn2023.0.3.x86_64 mongodb-database-tools-100.8.0-1.x86_64 mongodb-mongosh-2.0.0-1.el8.x86_64
mongodb-org-7.0.1-1.amzn2023.x86_64 mongodb-org-database-7.0.1-1.amzn2023.x86_64 mongodb-org-database-tools-extra-7.0.1-1.amzn2023.x86_64 mongodb-org-mongos-7.0.1-1.amzn2023.x86_64
mongodb-org-server-7.0.1-1.amzn2023.x86_64 mongodb-org-tools-7.0.1-1.amzn2023.x86_64 openssl-1:3.0.8-1.amzn2023.0.4.x86_64
Complete!
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用cygwin进行ssh连接.我遵循了这里给出的指示.当我发出ssh localhost命令时,我得到Connection closed by ::1错误.因为我是unix和cygwin的新手,我无法弄清楚出了什么问题.请任何人都可以告诉我为什么会出现这个错误以及如何解决它?
我的cygwin shell看起来如下:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/Shekhar/.ssh/id_rsa):
/home/Shekhar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/Shekhar/.ssh/id_rsa.
Your public key has been saved in /home/Shekhar/.ssh/id_rsa.pub.
The key fingerprint is:
85:69:77:cc:fd:21:8a:ce:fe:46:41:ee:c8:e7:3d:7b Shekhar@Shekhar-PC
The key's randomart image is:
+--[ RSA 2048]----+
| |
| o + . …Run Code Online (Sandbox Code Playgroud) OpenSSH ssh守护程序是用于iPhone开发的有用工具。
是否可以直接从终端启动服务,而无需使用某些切换?
当使用-T和-t运行相同的ssh命令时,任何stderr输出分别到达stderr和stdout.
没有pty分配:
ssh -T user@host "echo >&2 foo" 1>/tmp/out 2>/tmp/err
输出写入/tmp/err.
使用pty分配: ssh -t user@host "echo >&2 foo" 1>/tmp/out 2>/tmp/err
输出现在写入/tmp/out.
我有点理解,使用pty模拟完整的伪屏幕并且输出处于原始模式.然后,发送到屏幕的输出通过stdout发送回ssh,ssh的tty也设置为原始模式.有人可以进一步解释一下吗?
我有以下代码尝试连接到使用OpenSSH构建的SFTP服务器(服务器正常工作,因为我已经能够通过WinSCP客户端成功连接到此FTP):
ConnectionInfo ConnNfo = new ConnectionInfo("127.0.0.1", 22, "usertest",
new AuthenticationMethod[]{
// Pasword based Authentication
new PasswordAuthenticationMethod("usertest","usertest"),
}
);
// Upload A File
using (var sftp = new SftpClient(ConnNfo))
{
sftp.Connect();
sftp.ChangeDirectory(@"/C:/IISFTP/");
using (var uplfileStream = File.OpenRead(uploadfn))
{
sftp.UploadFile(uplfileStream, uploadfn, true);
}
sftp.Disconnect();
}
Run Code Online (Sandbox Code Playgroud)
调用该sftp.Connect()行时,会引发以下异常:
消息类型80无效
为什么会这样?如何使用SSH.NET连接到我的SFTP服务器?
谢谢
我从Solaris文档获得了这个技巧,用于将ssh公钥复制到远程主机(ssh-copy-id在Solaris上不可用).
$ cat some_data_file | ssh user@host "cat >/tmp/some_data_file; some_shell_cmd"
Run Code Online (Sandbox Code Playgroud)
似乎它可以适应更多涉及的事情.具体来说,我想some_shell_command成为一个从本地发送到远程端执行的脚本,它将与本地键盘进行交互.
我尝试了stdin从多个来源发送多个东西的方法.但是在本地shell中工作的一些东西不适用于ssh,而下面的一些东西并没有完全符合我的要求:
$ echo "abc" | cat <(echo "def") # echoes: def (I wanted abc\ndef)
$ echo "abc" | cat < <(echo "def") # echoes: def (I wanted abc\ndef)
$ echo "abc" | cat <<-EOF
> echo $(</dev/stdin) #echoes: echo abc (I wanted: abc)
> EOF
# messed with eval for the above but that was …Run Code Online (Sandbox Code Playgroud) 我正在使用GitBash,并且正在下载大于10GB的文件,并且文件停止了一半。我不想从头开始再次下载整个文件。如何从SFTP停止的地方开始下载?我尝试过reget命令,它显示无法下载非常规文件。