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-379297

zpangwin's questions

Martin Hope
zpangwin
Asked: 2022-07-13 12:04:27 +0800 CST

ssh 在所有设备上工作,但来自某些设备的 scp 给出“连接已关闭”错误

  • 4

快速版本:

ssh在我的台式机和scp笔记本电脑上工作。从我的 android 手机上的 termuxssh可以工作,但scp不能。在这种情况下,我收到有关“连接已关闭”的错误。


扩展版

最初,当我问这个问题时,我在连接到我的 Fedora Linux 机器时,在我的 android 手机上从 termux 运行 scp 时遇到了这个问题。而且我一直很困惑,ssh所以我提供了很多调试信息。因为后来我了解到这个问题与 termux 完全无关,而与 OpenSSH 版本有关,所以我试图清理很多无关的信息转储并使其更易于访问,同时仍然保留相关的错误消息以更好地进行 seo 匹配.

设备:

  • 设备 A(计算机):运行 openssh.x86_64 8.7p1-3.fc35 的 Fedora 35
  • 设备 B(计算机):运行 openssh.x86_64 8.7p1-3.fc35 的 Fedora 35
  • device C (phone): android上的termux (我原来抓不到openssh版本,估计是v8.8或更高版本)

计算机 A 和 B 具有基本相同sshd_config的文件,所有 3 个基本相同的~/.ssh/config文件内容。

问题:

A->B、B->A、C->A 和 C->B 之间的 ssh 连接都工作正常。我对从任何一台计算机连接到我的手机都不感兴趣,并且从未在其上配置过 sshd,因此没有测试这种情况。

但是,对于通过 ssh 运行的 scp,我遇到了以下问题: A->B 和 B->A 工作,而 C->A 和 C->B 失败,出现以下错误:

$ scp -rp "[email protected]:/home/desktop-user/Pictures/test.jpg" .
scp: Connection closed
 

调试:

  • 大量验证 ssh 文件权限和所有权、~/.ssh/config设置等。没有明显问题。
  • 我(暂时)在 A 和 B 上禁用了 SELinux 和 firewalld,但仍然遇到同样的问题。
  • 根据这篇文章,我将自定义的 id_rsa(和 id_rsa.pub)文件名重命名为使用默认名称,并编辑了相应的~/.ssh/config定义。没变。
  • 我没有尝试(从 C 中)尝试从远程接收/拉取文件,而是尝试将文件推送/发送到远程。没变。
  • 从 C 开始,我确保所有软件包都是最新的。没变。
  • 从 C 中,我运行scp带有标志的命令-v以提供详细的调试信息。在编辑哈希等之后,我添加到pastebin。我看到的主要内容是密钥似乎已被接受,但最后一行表明“debug1:退出状态 127”。在线结果似乎表明scp主机上不存在......但就我而言,它是。所以还是没有变化。

主机的 sshd 配置

同样,A 和 B 具有基本相同的配置

# grep -Pv '^\s*(#|$)' /etc/ssh/sshd_config
Include /etc/ssh/sshd_config.d/*.conf
Port 22
Ciphers [email protected],aes256-ctr
LoginGraceTime 1m
PermitRootLogin no
MaxAuthTries 4
MaxSessions 6
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
UseDNS yes
AcceptEnv LANG LC_*
Subsystem   sftp    /usr/lib/openssh/sftp-server
Protocol 2
DenyUsers root docker-user
MACs [email protected],hmac-sha2-512,[email protected],hmac-sha2-256
KexAlgorithms diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
ssh scp
  • 1 个回答
  • 514 Views
Martin Hope
zpangwin
Asked: 2021-12-18 09:15:50 +0800 CST

我的硬盘坏了吗?/ 需要有关 smartctl -a 输出的帮助

  • 0

我有一个旧的 Seagate 4TB 内置驱动器,来自一台破旧的电脑,我计划将其重新用作游戏的备用驱动器。

为了安全起见,我想我会先对其进行一些 smartctl 扫描,所以我做smartctl -t short /dev/sdb了并得到了结果。他们看起来不错,因为我没有看到“WHEN_FAILED”列中列出的任何内容(最初我主要关心与温度相关的错误)。但后来我看到2018 年的一篇文章 提到“Current_Pending_Sector”非常严重......而且我的不是零......而且我确实有一些错误......因为我真的无法理解是否要担心他们,我想我会尝试 SE。

到目前为止,我最好的猜测是我不应该在上面放任何重要的东西,但是如果我对保存文件夹进行符号链接以便它们存在于其他地方(在具有更好智能结果的驱动器上)并且不如果驱动器发生故障,请注意重新下载已安装的游戏。也不确定“READ DMA EXT”错误是否表明即将发生故障,或者这可能是电缆或其他一次性事件(我只能看到错误 35-39,它们都发生在“16936 小时”......不确定是否有办法查看所有错误,或者是否像它说的那样只存储最后 5 个错误)。OTOH,我在安装它或从中复制数据时没有任何问题(这是一个亲戚,他们不再想要它;只是一些图片/视频)。

如果驱动器可能还有一些生命,至少有相当大的可能性,我不介意将它用于不太重要的东西。但它很可能在不久的将来失败,我宁愿不要浪费任何时间来购买新的磁铁:-) 有什么建议/建议吗?

无论如何,我smartctl -t long /dev/sdb等到第二天再跑smartctl -a /dev/sdb。以下是结果:

I_AM_ROOT@fedora35:~
# smartctl -a /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.7-200.fc35.x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Desktop HDD.15
Device Model:     ST4000DM000-1F2168
Serial Number:    <Redacted>
LU WWN Device Id: <Redacted>
Firmware Version: CC54
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5900 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Dec 17 11:44:49 2021 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      ( 118) The previous self-test completed having
                    the read element of the test failed.
Total time to complete Offline 
data collection:        (  168) seconds.
Offline data collection
capabilities:            (0x73) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   1) minutes.
Extended self-test routine
recommended polling time:    ( 528) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x1085) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   119   099   006    Pre-fail  Always       -       233492808
  3 Spin_Up_Time            0x0003   092   091   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1890
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   044   039   030    Pre-fail  Always       -       678608011490
  9 Power_On_Hours          0x0032   065   065   000    Old_age   Always       -       30836
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   099   099   020    Old_age   Always       -       1206
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   061   061   000    Old_age   Always       -       39
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   071   058   045    Old_age   Always       -       29 (Min/Max 27/32)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       304
193 Load_Cycle_Count        0x0032   084   084   000    Old_age   Always       -       32204
194 Temperature_Celsius     0x0022   029   042   000    Old_age   Always       -       29 (0 12 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       16
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       16
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       23293h+16m+41.533s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       19236444339
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       27220280383

SMART Error Log Version: 1
ATA Error Count: 39 (device log contains only the most recent five errors)
    CR = Command Register [HEX]
    FR = Features Register [HEX]
    SC = Sector Count Register [HEX]
    SN = Sector Number Register [HEX]
    CL = Cylinder Low Register [HEX]
    CH = Cylinder High Register [HEX]
    DH = Device/Head Register [HEX]
    DC = Device Command Register [HEX]
    ER = Error register [HEX]
    ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 39 occurred at disk power-on lifetime: 16936 hours (705 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      04:59:22.764  READ DMA EXT
  25 00 40 ff ff ff ef 00      04:59:22.762  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:59:22.736  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:59:22.735  READ DMA EXT
  ef 10 02 00 00 00 a0 00      04:59:22.735  SET FEATURES [Enable SATA feature]

Error 38 occurred at disk power-on lifetime: 16936 hours (705 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      04:59:18.709  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:59:18.696  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:59:18.693  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:59:18.631  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:59:18.631  READ DMA EXT

Error 37 occurred at disk power-on lifetime: 16936 hours (705 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      04:57:53.914  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:57:53.914  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:57:53.882  READ DMA EXT
  ef 10 02 00 00 00 a0 00      04:57:53.881  SET FEATURES [Enable SATA feature]
  27 00 00 00 00 00 e0 00      04:57:53.881  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]

Error 36 occurred at disk power-on lifetime: 16936 hours (705 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      04:57:49.903  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:57:49.903  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:57:49.903  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:57:49.903  READ DMA EXT
  25 00 08 ff ff ff ef 00      04:57:49.903  READ DMA EXT

Error 35 occurred at disk power-on lifetime: 16936 hours (705 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 00 ff ff ff ef 00      04:57:45.210  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:57:45.181  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:57:45.179  READ DMA EXT
  25 00 00 ff ff ff ef 00      04:57:45.178  READ DMA EXT
  25 00 58 ff ff ff ef 00      04:57:45.149  READ DMA EXT

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed: read failure       60%     30817         3723785408
# 2  Short offline       Completed without error       00%     30812         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
hard-disk disk
  • 1 个回答
  • 615 Views

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve