小编Dim*_*ims的帖子

为什么在 ssh 客户端中使用 -i 选项指定私钥?

在 ssh man 中是这样说的:

-i identity_file
             Selects a file from which the identity (private key) for public key authentication is read.  The default is
             ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 and
             ~/.ssh/id_rsa for protocol version 2.  Identity files may also be specified on a per-host basis in the con?
             figuration file.  It is possible to have multiple -i options (and multiple identities specified in configura?
             tion files).  If no certificates have been explicitly specified by the CertificateFile …
Run Code Online (Sandbox Code Playgroud)

security ssh key-authentication

1
推荐指数
1
解决办法
3016
查看次数

如何准确定位该可执行文件,如果它的名称在命令行中输入,它将运行?

是否可以准确定位该可执行文件

myname
Run Code Online (Sandbox Code Playgroud)

如果传递给命令行,它将运行

> myname
Run Code Online (Sandbox Code Playgroud)

locate命令没有按预期工作,因为它返回了许多结果。结果应该正好是一个,因为如果你运行一些东西,只会运行一个文件。此外,结果应PATH优先考虑。

path executable locate

0
推荐指数
1
解决办法
52
查看次数

为什么shebang的第二部分有优先权?

我在与python默认值不同的可执行文件下运行 python 脚本。

/usr/bin/mydir/mybins.

如果我跑,我得到:

$which python
/usr/bin/python
Run Code Online (Sandbox Code Playgroud)

如果运行run.py

# cat run.py
#!/usr/bin/env /mydir/mybins/python

import os
import sys

print(u"Python executable: %s" % sys.executable)
print(u"From within Python PATH=%s" % os.environ[u"PATH"])
Run Code Online (Sandbox Code Playgroud)

我得到

# ./run.py
Python executable: /mydir/mybins/python
From within Python PATH=/usr/bin:... (and no /mydir/mybins)
Run Code Online (Sandbox Code Playgroud)

为什么?这是故意的吗?如何在/usr/bin/python不更改代码的情况下使用它?

python shebang

0
推荐指数
1
解决办法
114
查看次数

如何提高内核过热阈值?

我有自发注销,可能是由过热引起的。我有以下几行syslog

Jul 23 13:44:19 studebaker kernel: [  491.025664] CPU8: Core temperature above threshold, cpu clock throttled (total events = 1)
Jul 23 13:44:19 studebaker kernel: [  491.025665] CPU2: Core temperature above threshold, cpu clock throttled (total events = 1)
Jul 23 13:44:19 studebaker kernel: [  491.025666] CPU4: Package temperature above threshold, cpu clock throttled (total events = 1)
Run Code Online (Sandbox Code Playgroud)

如何查看/更改错误消息中提到的阈值?

cpu temperature linux-kernel

0
推荐指数
1
解决办法
816
查看次数

如何确保我知道我的密码?

我通过 ssh 密钥连接到机器并拥有 sudo 权限。如何检查我知道的用户名密码是否正确?

/etc/shadow 不包含我。

还能做什么?

password authentication ubuntu

0
推荐指数
1
解决办法
56
查看次数

如何通过 ssh 发送带有变量的表达式?

我可以在本地运行以下循环

for i in A B C; do mycommand $i; done
Run Code Online (Sandbox Code Playgroud)

现在我正尝试将其发送过来ssh

以下版本

ssh myhost for i in A B C; do mycommand $i; done
Run Code Online (Sandbox Code Playgroud)

以下版本

ssh myhost "for i in A B C; do mycommand $i; done"
Run Code Online (Sandbox Code Playgroud)

也失败了,因为它需要i本地变量。

如何处理?


有没有通用的方法,例如,如果mycommand是另一个 ssh 怎么办?

ssh myhost 'for i in hos1 host2 host3; do ssh "$i" ... another for expression
Run Code Online (Sandbox Code Playgroud)

shell ssh variable

0
推荐指数
1
解决办法
37
查看次数

为什么我的 sed 命令打印 ps 标题?

为什么我的 sed 命令在这里打印 ps 标题:

$ ps | sed -E "s/\s*([[:digit:]]+)\s+.*/\1/"
  PID TTY          TIME CMD
26636
26637
54326
Run Code Online (Sandbox Code Playgroud)

为什么PID TTY TIME CMD线路通过过滤器?用g,结束正则表达式p没有帮助。


$ ps | sed -n -E "s/\s*([[:digit:]]+)\s+.*/\1/"
$ ps | sed -E "s/\s*([[:digit:]]+)\s+.*/\1/"
  PID TTY          TIME CMD
17966
17967
54326
$ ps | sed -E "s/\s*([[:digit:]]+)\s+.*/\1/p"
  PID TTY          TIME CMD
18429
18429
18430
18430
54326
54326
$ ps | sed -n -E "s/\s*([[:digit:]]+)\s+.*/\1/p"
18734
18735
54326
$ ps | sed -n -E …
Run Code Online (Sandbox Code Playgroud)

sed

-2
推荐指数
1
解决办法
158
查看次数