0

I try to set up an ssh connection by RCA-key. Settings for PuTTy: 192.168.1.41, port 22, the private key was choosed.

  1. My public key has placed "192.168.1.41/home/pi/.ssh/PuTKey.pub" therefore I should enter a command cat ~/.ssh/PutKey.pub | ssh pi@192.168.1.41 'cat >> ~/.ssh/authorized_keys' but console replied me /root/.ssh/PuTKey. file or folder does not exist, then required the password. What does it mean? Maybe was file *.pub caught?

  2. Then, I set up PasswordAuthentication no and login required. why? log:

Jul  2 09:30:01 raspberrypi systemd-logind[392]: New session c5 of user pi.
Jul  2 09:30:08 raspberrypi sshd[1775]: pam_unix(sshd:session): session closed for user pi
Jul  2 09:30:08 raspberrypi systemd-logind[392]: Removed session c5.
Jul  2 09:31:29 raspberrypi sshd[1816]: Connection closed by 192.168.1.34 port 55675 [preauth]
Jul  2 09:47:37 raspberrypi sshd[1919]: Accepted password for pi from 192.168.1.41 port 57772 ssh2
Jul  2 09:47:37 raspberrypi sshd[1919]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jul  2 09:47:37 raspberrypi systemd-logind[392]: New session c6 of user pi.
Jul  2 09:47:37 raspberrypi sshd[1940]: Received disconnect from 192.168.1.41 port 57772:11: disconnected by user
Jul  2 09:47:37 raspberrypi sshd[1940]: Disconnected from 192.168.1.41 port 57772
Jul  2 09:47:37 raspberrypi sshd[1919]: pam_unix(sshd:session): session closed for user pi
Jul  2 09:47:37 raspberrypi systemd-logind[392]: Removed session c6.
Jul  2 10:02:14 raspberrypi sshd[502]: Received signal 15; terminating.
Jul  2 10:02:14 raspberrypi sshd[1988]: Server listening on 0.0.0.0 port 22.
Jul  2 10:02:14 raspberrypi sshd[1988]: Server listening on :: port 22.
Jul  2 10:03:21 raspberrypi sshd[1990]: Connection closed by 192.168.1.34 port 58683 [preauth]
Jul  2 10:04:07 raspberrypi sshd[2003]: Connection closed by 192.168.1.41 port 57774 [preauth]
Jul  2 10:17:01 raspberrypi CRON[2029]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 10:17:01 raspberrypi CRON[2029]: pam_unix(cron:session): session closed for user root
Jul  2 10:44:12 raspberrypi sshd[2135]: Invalid user  from 192.168.1.34 port 61045
Jul  2 10:44:12 raspberrypi sshd[2135]: input_userauth_request: invalid user  [preauth]
Jul  2 10:44:13 raspberrypi sshd[2135]: Connection closed by 192.168.1.34 port 61045 [preauth]
Jul  2 10:44:24 raspberrypi su[1640]: pam_unix(su:session): session closed for user root
Jul  2 10:44:29 raspberrypi systemd-logind[409]: New seat seat0.
Jul  2 10:44:31 raspberrypi sshd[500]: Server listening on 0.0.0.0 port 22.
Jul  2 10:44:31 raspberrypi sshd[500]: Server listening on :: port 22.
Jul  2 10:44:33 raspberrypi lightdm: pam_unix(lightdm-autologin:session): session opened for user pi by (uid=0)
Jul  2 10:44:33 raspberrypi systemd-logind[409]: New session c1 of user pi.
Jul  2 10:44:33 raspberrypi systemd: pam_unix(systemd-user:session): session opened for user pi by (uid=0)
Jul  2 10:44:36 raspberrypi polkitd(authority=local): Registered Authentication Agent for unix-session:c1 (system bus name :1.12 [lxpolkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8)
Jul  2 10:45:52 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 10:48:32 raspberrypi vncserver-x11[487,root]: session ended: user pi
Jul  2 10:48:40 raspberrypi vncpamhelper: pam_unix(vncserver:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=pi
Jul  2 10:48:48 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 10:48:52 raspberrypi vncserver-x11[487,root]: session ended: user pi
Jul  2 10:49:20 raspberrypi sshd[1157]: Connection closed by 192.168.1.34 port 61390 [preauth]
Jul  2 10:49:30 raspberrypi sshd[1160]: Invalid user  from 192.168.1.34 port 61416
Jul  2 10:49:30 raspberrypi sshd[1160]: input_userauth_request: invalid user  [preauth]
Jul  2 10:49:31 raspberrypi sshd[1160]: Connection closed by 192.168.1.34 port 61416 [preauth]
Jul  2 10:49:42 raspberrypi sshd[1165]: Connection closed by 192.168.1.34 port 61432 [preauth]
Jul  2 10:51:26 raspberrypi sshd[1172]: Connection closed by 192.168.1.34 port 61565 [preauth]
Jul  2 10:59:27 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 11:01:41 raspberrypi sshd[1210]: Connection closed by 192.168.1.34 port 63170 [preauth]
Jul  2 11:03:08 raspberrypi sshd[1213]: Invalid user bv from 192.168.1.34 port 63198
Jul  2 11:03:08 raspberrypi sshd[1213]: input_userauth_request: invalid user bv [preauth]
Jul  2 11:03:09 raspberrypi sshd[1213]: Connection closed by 192.168.1.34 port 63198 [preauth]
Jul  2 11:04:59 raspberrypi sshd[1228]: Connection closed by 192.168.1.34 port 63563 [preauth]
Jul  2 11:11:29 raspberrypi vncserver-x11[487,root]: session ended: user pi
Jul  2 11:11:36 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 11:17:01 raspberrypi CRON[1287]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 11:17:01 raspberrypi CRON[1287]: pam_unix(cron:session): session closed for user root
Jul  2 11:17:37 raspberrypi sshd[1302]: Connection closed by 192.168.1.34 port 64790 [preauth]
Jul  2 11:42:51 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/su
Jul  2 11:42:51 raspberrypi sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul  2 11:42:51 raspberrypi su[1394]: Successful su for root by root
Jul  2 11:42:51 raspberrypi su[1394]: + /dev/pts/0 root:root
Jul  2 11:42:51 raspberrypi su[1394]: pam_unix(su:session): session opened for user root by (uid=0)
Jul  2 11:42:51 raspberrypi su[1394]: pam_systemd(su:session): Cannot create session: Already running in a session
Jul  2 11:43:53 raspberrypi sudo:       pi : TTY=pts/2 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/su
Jul  2 11:43:53 raspberrypi sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul  2 11:43:53 raspberrypi su[1437]: Successful su for root by root
Jul  2 11:43:53 raspberrypi su[1437]: + /dev/pts/2 root:root
Jul  2 11:43:53 raspberrypi su[1437]: pam_unix(su:session): session opened for user root by (uid=0)
Jul  2 11:43:53 raspberrypi su[1437]: pam_systemd(su:session): Cannot create session: Already running in a session
Jul  2 11:44:34 raspberrypi sshd[1449]: Connection closed by 192.168.1.41 port 38800 [preauth]
Jul  2 11:46:30 raspberrypi sshd[1468]: Connection closed by 192.168.1.41 port 38802 [preauth]
Jul  2 11:46:46 raspberrypi sshd[500]: Received signal 15; terminating.
Jul  2 11:46:46 raspberrypi sshd[1481]: Server listening on 0.0.0.0 port 22.
Jul  2 11:46:46 raspberrypi sshd[1481]: Server listening on :: port 22.
Jul  2 11:46:54 raspberrypi sshd[1484]: Accepted password for pi from 192.168.1.41 port 38804 ssh2
Jul  2 11:46:54 raspberrypi sshd[1484]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jul  2 11:46:54 raspberrypi systemd-logind[409]: New session c2 of user pi.
Jul  2 11:46:54 raspberrypi sshd[1494]: Received disconnect from 192.168.1.41 port 38804:11: disconnected by user
Jul  2 11:46:54 raspberrypi sshd[1494]: Disconnected from 192.168.1.41 port 38804
Jul  2 11:46:54 raspberrypi sshd[1484]: pam_unix(sshd:session): session closed for user pi
Jul  2 11:46:54 raspberrypi systemd-logind[409]: Removed session c2.
Jul  2 11:47:41 raspberrypi sshd[1481]: Received signal 15; terminating.
Jul  2 11:47:41 raspberrypi sshd[1529]: Server listening on 0.0.0.0 port 22.
Jul  2 11:47:41 raspberrypi sshd[1529]: Server listening on :: port 22.
Jul  2 11:48:14 raspberrypi sshd[1530]: Connection closed by 192.168.1.34 port 51793 [preauth]
Jul  2 11:48:56 raspberrypi sshd[1536]: Connection closed by 192.168.1.34 port 51847 [preauth]
Jul  2 11:49:56 raspberrypi sshd[1539]: Connection closed by 192.168.1.34 port 51910 [preauth]
Jul  2 12:17:01 raspberrypi CRON[2018]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 12:17:01 raspberrypi CRON[2018]: pam_unix(cron:session): session closed for user root
Jul  2 13:17:02 raspberrypi CRON[2206]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 13:17:02 raspberrypi CRON[2206]: pam_unix(cron:session): session closed for user root
Jul  2 13:19:05 raspberrypi vncserver-x11[487,root]: session ended: user pi
Jul  2 14:17:01 raspberrypi CRON[2413]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 14:17:01 raspberrypi CRON[2413]: pam_unix(cron:session): session closed for user root
Jul  2 15:17:01 raspberrypi CRON[2585]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 15:17:01 raspberrypi CRON[2585]: pam_unix(cron:session): session closed for user root
Jul  2 16:17:01 raspberrypi CRON[2770]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 16:17:01 raspberrypi CRON[2770]: pam_unix(cron:session): session closed for user root
Jul  2 17:17:01 raspberrypi CRON[2957]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 17:17:01 raspberrypi CRON[2957]: pam_unix(cron:session): session closed for user root
Jul  2 18:17:01 raspberrypi CRON[3163]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 18:17:01 raspberrypi CRON[3163]: pam_unix(cron:session): session closed for user root
Jul  2 19:15:20 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 19:17:01 raspberrypi CRON[3592]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 19:17:01 raspberrypi CRON[3592]: pam_unix(cron:session): session closed for user root
Jul  2 19:23:48 raspberrypi sshd[3625]: Invalid user  from 192.168.1.34 port 58180
Jul  2 19:23:48 raspberrypi sshd[3625]: input_userauth_request: invalid user  [preauth]
Jul  2 19:23:49 raspberrypi sshd[3625]: Connection closed by 192.168.1.34 port 58180 [preauth]
Jul  2 19:24:21 raspberrypi sshd[3633]: Invalid user  from 192.168.1.34 port 58271
Jul  2 19:24:21 raspberrypi sshd[3633]: input_userauth_request: invalid user  [preauth]
Jul  2 19:24:23 raspberrypi sshd[3633]: Connection closed by 192.168.1.34 port 58271 [preauth]
Jul  2 19:24:30 raspberrypi sshd[3641]: Invalid user  from 192.168.1.34 port 58297
Jul  2 19:24:30 raspberrypi sshd[3641]: input_userauth_request: invalid user  [preauth]
Jul  2 19:24:31 raspberrypi sshd[3641]: Connection closed by 192.168.1.34 port 58297 [preauth]
Jul  2 19:25:17 raspberrypi sshd[3650]: Connection closed by 192.168.1.34 port 58433 [preauth]
Jul  2 19:59:40 raspberrypi sshd[4080]: Connection closed by 192.168.1.41 port 38818 [preauth]
Jul  2 20:00:28 raspberrypi sshd[1529]: Received signal 15; terminating.
Jul  2 20:00:28 raspberrypi sshd[4096]: Server listening on 0.0.0.0 port 22.
Jul  2 20:00:28 raspberrypi sshd[4096]: Server listening on :: port 22.
Jul  2 20:00:39 raspberrypi sshd[4101]: Accepted password for pi from 192.168.1.41 port 38820 ssh2
Jul  2 20:00:39 raspberrypi sshd[4101]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jul  2 20:00:39 raspberrypi systemd-logind[409]: New session c3 of user pi.
Jul  2 20:00:39 raspberrypi sshd[4113]: Received disconnect from 192.168.1.41 port 38820:11: disconnected by user
Jul  2 20:00:39 raspberrypi sshd[4113]: Disconnected from 192.168.1.41 port 38820
Jul  2 20:00:39 raspberrypi sshd[4101]: pam_unix(sshd:session): session closed for user pi
Jul  2 20:00:39 raspberrypi systemd-logind[409]: Removed session c3.
Jul  2 20:17:01 raspberrypi CRON[4195]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 20:17:01 raspberrypi CRON[4195]: pam_unix(cron:session): session closed for user root
Jul  2 21:17:01 raspberrypi CRON[4363]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul  2 21:17:01 raspberrypi CRON[4363]: pam_unix(cron:session): session closed for user root
Jul  2 21:18:09 raspberrypi vncserver-x11[487,root]: session ended: user pi
Jul  2 21:27:49 raspberrypi vncserver-x11[487,root]: session started: user pi permissions f
Jul  2 21:44:31 raspberrypi sshd[4464]: Accepted password for pi from 192.168.1.34 port 56299 ssh2
Jul  2 21:44:31 raspberrypi sshd[4464]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jul  2 21:44:31 raspberrypi systemd-logind[409]: New session c4 of user pi.

Help me, please.

1 Answer 1

0

It appears you are adding the key for user "pi" but trying to access the system as user "root".

Log into the pi and, as root:

mkdir -p /root/.ssh; cat /home/pi/.ssh/authorized_keys >> /root/.ssh/authorized_keys

8
  • I have done it now. Log: Jul 3 08:07:51 raspberrypi sshd[1410]: Connection closed by 192.168.1.34 port 61161 [preauth] PuTTy answered me "server refused privat key"
    – serginator
    Jul 3, 2019 at 5:10
  • does that work?
    – davidgo
    Jul 3, 2019 at 5:12
  • No, it does not work
    – serginator
    Jul 3, 2019 at 7:01
  • I've set up custom port 9810, and I get such result: Server listening on 0.0.0.0 port 9810. Server listening on :: port 9810. Invalid user login from 192.168.1.34 port 54994 input_userauth_request: invalid user login [preauth] Connection closed by 192.168.1.34 port 54994 [preauth] But, if I enable PasswordAuth I successfully enter there. I do not understand what to fix it
    – serginator
    Jul 9, 2019 at 18:01
  • Your users appear all over the place - pi, dgh, root - what is the account you are trying to log in to? What is the account you are logging in from?
    – davidgo
    Jul 9, 2019 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.