2016-03-17 2 views
1

Я пытаюсь включить SSH-вход в качестве администратора в виртуальной машине Linux, работающей на Microsoft Azure. VM основана на изображении Oracle Linux 6.4 от Azure Marketplace.SSH login as root в Azure

Я хотел бы иметь возможность SSH в VM в качестве пользователя root, используя общедоступную аутентификацию сертификата. Мне нужен прямой корневой вход (в отличие от использования sudo), потому что я пытаюсь выполнить автоматическое развертывание программного обеспечения для Azure VM, используя rsync, подключающийся к целевому объекту как root.

Вот что я пробовал:

  1. У меня есть открытый ключ в файле authorized_keys, и я могу войти в систему без пароля в качестве обычного пользователя - но не корень.
  2. У меня есть тот же файл authorized_keys, который работал с обычным пользователем, скопированным в /root/.ssh. Каталоги/root и /root/.ssh и файлы authorized_keys принадлежат root и не доступны для записи кем-либо еще.
  3. Я поставил

    PermitRootLogin yes 
    

    в/и т.д./SSH/sshd_config, а затем перезапустить SSHd (и перезагрузки ВМ).

  4. При подключении с правами администратора, я получаю сообщение «Сервер отказался от нашего ключа». Я успешно активировали SSH логин как корень с проверкой пароля, и был в состоянии войти в систему с правами администратора с паролем:

    Using username "root". 
    Server refused our key 
    Using keyboard-interactive authentication. 
    Password: 
    [[email protected] ~]# 
    
  5. Я начал второй экземпляр SSHD в режиме отладки, на другой порт:

    [[email protected] ~]# /usr/sbin/sshd -Dd -p 2020 
    debug1: sshd version OpenSSH_5.3p1 
    debug1: read PEM private key done: type RSA 
    debug1: private host key: #0 type 1 RSA 
    debug1: read PEM private key done: type DSA 
    debug1: private host key: #1 type 2 DSA 
    debug1: rexec_argv[0]='/usr/sbin/sshd' 
    debug1: rexec_argv[1]='-Dd' 
    debug1: rexec_argv[2]='-p' 
    debug1: rexec_argv[3]='2020' 
    Set /proc/self/oom_score_adj from 0 to -1000 
    debug1: Bind to port 2020 on 0.0.0.0. 
    Server listening on 0.0.0.0 port 2020. 
    debug1: Bind to port 2020 on ::. 
    Server listening on :: port 2020. 
    

    Когда я подключаюсь к экземпляру отладки sshd (на порту 2020), я могу войти в систему как пользователь root без пароля - он принимает открытый ключ!

  6. Вместо использования PuTTY в Windows в качестве клиента SSH я попытался использовать команду ssh на той же виртуальной машине (при входе в систему как обычный пользователь). Я смог войти через SSH из одной учетной записи обычного пользователя в другой без пароля, но мне не удалось войти в учетную запись root из обычной учетной записи. Вот выход SSH работает в режиме отладки, подключения в качестве корня:

    [[email protected] ~]$ ssh -vvv [email protected] 
    OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 
    debug1: Reading configuration data /etc/ssh/ssh_config 
    debug1: Applying options for * 
    debug2: ssh_connect: needpriv 0 
    debug1: Connecting to myazureserver [10.0.0.4] port 22. 
    debug1: Connection established. 
    debug1: identity file /home/oracle/.ssh/identity type -1 
    debug3: Not a RSA1 key file /home/oracle/.ssh/id_rsa. 
    debug2: key_type_from_name: unknown key type '-----BEGIN' 
    debug3: key_read: missing keytype 
    debug3: key_read: missing whitespace 
    ... 
    debug3: key_read: missing whitespace 
    debug2: key_type_from_name: unknown key type '-----END' 
    debug3: key_read: missing keytype 
    debug1: identity file /home/oracle/.ssh/id_rsa type 1 
    debug1: identity file /home/oracle/.ssh/id_dsa type -1 
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 
    debug1: match: OpenSSH_5.3 pat OpenSSH* 
    debug1: Enabling compatibility mode for protocol 2.0 
    debug1: Local version string SSH-2.0-OpenSSH_5.3 
    debug2: fd 3 setting O_NONBLOCK 
    debug1: SSH2_MSG_KEXINIT sent 
    debug3: Wrote 792 bytes for a total of 813 
    debug1: SSH2_MSG_KEXINIT received 
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: none,[email protected],zlib 
    debug2: kex_parse_kexinit: none,[email protected],zlib 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: none,[email protected] 
    debug2: kex_parse_kexinit: none,[email protected] 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: mac_setup: found hmac-md5 
    debug1: kex: server->client aes128-ctr hmac-md5 none 
    debug2: mac_setup: found hmac-md5 
    debug1: kex: client->server aes128-ctr hmac-md5 none 
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
    debug3: Wrote 24 bytes for a total of 837 
    debug2: dh_gen_key: priv key bits set: 128/256 
    debug2: bits set: 512/1024 
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
    debug3: Wrote 144 bytes for a total of 981 
    debug3: check_host_in_hostfile: filename /home/oracle/.ssh/known_hosts 
    debug3: check_host_in_hostfile: match line 1 
    debug3: check_host_in_hostfile: filename /home/oracle/.ssh/known_hosts 
    debug3: check_host_in_hostfile: match line 1 
    debug1: Host 'myazureserver' is known and matches the RSA host key. 
    debug1: Found key in /home/oracle/.ssh/known_hosts:1 
    debug2: bits set: 507/1024 
    debug1: ssh_rsa_verify: signature correct 
    debug2: kex_derive_keys 
    debug2: set_newkeys: mode 1 
    debug1: SSH2_MSG_NEWKEYS sent 
    debug1: expecting SSH2_MSG_NEWKEYS 
    debug3: Wrote 16 bytes for a total of 997 
    debug2: set_newkeys: mode 0 
    debug1: SSH2_MSG_NEWKEYS received 
    debug1: SSH2_MSG_SERVICE_REQUEST sent 
    debug3: Wrote 48 bytes for a total of 1045 
    debug2: service_accept: ssh-userauth 
    debug1: SSH2_MSG_SERVICE_ACCEPT received 
    debug2: key: /home/oracle/.ssh/identity ((nil)) 
    debug2: key: /home/oracle/.ssh/id_rsa (0x7f81f3a5dd70) 
    debug2: key: /home/oracle/.ssh/id_dsa ((nil)) 
    debug3: Wrote 64 bytes for a total of 1109 
    debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive 
    debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive 
    debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password 
    debug3: authmethod_lookup gssapi-keyex 
    debug3: remaining preferred: gssapi-with-mic,publickey,keyboard-interactive,password 
    debug3: authmethod_is_enabled gssapi-keyex 
    debug1: Next authentication method: gssapi-keyex 
    debug1: No valid Key exchange context 
    debug2: we did not send a packet, disable method 
    debug3: authmethod_lookup gssapi-with-mic 
    debug3: remaining preferred: publickey,keyboard-interactive,password 
    debug3: authmethod_is_enabled gssapi-with-mic 
    debug1: Next authentication method: gssapi-with-mic 
    debug3: Trying to reverse map address 10.0.0.4. 
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug2: we did not send a packet, disable method 
    debug3: authmethod_lookup publickey 
    debug3: remaining preferred: keyboard-interactive,password 
    debug3: authmethod_is_enabled publickey 
    debug1: Next authentication method: publickey 
    debug1: Trying private key: /home/oracle/.ssh/identity 
    debug3: no such identity: /home/oracle/.ssh/identity 
    debug1: Offering public key: /home/oracle/.ssh/id_rsa 
    debug3: send_pubkey_test 
    debug2: we sent a publickey packet, wait for reply 
    debug3: Wrote 368 bytes for a total of 1477 
    debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive 
    debug1: Trying private key: /home/oracle/.ssh/id_dsa 
    debug3: no such identity: /home/oracle/.ssh/id_dsa 
    debug2: we did not send a packet, disable method 
    debug3: authmethod_lookup keyboard-interactive 
    debug3: remaining preferred: password 
    debug3: authmethod_is_enabled keyboard-interactive 
    debug1: Next authentication method: keyboard-interactive 
    debug2: userauth_kbdint 
    debug2: we sent a keyboard-interactive packet, wait for reply 
    debug3: Wrote 96 bytes for a total of 1573 
    debug2: input_userauth_info_req 
    debug2: input_userauth_info_req: num_prompts 1 
    Password: 
    

    и здесь выход SSH соединения, как обычный пользователь:

    [[email protected] ~]$ ssh -vvv [email protected] 
    OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 
    debug1: Reading configuration data /etc/ssh/ssh_config 
    debug1: Applying options for * 
    debug2: ssh_connect: needpriv 0 
    debug1: Connecting to myazureserver [10.0.0.4] port 22. 
    debug1: Connection established. 
    debug1: identity file /home/oracle/.ssh/identity type -1 
    debug3: Not a RSA1 key file /home/oracle/.ssh/id_rsa. 
    debug2: key_type_from_name: unknown key type '-----BEGIN' 
    debug3: key_read: missing keytype 
    debug3: key_read: missing whitespace 
    ... 
    debug3: key_read: missing whitespace 
    debug2: key_type_from_name: unknown key type '-----END' 
    debug3: key_read: missing keytype 
    debug1: identity file /home/oracle/.ssh/id_rsa type 1 
    debug1: identity file /home/oracle/.ssh/id_dsa type -1 
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 
    debug1: match: OpenSSH_5.3 pat OpenSSH* 
    debug1: Enabling compatibility mode for protocol 2.0 
    debug1: Local version string SSH-2.0-OpenSSH_5.3 
    debug2: fd 3 setting O_NONBLOCK 
    debug1: SSH2_MSG_KEXINIT sent 
    debug3: Wrote 792 bytes for a total of 813 
    debug1: SSH2_MSG_KEXINIT received 
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: none,[email protected],zlib 
    debug2: kex_parse_kexinit: none,[email protected],zlib 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
    debug2: kex_parse_kexinit: none,[email protected] 
    debug2: kex_parse_kexinit: none,[email protected] 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: mac_setup: found hmac-md5 
    debug1: kex: server->client aes128-ctr hmac-md5 none 
    debug2: mac_setup: found hmac-md5 
    debug1: kex: client->server aes128-ctr hmac-md5 none 
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
    debug3: Wrote 24 bytes for a total of 837 
    debug2: dh_gen_key: priv key bits set: 119/256 
    debug2: bits set: 535/1024 
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
    debug3: Wrote 144 bytes for a total of 981 
    debug3: check_host_in_hostfile: filename /home/oracle/.ssh/known_hosts 
    debug3: check_host_in_hostfile: match line 1 
    debug3: check_host_in_hostfile: filename /home/oracle/.ssh/known_hosts 
    debug3: check_host_in_hostfile: match line 1 
    debug1: Host 'myazureserver' is known and matches the RSA host key. 
    debug1: Found key in /home/oracle/.ssh/known_hosts:1 
    debug2: bits set: 529/1024 
    debug1: ssh_rsa_verify: signature correct 
    debug2: kex_derive_keys 
    debug2: set_newkeys: mode 1 
    debug1: SSH2_MSG_NEWKEYS sent 
    debug1: expecting SSH2_MSG_NEWKEYS 
    debug3: Wrote 16 bytes for a total of 997 
    debug2: set_newkeys: mode 0 
    debug1: SSH2_MSG_NEWKEYS received 
    debug1: SSH2_MSG_SERVICE_REQUEST sent 
    debug3: Wrote 48 bytes for a total of 1045 
    debug2: service_accept: ssh-userauth 
    debug1: SSH2_MSG_SERVICE_ACCEPT received 
    debug2: key: /home/oracle/.ssh/identity ((nil)) 
    debug2: key: /home/oracle/.ssh/id_rsa (0x7f2ae500fd70) 
    debug2: key: /home/oracle/.ssh/id_dsa ((nil)) 
    debug3: Wrote 64 bytes for a total of 1109 
    debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive 
    debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive 
    debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password 
    debug3: authmethod_lookup gssapi-keyex 
    debug3: remaining preferred: gssapi-with-mic,publickey,keyboard-interactive,password 
    debug3: authmethod_is_enabled gssapi-keyex 
    debug1: Next authentication method: gssapi-keyex 
    debug1: No valid Key exchange context 
    debug2: we did not send a packet, disable method 
    debug3: authmethod_lookup gssapi-with-mic 
    debug3: remaining preferred: publickey,keyboard-interactive,password 
    debug3: authmethod_is_enabled gssapi-with-mic 
    debug1: Next authentication method: gssapi-with-mic 
    debug3: Trying to reverse map address 10.0.0.4. 
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    
    
    debug1: Unspecified GSS failure. Minor code may provide more information 
    Credentials cache file '/tmp/krb5cc_54321' not found 
    
    debug2: we did not send a packet, disable method 
    debug3: authmethod_lookup publickey 
    debug3: remaining preferred: keyboard-interactive,password 
    debug3: authmethod_is_enabled publickey 
    debug1: Next authentication method: publickey 
    debug1: Trying private key: /home/oracle/.ssh/identity 
    debug3: no such identity: /home/oracle/.ssh/identity 
    debug1: Offering public key: /home/oracle/.ssh/id_rsa 
    debug3: send_pubkey_test 
    debug2: we sent a publickey packet, wait for reply 
    debug3: Wrote 368 bytes for a total of 1477 
    debug1: Server accepts key: pkalg ssh-rsa blen 279 
    debug2: input_userauth_pk_ok: SHA1 fp b6:aa:fd:7b:bf:d2:99:78:48:38:cc:9e:b0:26:05:dc:1c:4e:83:35 
    debug3: sign_and_send_pubkey 
    debug1: read PEM private key done: type RSA 
    debug3: Wrote 640 bytes for a total of 2117 
    debug1: Authentication succeeded (publickey). 
    debug1: channel 0: new [client-session] 
    debug3: ssh_session2_open: channel_new: 0 
    debug2: channel 0: send open 
    debug1: Requesting [email protected] 
    debug1: Entering interactive session. 
    debug3: Wrote 128 bytes for a total of 2245 
    debug2: callback start 
    debug2: client_session2_setup: id 0 
    debug2: channel 0: request pty-req confirm 1 
    debug1: Sending environment. 
    debug3: Ignored env HOSTNAME 
    debug3: Ignored env SELINUX_ROLE_REQUESTED 
    debug3: Ignored env TERM 
    debug3: Ignored env SHELL 
    debug3: Ignored env HISTSIZE 
    debug3: Ignored env SSH_CLIENT 
    debug3: Ignored env SELINUX_USE_CURRENT_RANGE 
    debug3: Ignored env SSH_TTY 
    debug3: Ignored env USER 
    debug3: Ignored env LS_COLORS 
    debug3: Ignored env MAIL 
    debug3: Ignored env PATH 
    debug3: Ignored env PWD 
    debug1: Sending env LANG = en_US.UTF-8 
    debug2: channel 0: request env confirm 0 
    debug3: Ignored env SELINUX_LEVEL_REQUESTED 
    debug3: Ignored env HISTCONTROL 
    debug3: Ignored env SHLVL 
    debug3: Ignored env HOME 
    debug3: Ignored env LOGNAME 
    debug3: Ignored env SSH_CONNECTION 
    debug3: Ignored env LESSOPEN 
    debug3: Ignored env G_BROKEN_FILENAMES 
    debug3: Ignored env _ 
    debug2: channel 0: request shell confirm 1 
    debug2: fd 3 setting TCP_NODELAY 
    debug2: callback done 
    debug2: channel 0: open confirm rwindow 0 rmax 32768 
    debug3: Wrote 448 bytes for a total of 2693 
    debug2: channel_input_status_confirm: type 99 id 0 
    debug2: PTY allocation request accepted on channel 0 
    debug2: channel 0: rcvd adjust 2097152 
    debug2: channel_input_status_confirm: type 99 id 0 
    debug2: shell request accepted on channel 0 
    

Edit - дополнительный журнал Информация о файле ниже. В/вар/Журнал/безопасности, я вижу это для успешной регистрации:

Mar 17 18:55:09 myazureserver sshd[1196]: Server listening on :: port 22. 
Mar 17 19:08:18 myazureserver sshd[1383]: Accepted publickey for jziabick from xx.xx.xx.xx port 53533 ssh2 
Mar 17 19:08:19 myazureserver sshd[1383]: pam_unix(sshd:session): session opened for user jziabick by (uid=0) 

а для неудачного входа в систему (как корень) я вижу в/вар/Журнал/безопасный

Mar 18 10:52:24 myazureserver sshd[1992]: Server listening on :: port 22. 
Mar 18 10:53:02 myazureserver sshd[1997]: Received disconnect from xx.xx.xx.xx: 14: No supported authentication methods available 

В/вар /log/audit/audit.log я нашел (для неудачного входа в систему в качестве суперпользователя):

type=AVC msg=audit(1458311548.677:733): avc: denied { read } for pid=1948 comm="sshd" name="authorized_keys" dev=sda3 ino=259748 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file 
type=SYSCALL msg=audit(1458311548.677:733): arch=c000003e syscall=2 success=no exit=-13 a0=7f8c6621d470 a1=800 a2=1 a3=4 items=0 ppid=1196 pid=1948 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="sshd" exe="/usr/sbin/sshd" subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 key=(null) 
type=USER_AUTH msg=audit(1458311548.679:734): user pid=1948 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=pubkey acct="root" exe="/usr/sbin/sshd" hostname=? addr=xx.xx.xx.xx terminal=ssh res=failed' 
type=USER_AUTH msg=audit(1458311668.148:735): user pid=1950 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:authentication acct="root" exe="/usr/sbin/sshd" hostname=c-xx-xx-xx-xx.hsd1.il.comcast.net addr=xx.xx.xx.xx terminal=ssh res=failed' 

Что мне не хватает? Я делал установку SSH с аутентификацией открытого ключа много раз в Oracle Linux (включая login как root).Это должно быть то, что характерно для конфигурации Azure.

+0

Что вы можете увидеть в журналах/аудите на сервере? – Jakuje

+0

@Jakuje, на какие файлы журналов я должен смотреть? Я отредактировал вопрос и предоставил фрагменты из/var/log/secure и /var/log/audit/audit.log. Я должен был сократить результат отладки, чтобы он соответствовал пределу в 30 000 символов для вопроса. –

ответ

0

Вы можете обвинить SELinux. Вы потеряли authorized_keys файл (и могут быть и другими файлами).

тип = AVC тзд = аудит (+1458311548,677: 733): АВК: отказано {чтения} для PID = 1948 Comm = "Sshd" Name = "authorized_keys" DEV = sda3 ино = 259748 scontext = system_u: system_r: sshd_t: s0-s0: c0.c1023 tcontext = unconfined_u: object_r: admin_home_t: s0 tclass = файл

безопасное решение будет переобозначим /root/:

restorecon -rf /root/ 

или если он не помогло бы, просто исправьте метку для этого конкретного файла:

chcon -t ssh_home_t /root/.ssh/authorized_keys 

Это должно сделать это. Если нет, пожалуйста, обновите вопрос с текущими результатами (AVC сообщения от аудита обычно полезны).

+0

Благодарим вас за быстрый и точный ответ! Я могу подтвердить, что проблема SELinux была проблемой. Я переключил SELinux из 'принудительного использования' в' permissive' в '/ etc/selinux/config', и после перезагрузки я смог войти в систему с правами root, прошедшим проверку подлинности с помощью открытого ключа. –

+0

Не делайте этого. SELinux существует по уважительным причинам. Скорее попытайтесь исправить проблемы с ярлыками, как рекомендуется, затем отключите их. – Jakuje

+0

Благодарим вас за быстрый и точный ответ! Я могу подтвердить, что проблема SELinux была проблемой. Я переключил SELinux из 'принудительного использования' в' permissive' в '/ etc/selinux/config', и после перезагрузки я смог войти в систему с правами root, прошедшим проверку подлинности с помощью открытого ключа. Я попытался перевести '/ root /' с restorecon -rf/root/ , и это не помогло. Это может быть частью настройки Azure для защиты файла authorized_keys с помощью SELinux. Когда я изначально создал файл '/ root/.ssh/authorized_users', я, вероятно, вручную создал каталог' .ssh' и скопировал файл 'authorized_users' из моего собственного домашнего каталога. –