AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-103271

Multisync's questions

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

Login SSH sem chave e sem senha no host local não é possível, relação PAM assumida

  • 3

Gostaria de fazer login 127.0.0.1via SSH sem usar uma chave pública e senha. sshd_confige arquivos de log são fornecidos abaixo, então aqui está apenas um resumo rápido:

  • A senha das contas de usuário é excluída com passwd --delete, ou seja, o login é possível sem senha
  • PasswordAuthenticatione PermitEmptyPasswordsgeralmente é definido como no, mas é definido como yespara logins 127.0.0.0/8via Matchcondição. Os logs indicam que a Matchcondição foi analisada corretamente e foi atendida.
  • Os logs sugerem que é o PAM que está atrapalhando.

Já pesquisei bastante, mas o PAM parece ser um tema muito complexo. Ainda não entendi como o SSH e o PAM estão interconectados.

Estou executando o Linux manuel-nas 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux

Logs e arquivos de configuração:

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

sshdsaída de depuração:

$ /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.logresultado:

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

sshsaída: Nota: Nos logs, posso ver que minha tentativa de login já foi rejeitada quando o prompt de senha aparece

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

O sistema falha ao inicializar ao fornecer o parâmetro de inicialização `console` para habilitar o acesso serial

  • 1

O que eu quero realizar

Gostaria de ter acesso de terminal remoto ao meu NAS (que executa o Debian Stretch) por meio de um adaptador USB-RS232. Como esta máquina deve ser sem cabeça, também gostaria de ver o processo de inicialização na linha serial.

(Ainda assim, para avaliar esse problema, há uma tela conectada na porta HDMI no momento.)

As ações que tomei

Acrescentei console=ttyUSB0à lista de argumentos do kernel. Ao inicializar, isso faz com que meu sistema congele.

As últimas linhas da saída de boot são: (Bootloader é extlinux)

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

Ao não usar o referido parâmetro do kernel, a máquina está inicializando sem problemas. A partir daí, eu poderia realizar o acesso ao terminal serial facilmente executando

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

no servidor remoto e

screen -F /dev/ttyUSB0 9600

na minha máquina local. Portanto, os adaptadores USB-RS232 estão funcionando corretamente. O servidor é um Intel NUC 5CPYH com chipset Braswell e roda um Linux 4.9.0-4-amd64kernel debian.

Minha pergunta

Quais ações devo tomar para fazê-lo funcionar?

Editar № 1

Ao fornecer console=tty0 console=ttyUSB0,9600n8como parâmetros de inicialização, a máquina inicializa bem, mas ainda não consigo conectar à porta serial. Além disso, systemctl status [email protected]diz que o serviço é loadede inactive (dead). Eu esperava que estivesse instalado e funcionando então.

Editar № 2

Eu fiz um pouco de pesquisa e descobri que meu initramfs estava sem os módulos relevantes do kernel. Consegui entrar no shell initramfs fornecendo break=initcomo parâmetro do kernel e vi que não havia /dev/ttyUSB0dispositivo.

Eu adicionei cp210x, pl2303e depois ftdi_siode /etc/initramfs-tools/modulesrecriar o initramfs, vi que agora existe um /dev/ttyUSB0dispositivo no shell initramfs.

Ainda assim, não consegui me conectar da minha outra máquina. Então, tentei iniciar o getty nesse dispositivo manualmente:

# /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

Então é onde estou agora.

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

Qual é o conjunto mínimo de programas necessários para reproduzir algo no conector de áudio ou na saída S/PDIF da minha máquina?

  • 3

Problema:

Não ouço nada no meu sistema de som durante a reprodução de áudio.

Pergunta:

Qual é o conjunto mínimo de programas necessários para reproduzir algo no conector de áudio ou na saída S/PDIF da minha máquina?

Como cheguei lá?

Meu sistema é um sistema Debian Stretch atualizado que foi criado com debootstrap. O sistema é um Intel NUC5CPYH que supostamente possui um chipset Intel Braswell .

eu corri

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

para instalar o soxreprodutor de áudio. Quando tentei reproduzir um arquivo, recebi

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

então, depois de olhar para as dependências de soxe libsox-fmt-all, corri

apt-get install libsndio6.1 pulseaudio

Agora, a saída de soxparece que está reproduzindo um arquivo bem quando solicitado, exceto que não recebo nenhuma saída de som no meu sistema de som. (O sistema de som está bem configurado.)

Editar #1

A saída de cat /proc/asound/cardsé

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

Editar #2

A saída de aplay -lé

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

Solução

Eu fiz funcionar. Agora posso dizer que houve dois problemas:

  1. Meu usuário não tinha direitos suficientes para acessar o dispositivo de som. ( Esta resposta a outra pergunta me disse isso.)
  2. Meu dispositivo de som foi silenciado. (marquei a resposta que me dizia isso como "correta")

Então, apesar de tudo, os passos que eu tive que dar foram

  1. apt-get install --no-install-recommends sox libsox-fmt-all alsa-utils
  2. Adicionar-me ao audiogrupo:usermod --append --groups audio <username>
  3. Alterar o volume alsa:alsamixer
  4. Toque a música com sox:play <filename>
debian audio
  • 3 respostas
  • 843 Views
Martin Hope
Multisync
Asked: 2018-01-11 13:17:57 +0800 CST

Como adicionar localidades a um sistema chroot programaticamente?

  • 3

Eu escrevi um script de shell que debootstrapsa do sistema Debian em um diretório, chroots lá, configura tudo (senhas e chaves SSH e assim por diante) e gera um arquivo de imagem inicializável a partir dele.

Alguns pacotes adicionais são definidos na opção debootstraps --include. Um deles é locales.

Quando a imagem é inicializada, tentar executar determinados programas, por exemplo, tmuxresulta na seguinte mensagem de erro:

tmux: invalid LC_ALL, LC_CTYPE or LANG

No momento, estou resolvendo isso manualmente executando dpkg-reconfigure localesem cada imagem inicializada. Como posso automatizar isso já no estágio debootstrap, chrootpara que a imagem fique correta desde o início?

debian chroot
  • 1 respostas
  • 2641 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

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

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve