Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Central de ajuda/ Elastic Cloud Server/ Perguntas frequentes/ Login and Connection/ Remote Login Errors on Linux/ What Should I Do If Error Message "Permission denied" Is Displayed When I Remotely Log In to a Linux ECS?
Atualizado em 2025-01-23 GMT+08:00

What Should I Do If Error Message "Permission denied" Is Displayed When I Remotely Log In to a Linux ECS?

Symptom

When I attempted to remotely log in to a Linux ECS, the system displayed error Message "Permission denied".

Figura 1 Permission denied
  • To resolve this issue, you are required to restart the ECS and enter the rescue mode.
  • Restarting the ECS may interrupt services. Exercise caution when performing this operation.

Root Cause

The nofile parameter in /etc/security/limits.conf is used to set the maximum number of files that can be opened in the system. If the value is greater than the fs.nr_open value (1048576 by default) set in PermissionDenied.png, a login verification error will occur, leading to "Permission denied".

Solution

  1. Entre no modo de usuário único.
    O seguinte usa o CentOS 7 como exemplo:
    1. Reinicie o ECS e clique em Remote Login.
    2. Clique em Ctrl+Alt+Del na parte superior do painel de logon remoto para reiniciar o ECS.
    3. Pressione a tecla de direção para cima para evitar a inicialização automática do sistema. Quando os kernels forem exibidos, pressione e para entrar no modo de edição.
      Figura 2 Entrar no modo de edição do kernel

      O arquivo grub é criptografado por imagens Euler por padrão. Antes de entrar no modo de edição, você precisa entrar em contato com serviço ao cliente para obter nome de usuário e senha.

    4. Localize a linha contendo linux16 e exclua os parâmetros que você não precisa.
    5. Mude ro para rw para montar a partição raiz com permissões de leitura/gravação.
    6. Adicione rd.break e pressione Ctrl+X.
      Figura 3 Antes da modificação
      Figura 4 Após a modificação
    7. Execute o seguinte comando para ir para o diretório /sysroot:

      # chroot /sysroot

  1. Run the following command to view the fs.nr_open value:

    sysctl fs.nr_open

  2. Change the nofile value in /etc/security/limits.conf so that the value is smaller than the fs.nr_open value obtained in 2.
    vi /etc/security/limits.conf

    limits.conf is the pam_limits.so configuration file of Linux Pluggable Authentication Module (PAM). For more details, run the following command:

    man limits.conf

  3. Restart the ECS and try to log in to it again.