Connecting to remote server via SSH issue

OnlySachin7

Registered
Oct 25, 2018
3
0
1
Nashik
cPanel Access Level
Root Administrator
I have setup ssh key password less login but while doing ssh to the remote server from auth server through the another user [abc] then it shows below error...

Auth Server error: permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
Remote Server error: sshd[3320943]: Invalid user

using root user it's working but using another user xyz then it's shows above error...

I have created shortcut for remote server login...

[email protected]: ssh remoteserver
[successful]
[email protected]: ssh remoteserver
permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
[email protected]: ssh [email protected]
[successful]

It's only login if I use [email protected] from the user not directly remote server name...

Also, I need as the remote server login should happened from the xyz user and xyz whatever will fire commands on remote server which history should save on Auth server in his bash history file...

How to do that?
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,755
316
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
SSH keys are installed per user, so just because you installed a key for root that key does not apply to user xyz. You would need to add the same key to /home/xyz/.ssh/authorized_keys as well to use the same key for this other user.
 

OnlySachin7

Registered
Oct 25, 2018
3
0
1
Nashik
cPanel Access Level
Root Administrator
Yes. I have added xyz user in wheel group as well as created new ssh key for that xyz user and added that on remote server but still it's showing me Permission denied (publickey,gssapi-keyex,gssapi-with-mic). error...

However, if I do ssh from xyz user like: ssh [email protected] then it works but not like: ssh remoteserver

-=-=-=-=-
[[email protected] .ssh]$ssh [email protected]
Enter passphrase for key '/home/xyz/.ssh/id_rsa':
Last login: Mon Jun 3 11:14:47 2019 from x.x.x.x
[email protected] [/tmp]#
-=-=-=-=-

Also, one thing, I want when I do SSH from xyz user to remoteserver then remoteserver should show xyz user not root... like...

-=-=-=-=-
[[email protected] .ssh]$ssh [email protected]
Enter passphrase for key '/home/xyz/.ssh/id_rsa':
Last login: Mon Jun 3 11:14:47 2019 from x.x.x.x
[email protected] [/tmp]#whoami
xyz
[email protected] [/tmp]#
-=-=-=-=-

and whatever I will fire commands through xyz user on remoteserver then history should save on Auth server under xyz user bash history...
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello @OnlySachin7,

Can you verify if the AllowUsers directive is enabled in /etc/ssh/sshd_config on the remote server you are connecting to via SSH?

Thank you.
 

OnlySachin7

Registered
Oct 25, 2018
3
0
1
Nashik
cPanel Access Level
Root Administrator
Hello @OnlySachin7,

Can you verify if the AllowUsers directive is enabled in /etc/ssh/sshd_config on the remote server you are connecting to via SSH?

Thank you.
Thanks for the reply Michael.

Yes. I have tried that as well but not working. Actually when I am doing ssh to remote server from 'xyz' user like ssh remote then it shows error on remote server in secure logs as invalid xyz user.