Assim fazendo
$(cat /etc/passwd)
resulta em "Nenhum arquivo ou diretório"
e
"$(whereis cat)"
resulta em "comando não encontrado"
Por que a substituição de comando não está funcionando da maneira esperada?
Assim fazendo
$(cat /etc/passwd)
resulta em "Nenhum arquivo ou diretório"
e
"$(whereis cat)"
resulta em "comando não encontrado"
Por que a substituição de comando não está funcionando da maneira esperada?
Posso montar manualmente um arquivo de imagem (contendo um sistema de arquivos válido) com:
vnconfig vnd0 file.img
mount /dev/vnd0c /mnt/
Pergunta : Onde devo colocar o vnconfig
comando no OpenBSD?
Atualizei fstab
para ter a montaria, mas vnconfig
ainda é um mistério. Onde devo colocá-la? Em um script de inicialização?
Gostaria de desligar event_activation
enquanto modifico uma unidade desmontada (as regras do udev são executadas vgchange
quando uma alteração na unidade desmontada é detectada). A página do manual diz que "lvm.conf é carregado durante a fase de inicialização do lvm". Posso recarregar o lvm para forçar uma releitura do lvm.conf?
Se eu definir event_activation
como 0 em lvm.conf e executar lvm dumpconfig
, ele relata o novo valor, mas presumivelmente não age sobre ele. Se necessário, eu poderia simplesmente desligar o LVM (o sistema é reinicializado após modificar a unidade) - há uma maneira de fazer isso? Estranhamente, adicionar nolvm
às opções do kernel não parece afetar esse problema - vgchange
ainda é executado quando a unidade é modificada.
Eu tenho 2 arquivos
arquivo1
00:00:00:00:00:01
arquivo2
00:00:00:00:00:02 foo bar
00:00:00:00:00:01 something else
O que eu quero fazer é comparar os dois arquivos e remover 00:00:00:00:00:01
do arquivo 2 para terminar com
arquivo 2
00:00:00:00:00:02 foo bar
tentei
grep -Fvx file1 file2
Mas isso não parece funcionar para correspondências de linhas parciais.
Eu tive esse problema com meu mini-pc Geekom também, e agora estou vendo isso na minha placa-mãe MSI MAG Tomahawk x870 com placa Qualcomm PCI. Eu instalei o PopOS! e tudo funcionou muito bem, até que depois de cerca de 20 minutos a 1 hora, o Wifi parou de funcionar de repente.
Detalhes do sistema:
Coisas que tentei:
/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
para desabilitar o powersaveufw
wireguard
tailscale
ath12k_pci
drivers: https://wireless.docs.kernel.org/en/latest/en/users/drivers/ath12k/installation.htmlNada disso funcionou e estou sem ideias.
Como superar/forçar a correção do seguinte problema:
$ sudo /usr/sbin/tmpreaper 15d /tmp
error: run time exceeded!
This may be indicative of an attack to use tmpreaper to remove critical files;
or the directories to clean up are excessive large and/or messed up.
Please investigate.
Um dos meus servidores fica constantemente sem espaço em disco, então eu instalei o tmpreaper
, pensando que o problema acabaria, mas não acabou. Hoje eu acabei de perceber onde está o problema.
Estou pensando, qual é o significado dos números mágicos em nomes de arquivos em pastas de configuração? Por exemplo, 50 em
/etc/apt/apt.conf.d/50unattended-upgrades
ou 52 em
/etc/apt/apt.conf.d/52unattended-upgrades-local
. Acho que está de alguma forma relacionado com a ordem de análise desses arquivos na pasta?
Estou tentando configurar um servidor Debian 12 e não consigo fazer com que ele aceite conexões ssh da minha máquina Ubuntu 22.04 (ou de uma máquina Ubuntu mais antiga). Ele não pede uma senha; o comando ssh simplesmente termina imediatamente. Ssh para localhost e [Debian 12 IP] funcionam - solicita a senha, aceita e efetua login. Esta deve ser uma instalação próxima do estoque do Debian 12. Eu até tentei copiar o arquivo sshd_config de estoque da máquina Ubuntu 22.04 (que aceita conexões da máquina Debian) para a máquina Debian, mas sem sucesso.
Veja o que a máquina Ubuntu 22.04 apresenta quando tento uma conexão:
[localuser]@[localmachine]:~$ ssh -vvv [remoteuser]@192.168.2.9
OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.2.9 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/[localuser]/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/[localuser]/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.2.9 [192.168.2.9] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: Connection established.
debug1: identity file /home/[localuser]/.ssh/id_rsa type -1
debug1: identity file /home/[localuser]/.ssh/id_rsa-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/[localuser]/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519 type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519_sk type -1
debug1: identity file /home/[localuser]/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_xmss type -1
debug1: identity file /home/[localuser]/.ssh/id_xmss-cert type -1
debug1: identity file /home/[localuser]/.ssh/id_dsa type -1
debug1: identity file /home/[localuser]/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
kex_exchange_identification: read: Connection reset by peer
Connection reset by 192.168.2.9 port 22
[localuser]@[localmachine]:~$
Isto é o que a máquina Debian relata:
Dec 06 21:45:08 fafnir sshd[5704]: debug3: fd 5 is not O_NONBLOCK
Dec 06 21:45:08 fafnir sshd[5704]: debug1: Forked child 8037.
Dec 06 21:45:08 fafnir sshd[5704]: debug3: send_rexec_state: entering fd = 8 config len 3271
Dec 06 21:45:08 fafnir sshd[5704]: debug3: ssh_msg_send: type 0
Dec 06 21:45:08 fafnir sshd[5704]: debug3: send_rexec_state: done
Dec 06 21:45:08 fafnir sshd[8037]: debug3: oom_adjust_restore
Dec 06 21:45:08 fafnir sshd[8037]: debug1: Set /proc/self/oom_score_adj to 0
Dec 06 21:45:08 fafnir sshd[8037]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Dec 06 21:45:08 fafnir sshd[8037]: debug1: inetd sockets after dupping: 4, 4
Dec 06 21:45:08 fafnir sshd[8037]: debug1: getpeername failed: Transport endpoint is not connected
Dec 06 21:45:08 fafnir sshd[8037]: debug3: process_channel_timeouts: setting 0 timeouts
Dec 06 21:45:08 fafnir sshd[8037]: debug3: channel_clear_timeouts: clearing
Dec 06 21:45:08 fafnir sshd[8037]: debug1: ssh_remote_port failed
O arquivo de configuração atualmente é:
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
# 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.
Include /etc/ssh/sshd_config.d/*.conf
#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
LogLevel Debug3
# 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 yes
#PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
KbdInteractiveAuthentication 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 KbdInteractiveAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication 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 KbdInteractiveAuthentication to 'no'.
UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /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
Alguma ideia do que está errado? Note que não instalei nem configurei nenhum software de firewall, mas é possível que haja algo de estoque que eu não saiba.
Estou lendo o livro "sed & awk" de Dougherty e Robbins. Um dos exemplos pede para canalizar a saída para um script de shell:
sed -f nameState list | byState
Mas descobri que, para funcionar, preciso dar ao script 'byState' permissões de execução com chmod e também chamá-lo com ponto-barra:
sed -f nameState list | ./byState
Será que esse sempre será o caso? O livro é de 1997, então talvez o padrão do shell tenha mudado? Ou é porque estou usando bash e não sh ?
EDIT: Aqui está o script byState:
#! /bin/sh
awk -F, ’{
print $4 ", " $0
}’ $* |
sort |
awk -F, ’
$1 == LastState {
print "\t" $2
}
$1 != LastState {
LastState = $1
print $1
print "\t" $2
}’
Ao tentar obter o PID de um comando shell, é possível usar um arquivo de script:
#!/bin/bash
ls -lha &
echo "$!"
No entanto, não é possível usar apenas o terminal.
/bin/bash -c 'ls -lha & ; echo "$!"'
Isso retorna o erro:
/bin/bash: -c: linha 1: erro de sintaxe próximo ao token inesperado `;'
O manual afirma o seguinte:
Uma lista é uma sequência de um ou mais pipelines separados por um dos operadores
;
,&
,&&
, ou||
, e opcionalmente terminados por um de;
,&
, ou<newline>
. Destes operadores de lista,&&
e||
têm precedência igual, seguidos por;
e&
, que têm precedência igual.Uma sequência de uma ou mais novas linhas pode aparecer em uma lista em vez de um ponto e vírgula para delimitar comandos.
Se um comando for encerrado pelo operador de controle
&
, o shell executa o comando em segundo plano em um subshell. O shell não espera o comando terminar, e o status de retorno é 0. Comandos separados por a;
são executados sequencialmente; o shell espera que cada comando termine por vez. O status de retorno é o status de saída do último comando executado.
Então eu também tentei usar nova linha, mas não consegui:
/bin/bash -c 'ls -lha & \n echo "$!"'
PS: Não usarei ls
command e é um script mais complexo. Este é apenas um exemplo mínimo para reproduzir o problema.