LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-04-2020, 04:04 AM   #1
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Rep: Reputation: 19
ssh keys issue


Hi All

I have an archive server with multiple accounts already setup and sshkeys authentications is working fine with all these, the issue is with the new connections I am trying to setup

I have done the same as before, created a new user on the archive server with non encrypted home folder.

On Qnap logged in as admin and created ssh keys ssh-keygen -t rsa
Copied the data in to the new users .ssh folder cat /usr/src/id_rsa.pub >>/media/sdc/newuser/.ssh/authorised_keys
chmod 700 /media/sdc/newuser/.ssh/authorized_keys
chown newuser:newuser /media/sdc/newuser/.ssh/authorized_keys

When I try to login from the admin account on the nas drive to test it keeps asking for the password. I have checked /var/log/auth.log on the archive server and no errors are showing

Anyone got a clue where my issue could be

Thanks

Glenn
 
Old 03-04-2020, 06:20 AM   #2
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 419

Rep: Reputation: Disabled
Are you certain you copied the key for the user you are trying to sign in as to the nas drive? It almost appears that you created keys for a user, copied it over, and then tried to sign in as a different user.
 
Old 03-04-2020, 06:41 AM   #3
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Original Poster
Rep: Reputation: 19
Thanks for the reply

I looked in to the qnap as the admin account and created the ssh keys. Copied the new account on the archive server (not called admin) and I try to login for the admin account as newuser@archive.mydomain.com where it asks for the password
 
Old 03-04-2020, 07:17 AM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,767

Rep: Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765
In addition to checking the keys, also check the folder permissions INCLUDING THE USERS HOME FOLDER ITSELF. SSH is in part a security package and it will disable key authentication if it detects an unsupported permission in the user home, .ssh folder, or the files under that .ssh folder.
 
Old 03-04-2020, 07:56 AM   #5
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Original Poster
Rep: Reputation: 19
Thanks. I have double checked the permissions and all correct.

Really don't understand why it's not working when all the other do
 
Old 03-04-2020, 08:41 AM   #6
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Original Poster
Rep: Reputation: 19
ssh -v produced the following logs. I did login as the user with the password and did chmod 755 ~ logged out and in again but no difference

debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to archive.mydomain.com:22 as 'kdluser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:6jWlGXLw39LohwMyv27s1SGyl0obeK7qVK64Mk6l6kw
debug1: Host 'archive.vostel.co.uk' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
newuser@archive.mydomain.com's password:
debug1: Authentication succeeded (password)
 
Old 03-04-2020, 08:47 AM   #7
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,007
Blog Entries: 26

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Real quick, did you name the file .ssh/authorised_keys or .ssh/authorized_keys?
 
Old 03-04-2020, 09:28 AM   #8
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by Timothy Miller View Post
Real quick, did you name the file .ssh/authorised_keys or .ssh/authorized_keys?
That's it as I had it down as authorised_keys. Could not see the wood for the tree

Thanks
 
Old 03-04-2020, 10:27 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,359
Blog Entries: 3

Rep: Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767
That can be fixed on the other end too. See also the AuthorizedKeysFile directive for sshd_config.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passwordless ssh without ssh keys Four Linux - General 1 04-27-2011 02:20 AM
How to set SSH keys on SSH server mansour Linux - Newbie 27 01-16-2011 11:44 AM
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 04:40 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 06:03 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration