AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-61169

gcb's questions

Martin Hope
gcb
Asked: 2024-11-04 23:32:47 +0800 CST

systemd “启动或重新启动”服务的最佳实践?

  • 7

这是基于systemd 是否可以在重启之前执行命令?的答案。

当前“启动或重新启动”服务的方法是:

systemctl is-active nginx && systemctl reload nginx || systemctl start nginx

我想知道是否有更好的方法来使用目标等。我感觉我仍在尝试将 systemd 工具用作其他 init 工具。

我使用这种方法的情况是手动调整配置后,这可能会起作用,但在压力测试期间会崩溃,因此我需要在对配置文件进行新的调整后启动或重新启动。显然,这里的“解决方案”可能是生产中不可接受的,因为这是在 vm/dev 框上完成的。

systemd
  • 1 个回答
  • 57 Views
Martin Hope
gcb
Asked: 2024-08-10 00:13:41 +0800 CST

mdadm:无法将值“arch1:2021”设置为 devname。原因:与 POSIX 不兼容。忽略值

  • 8

我把一个旧的 raid 阵列插入到一个新的系统并在尝试用它做任何事情时都会出现这个错误mdadm。

# mdadm --detail --scan 
ARRAY /dev/md/arch1:2021 metadata=1.2 UUID=c4c7cbde:5f6913a9:eb1c82ff:8fe6cd45

# mdadm --detail 
mdadm: Value "arch1:2021" cannot be set as devname. Reason: Not POSIX compatible. Value ignored.
mdadm: No devices given.

一切仍然正常。我可以安装和使用阵列。“不合规”的名称可以正常显示为设备文件

 # ls -la /dev/md/
total 0
drwxr-xr-x  2 root root   60 2024-08-09 03:16 .
drwxr-xr-x 20 root root 4580 2024-08-09 03:16 ..
lrwxrwxrwx  1 root root    8 2024-08-09 03:16 arch1:2021 -> ../md127

我可以使用的设备文件

 # mdadm --detail /dev/md/arch1\:2021 
/dev/md/arch1:2021:
           Version : 1.2
     Creation Time : Wed Jul  7 06:29:08 2021
        Raid Level : raid1

以最安全的方式更新名称的最佳方法是什么?

raid
  • 2 个回答
  • 227 Views
Martin Hope
gcb
Asked: 2024-08-09 06:28:24 +0800 CST

如何“强制”路线?

  • 5

Linux 内核允许我添加仅可到达网关的路由,因为实际上它们没有问题。但现在我收到“错误:Nexthop 网关无效”,这很符合规范,但使临时测试变得很麻烦。

有什么办法可以绕过这个检查并强制我的路线?

是的,我确实想通过公共接口发送我的私人局域网路由包,原因是有效的、低量且无害的:)

linux
  • 1 个回答
  • 110 Views
Martin Hope
gcb
Asked: 2024-08-01 11:06:29 +0800 CST

systemd 可以在重启之前执行命令吗?

  • 5

这不是关于ExecStartPre

调整服务时的一个用例是在重新启动服务之前测试配置文件。

例如。

$ vim /etc/nginx.conf
$ nginx -t && restart_nginx

与 systemd 相同的是,在发出重新启动命令之前仍然必须记住检查。

有没有什么方法可以防止这种极有可能发生的人为错误?比如?也就是说,在重启的停止步骤之前ExecRestartStopPre执行某些操作?

systemd
  • 1 个回答
  • 30 Views
Martin Hope
gcb
Asked: 2023-10-11 22:18:36 +0800 CST

如何列出所有范围?

  • 5

在我的日记日志中,我看到如下条目:

systemd[865]: app-org.kde.konsole-fbe1036742844b1ea3cd54e064c0a794.scope: Killing process 14893

显然 konsole 确实为每个实例启动一个作用域(并且存在每个选项卡添加一个作用域的错误),但是打开了几个konsoles,我得到:

$ systemctl list-unit-files --all | grep konsole
$ systemctl list-units --all | grep konsole
$ systemctl list-units --type scope
init.scope
session-1.scope
systemd
  • 1 个回答
  • 18 Views
Martin Hope
gcb
Asked: 2023-08-18 04:49:41 +0800 CST

如何正确拆分 DKIM txt dns 条目?

  • 5

这里有很多关于分割 DKIM txt 记录的问题,但我的 dns 提供商只允许每个密钥 255 个字符。没有像其他平台提到的所有其他问题那样输入多个值的奇特方法。

我继续输入多个同名的 TXT 条目:

entry    type   value
[z._domainkey] [TXT] [v=DKIM1;k=rsa;...]
[z._domainkey] [TXT] [...restofkey]

这确实显示在我的查询中,但有时是乱序的:

$ drill txt z._domainkey.example.com.
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 7181
;; flags: qr rd ra ; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 
;; QUESTION SECTION:
;; z._domainkey.example.com.       IN      TXT

;; ANSWER SECTION:
z._domainkey.example.com.  1796    IN      TXT     "v=DKIM1;k=rsa;"
z._domainkey.example.com.  1796    IN      TXT     "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh957KTmtf+f1GCrdVKydz2x0NDs1Cx/g/AYIlx2QcyOpXzd3DNC8saykKjfwYEIGq47UdnLQdJztINPu5QsphwSnpQiGqV28EltNp1poNNeUwSno7vrUTQI44vkD7OosCh+yLVD5AWCqxOr0l4C6kp2UuXvEc6zANPQrbOuVABm"
z._domainkey.example.com.  1796    IN      TXT     "Gf2nLFvcR4iswFC3JpLOdZr259BelASlU2WApIeDK/a8Qo096WzpFCeFtamIxZFkeHdCSmrS7zrtDrxxvXzYhXIFharkWeY5cXKzZ7vUGR14Zie9gzNzoz5NoibngkBH6dw5C70lU5ynVwx+/U+TCEKOZu1X9K/ZC5/1NrsW83QIDAQAB"

(已经尝试在中间分割,像通常的base64一样,使用在线分割工具,分割成2个、3个和4个部分,以64字节为单位。所有结果都相同)

所有验证器(包括我的 MX 处理程序中的验证器)都说这是无效的。

我还需要做些什么来分割这些值吗?我需要重复该p=部分还是其他内容?DNS 客户端如何知道连接多个 TXT 条目的顺序?为什么提供分割值的验证工具在分割时也无法验证它们?例如https://www.mailhardener.com/tools/dns-record-splitter

所有验证器仅显示一条记录,该记录的v=DKIM1;k=rsa;p=...一部分是无效的 dkim 记录,而另一条记录只是密钥的延续,作为完全不同的记录,甚至不是有效的 dkim。

例如https://dkimcore.org/c/keycheck说

* v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0... (This might be a valid DKIM record)
* r259BelASlU2WApIeDK/a8Qo096WzpFCeFtam... (This doesn't look like a DKIM record)
domain-name-system
  • 1 个回答
  • 45 Views
Martin Hope
gcb
Asked: 2013-10-14 18:49:32 +0800 CST

Rsync 用于生成每日备份,带有某种历史记录

  • 1

这可能正在扩展使用 Rsync 备份到外部驱动器

我通常手动将数据备份到外部驱动器。我首先在外部驱动器上创建一个包含今天日期的目录并在那里处理重要数据。这样我就有了系统错误和人为错误的备份(只需转到上一个日期)

有没有办法用rsync自动化?或者,如果这不是太疯狂的话,也许像 rsync 与我的本地数据同步一个“透明”的 git 存储库(所有内容以特定的每日或每小时间隔自动提交)?此外,经过一年的自动备份,搜索这样的 repo 会有多糟糕?

或者只是简单的rsync,但只要外部驱动器上有空间,就可以进行日常备份?

数据主要是小文本文件(文本、源代码)或中等图片(~6mb),但有数十万。

backup
  • 2 个回答
  • 814 Views
Martin Hope
gcb
Asked: 2012-11-22 23:05:04 +0800 CST

sshd 忽略 authorized_keys 并继续尝试 authorized_keys2

  • 4

我刚刚将我的公钥上传到服务器,确保权限正确,当我尝试登录时,它只是拒绝了。

在 sshd_config 中启用 loglevel DEBUG 后,我得到:

Nov 22 06:53:36 host-1 sshd[8612]: debug1: Forked child 8617.
Nov 22 06:53:36 host-1 sshd[8617]: Set /proc/self/oom_score_adj to 0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Nov 22 06:53:36 host-1 sshd[8617]: debug1: inetd sockets after dupping: 3, 3
Nov 22 06:53:36 host-1 sshd[8617]: Connection from some_ip port 50466
Nov 22 06:53:36 host-1 sshd[8617]: debug1: HPN Disabled: 0, HPN Buffer Size: 87380
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Client protocol version 2.0; client software version OpenSSH_6.0p1 Debian-3
Nov 22 06:53:36 host-1 sshd[8617]: SSH: Server;Ltype: Version;Remote: some_ip-50466;Protocol: 2.0;Client: OpenSSH_6.0p1 Debian-3
Nov 22 06:53:36 host-1 sshd[8617]: debug1: match: OpenSSH_6.0p1 Debian-3 pat OpenSSH*
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Remote is NON-HPN aware
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Enabling compatibility mode for protocol 2.0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Local version string SSH-2.0-OpenSSH_5.8p1-hpn13v10
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is loglevel
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is passwordauthentication
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is permitemptypasswords
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is usepam
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is subsystem
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys
Nov 22 06:53:36 host-1 sshd[8617]: debug1: fd 4 clearing O_NONBLOCK
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Could not open authorized keys '/home/xxx/.ssh/authorized_keys2': No such file or directory
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: Failed publickey for xxx from some_ip port 50466 ssh2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys
Nov 22 06:53:36 host-1 sshd[8617]: debug1: fd 4 clearing O_NONBLOCK
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Could not open authorized keys '/home/xxx/.ssh/authorized_keys2': No such file or directory
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: Failed publickey for xxx from some_ip port 50466 ssh2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: do_cleanup

它一直在尝试 authorized_keys2(我虽然在任何地方都被弃用了)但它确实在某个时候打开了 authorized_keys(我的密钥的正确文件)然后绝对没有再说它并返回到 authorized_keys2

这里出了什么问题?

我的 sshd_config 中确实有:

PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

并且该文件中的任何地方都没有 authorized_keys2 字符串。是的,sshd 在测试前重启了。

我想我可以只使用 authorized_keys2 但想了解这里发生了什么。有什么线索吗?


编辑:ssh -v 主机

client$ ssh -v host
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to host [someip] port 22.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_dsa type 2
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1-hpn13v10
debug1: match: OpenSSH_5.8p1-hpn13v10 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA xx:xx...
debug1: Host 'host' is known and matches the ECDSA host key.
debug1: Found key in /home/xxx/.ssh/known_hosts:11
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering DSA public key: /home/xxx/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering RSA public key: /home/xxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
xxx@host's password: 
linux
  • 3 个回答
  • 9595 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve