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

Multisync's questions

Martin Hope
Multisync
Asked: 2018-03-24 03:21:44 +0800 CST

无法在本地主机上进行无密钥、无密码 SSH 登录,假定 PAM 关系

  • 3

我想127.0.0.1通过 SSH 登录而不使用公钥和密码。sshd_config和日志文件在下面提供,所以这里只是一个简短的概述:

  • 用户账户密码用 删除passwd --delete,即无需密码即可登录
  • PasswordAuthentication并且PermitEmptyPasswords通常设置为no, 但设置为从via条件yes登录。日志表明条件已正确解析并得到满足。127.0.0.0/8MatchMatch
  • 日志表明,阻碍的是 PAM。

我已经做了很多研究,但 PAM 似乎是一个非常复杂的话题。我还不明白 SSH 和 PAM 是如何互连的。

我正在运行Linux manuel-nas 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux

日志和配置文件:

sshd_config:

#   $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy 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 commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here! PasswordAuthentication no
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads) ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'. UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed ClientAliveInterval 0 ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables AcceptEnv LANG LC_*

# override default of no subsystems Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

Match Address 127.0.0.0/8
    PasswordAuthentication yes
    PermitEmptyPasswords yes

Match user diskuser
    ForceCommand internal-sftp
    ChrootDirectory /mnt/daten

Match user diskuser-privat
    ForceCommand internal-sftp
    ChrootDirectory /mnt/privat

sshd调试输出:

$ /usr/sbin/sshd -p2222 -ddd
--- Beginning stripped for clarity ---
debug3: checking match for 'Address 127.0.0.0/8' user user host 127.0.0.1 addr 127.0.0.1 laddr 127.0.0.1 lport 2222
debug1: connection from 127.0.0.1 matched 'Address 127.0.0.0/8' at line 125
debug3: match found
debug3: reprocess config:126 setting PasswordAuthentication yes
debug3: reprocess config:127 setting PermitEmptyPasswords yes
debug3: checking match for 'user diskuser' user user host 127.0.0.1 addr 127.0.0.1 laddr 127.0.0.1 lport 2222
debug3: match not found
debug3: checking match for 'user diskuser-privat' user user host 127.0.0.1 addr 127.0.0.1 laddr 127.0.0.1 lport 2222
debug3: match not found
debug3: mm_answer_pwnamallow: sending MONITOR_ANS_PWNAM: 1
debug3: mm_request_send entering: type 9
debug2: monitor_read: 8 used once, disabling now
debug3: mm_getpwnamallow: waiting for MONITOR_ANS_PWNAM [preauth]
debug3: mm_request_receive_expect entering: type 9 [preauth]
debug3: mm_request_receive entering [preauth]
debug2: input_userauth_request: setting up authctxt for user [preauth]
debug3: mm_start_pam entering [preauth]
debug3: mm_request_send entering: type 100 [preauth]
debug3: mm_inform_authserv entering [preauth]
debug3: mm_request_send entering: type 4 [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 100
debug1: PAM: initializing for "user"
debug1: PAM: setting PAM_RHOST to "127.0.0.1"
debug1: PAM: setting PAM_TTY to "ssh"
debug2: monitor_read: 100 used once, disabling now
debug2: input_userauth_request: try method none [preauth]
debug3: mm_auth_password entering [preauth]
debug3: mm_request_send entering: type 12 [preauth]
debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD [preauth]
debug3: mm_request_receive_expect entering: type 13 [preauth]
debug3: mm_request_receive entering [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 4
debug3: mm_answer_authserv: service=ssh-connection, style=, role=
debug2: monitor_read: 4 used once, disabling now
debug3: mm_request_receive entering
debug3: monitor_read: checking request 12
debug3: PAM: sshpam_passwd_conv called with 1 messages
debug1: PAM: password authentication failed for user: Authentication failure
debug3: mm_answer_authpassword: sending result 0
debug3: mm_request_send entering: type 13
Failed none for user from 127.0.0.1 port 36202 ssh2
debug3: mm_auth_password: user not authenticated [preauth]
debug3: userauth_finish: failure partial=0 next methods="publickey,password" [preauth]
debug3: send packet: type 51 [preauth]

/var/log/auth.log输出:

Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: recv_rexec_state: entering fd = 5
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: ssh_msg_recv entering
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: recv_rexec_state: done
Mar 23 11:09:52 manuel-nas sshd[23081]: debug2: parse_server_config: config rexec len 563
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:56 setting PasswordAuthentication no
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:61 setting ChallengeResponseAuthentication no
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:84 setting UsePAM yes
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:89 setting X11Forwarding yes
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:93 setting PrintMotd no
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:100 setting ClientAliveInterval 0
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:101 setting ClientAliveCountMax 3
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:113 setting AcceptEnv LANG LC_*
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: rexec:116 setting Subsystem sftp\t/usr/lib/openssh/sftp-server
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: checking syntax for 'Match Address 127.0.0.0/8'
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: checking syntax for 'Match user diskuser'
Mar 23 11:09:52 manuel-nas sshd[23081]: debug3: checking syntax for 'Match user diskuser-privat'
Mar 23 11:09:52 manuel-nas sshd[23081]: debug1: sshd version OpenSSH_7.4, OpenSSL 1.0.2l  25 May 2017
Mar 23 11:09:52 manuel-nas sshd[23081]: debug1: private host key #0: ssh-rsa SHA256:< removed for confidentiality >
Mar 23 11:09:52 manuel-nas sshd[23081]: debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:< removed for confidentiality >
Mar 23 11:09:52 manuel-nas sshd[23081]: debug1: private host key #2: ssh-ed25519 SHA256:< removed for confidentiality >
Mar 23 11:09:52 manuel-nas sshd[23081]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=127.0.0.1  user=user

ssh输出:注意:在日志中,当密码提示出现时,我可以看到我的登录尝试已被拒绝

$ ssh 127.0.0.1 -p2222
[email protected]'s password: 
ssh openssh
  • 1 个回答
  • 1368 Views
Martin Hope
Multisync
Asked: 2018-02-20 13:19:24 +0800 CST

提供 `console` 启动参数以启用串行访问时,系统无法启动

  • 1

我想要完成的

我想通过 USB-RS232 适配器远程终端访问我的 NAS(运行 Debian Stretch)。由于这台机器应该是无头的,所以我也想看看串口线的启动过程。

(不过,为了评估这个问题,目前 HDMI 端口上连接了一个屏幕。)

我采取的行动

我附加console=ttyUSB0到内核参数列表中。启动时,这会导致我的系统冻结。

引导输出的最后几行是:(Bootloader 是 extlinux)

Loading /vmlinuz... ok
Loading /initrd.img...ok
Probing EDD (edd=off to disable)... ok

当不使用所述内核参数时,机器正在引导而没有问题。从那里开始,我可以通过运行轻松完成串行终端访问

systemctl enable [email protected]
systemctl start [email protected]

在远程服务器上,以及

screen -F /dev/ttyUSB0 9600

在我的本地机器上。因此,USB-RS232 适配器工作正常。该服务器是带有 Braswell 芯片组的Intel NUC 5CPYH,运行Linux 4.9.0-4-amd64debian 内核。

我的问题

我必须采取哪些措施才能使其正常工作?

编辑№1

当提供console=tty0 console=ttyUSB0,9600n8启动参数时,机器启动得很好,但我仍然无法连接到串行端口。另外,systemctl status [email protected]说服务是loadedand inactive (dead)。我本来预计它会在那时启动并运行。

编辑№2

我做了一些研究,发现我的 initramfs 缺少相关的内核模块。我通过提供内核参数设法进入 initramfs shell,break=init发现没有/dev/ttyUSB0设备。

我在重新创建 initramfs 后添加了cp210x,pl2303和ftdi_sioto /etc/initramfs-tools/modules,看到现在/dev/ttyUSB0initramfs shell 中有一个设备。

不过,我无法从我的另一台机器连接。所以我尝试在该设备上手动启动 getty:

# /sbin/getty -L 9600 /dev/ttyUSB0 vt100
getty: setsid: Operation not permitted
# su root -c "/sbin/getty -L 9600 /dev/ttyUSB0 vt100"
sh: su: not found

这就是我现在的位置。

linux debian
  • 2 个回答
  • 2183 Views
Martin Hope
Multisync
Asked: 2018-01-24 13:44:28 +0800 CST

在我的机器音频插孔或 S/PDIF 输出上播放某些东西所需的最少程序集是什么?

  • 3

问题:

播放音频时,我的音响系统听不到任何声音。

问题:

在我的机器音频插孔或 S/PDIF 输出上播放某些东西所需的最少程序集是什么?

我是怎么到那里的?

我的系统是一个最新的 Debian Stretch 系统,它是用debootstrap. 该系统是一个Intel NUC5CPYH,据说有一个Intel Braswell 芯片组。

我跑了

apt-get install --no-install-recommends sox libsox-fmt-all

安装sox音频播放器。当我尝试播放文件时,我得到了

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
play FAIL formats: can't open output file `default': snd_pcm_open error: No such file or directory

所以,在查看了 and 的依赖关系之后sox,libsox-fmt-all我跑了

apt-get install libsndio6.1 pulseaudio

现在,sox当被要求这样做时,它的输出似乎可以正常播放文件,但我的音响系统上没有任何声音输出。(音响系统设置得很好。)

编辑#1

的输出cat /proc/asound/cards是

 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0x81414000 irq 313

编辑#2

的输出aplay -l是

aplay: device_list:270: no soundcards found...

解决方案

我让它工作了。现在我可以说有两个问题:

  1. 我的用户没有足够的权限访问声音设备。(这个对另一个问题的回答告诉我。)
  2. 我的声音设备已静音。(我将告诉我的答案标记为“正确”)

所以,总而言之,我必须采取的步骤是

  1. apt-get install --no-install-recommends sox libsox-fmt-all alsa-utils
  2. 将自己添加到audio组中:usermod --append --groups audio <username>
  3. 更改 alsa 音量:alsamixer
  4. 播放歌曲sox:play <filename>
debian audio
  • 3 个回答
  • 843 Views
Martin Hope
Multisync
Asked: 2018-01-11 13:17:57 +0800 CST

如何以编程方式将语言环境添加到 chrooted 系统?

  • 3

我已经编写了一个 shell 脚本,它将debootstrapDebian 系统保存到一个目录中,chroots 在那里,设置所有内容(密码和 SSH 密钥等),并从中生成一个可启动的映像文件。

在debootstraps--include选项中定义了一些额外的包。其中之一是locales。

启动映像时,尝试运行某些程序例如tmux会导致以下错误消息:

tmux: invalid LC_ALL, LC_CTYPE or LANG

现在我正在通过dpkg-reconfigure locales在每个启动的映像中运行来手动解决这个问题。我怎样才能在debootstrap或chroot阶段自动执行此操作,以便图像从一开始就正确?

debian chroot
  • 1 个回答
  • 2641 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