LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-23-2020, 05:09 PM   #1
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Rep: Reputation: Disabled
Unable to connect with SSH


I am trying to use the transfer tool in WHM. There was some connection issues. So I tried to SSH into the server to see if it would work. Each time I use Putty it closes immediately after I enter my password. Is there anything I can check on the server to allow me to connect?

I tried using the terminal in WHM and looked at the logs

# tail -f -n 50 /var/log/secure | grep sshd


pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.xxx.xx.xx user=myname
error: PAM: Authentication failure for myname from xxx.xxx.xx.xx
Accepted keyboard-interactive/pam for myname from xxx.xxx.xx.xx port 58783 ssh2
pam_unix(sshd:session): session opened for user myname by (uid=0)
pam_unix(sshd:session): session closed for user myname
 
Old 08-23-2020, 09:05 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I don't know what's WHM. Obviously the ssh client was able to connect to the ssh server, but the server did not accept the password.

The easiest solution is resetting myname's password.
 
Old 08-23-2020, 09:50 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,341
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
berndbausch, WHM is likely the Web Host Manager.

OP, does your hosting provider offer tech support? If so, that might be the best place to direct your question.
 
Old 08-24-2020, 12:03 AM   #4
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Web Host Manager, or WHM, is the program that allows administrative access to the back end of cPanel. Unfortunately they don't offer detailed support. Usually when things come up, I have to figure it out and learn. Yes the password has been changed. I have also posted on the cpanel forum but no replies yet.

One thing I noticed was this line in the config file. It doesn't say yes or no because its commented out.

vi /etc/ssh/sshd_config

# Authentication:
#PermitRootLogin yes

My new server that I can log in reads like this:
PermitRootLogin no

Last edited by mallen; 08-24-2020 at 12:10 AM.
 
Old 08-24-2020, 01:47 AM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
The sshd_config settings disable/enable root logins, not logins to account myname.
 
Old 08-24-2020, 08:13 AM   #6
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
I wasn't sure if that could be the issue. "myname" is the root root/admin/main user of the server. If I purposely enter the wrong password it will say access denied. If I enter it correct the connection is terminated. Maybe I need to fix something in the pam settings?
 
Old 08-24-2020, 08:34 AM   #7
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Commented out entries in sshd_config typically reflect the defaults.

root is the only “root/main/admin” user of the server. Are you trying to connect as root? Or as a regular user?
Obfuscating the IP address makes sense, but we need to know if you’re using root or some other user to connect.

Typically, I will ssh to a remote server as an unprivileged user and su to root if I need to.
 
Old 08-24-2020, 08:38 AM   #8
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
I think my username is considered a "super user"? Its the main user for the server. I am not typing "root" when I login using putty. Since I can't get the transfer tool to connect and finish, there must be an issue but I don't know where to look.
 
Old 08-24-2020, 08:43 AM   #9
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,616

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554
Quote:
Originally Posted by mallen View Post
Each time I use Putty it closes immediately after I enter my password.
In Putty, change "Close window on exit" to "Never" before connecting, then you'll be able to see if there's any diagnostic messages being output.

 
Old 08-24-2020, 08:46 AM   #10
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
If you can connect to your system on an alternative port, one other than 22, then you can set up a one-off, verbosely logged SSH session there:

Code:
sudo /usr/sbin/sshd -d -d -d -p 2222 -E /tmp/sshd.log
That would allow you to connect once and only once with SSH to port 2222 and all the connection information would be logged to the file there /tmp/sshd.log. Hopefully that would also contain the reason for disconnection, if it pertains to the SSH daemon. If it is a matter of PAM, then it may still provide that much.

See "man sshd" for a more authoritative explanation of those options.
 
Old 08-24-2020, 10:09 AM   #11
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
In Putty, change "Close window on exit" to "Never" before connecting, then you'll be able to see if there's any diagnostic messages being output.

I changed that setting. Now it says "Putty fatal error. Server unexpectedly closed network connection".
Another thing I noticed, it is not reporting any connections for my usuername but if i enter an incorrect password it will.

I contacted my service provider of my VPS. They recommended repairing or reinstalling SSH. Does that sound like a possible fix?

Last edited by mallen; 08-24-2020 at 12:57 PM.
 
Old 08-24-2020, 01:58 PM   #12
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,616

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554
Quote:
Originally Posted by mallen View Post
I contacted my service provider of my VPS. They recommended repairing or reinstalling SSH. Does that sound like a possible fix?
It sounds like generic "I don't know what's up" advice to me. It may help or may make things worse.

I don't remember if WHM provides a browser-based SSH interface - if it does, I'd use that to try what Turbocapitalist posted and see if that provides further information.

Or try enabling SSH access for another account in case it's a user-specific issue. (I'm assuming you have enabled and successfully used SSH previously for the account currently having trouble.)

Otherwise, whilst uninstalling SSH, purging all config, then re-installing it *might* solve the issue, it might also screw up the link between it and cPanel/WHM and cause other issues (either now or at the next upgrade).

Your best best is to talk to cPanel Support.

cPanel is a paid product - if you're not paying for it, your hosting provider is - so you might as well take advantage of that to get the advice of those that know the product better than anyone here.

 
Old 08-24-2020, 02:11 PM   #13
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
If you can connect to your system on an alternative port, one other than 22, then you can set up a one-off, verbosely logged SSH session there:

Code:
sudo /usr/sbin/sshd -d -d -d -p 2222 -E /tmp/sshd.log
That would allow you to connect once and only once with SSH to port 2222 and all the connection information would be logged to the file there /tmp/sshd.log. Hopefully that would also contain the reason for disconnection, if it pertains to the SSH daemon. If it is a matter of PAM, then it may still provide that much.

See "man sshd" for a more authoritative explanation of those options.
I tried it and it said connection refused.

sudo /usr/sbin/sshd -d -d -d -p 2222 -E /tmp/sshd.log
sshd: illegal option -- E
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]
[-f config_file] [-g login_grace_time] [-h host_key_file]
[-k key_gen_time] [-o option] [-p port] [-u len]

Last edited by mallen; 08-24-2020 at 02:13 PM.
 
Old 08-24-2020, 02:30 PM   #14
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Have you ever successfully connected to the server with ssh? With this user - or any user?
 
Old 08-24-2020, 02:42 PM   #15
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Have you ever successfully connected to the server with ssh? With this user - or any user?
Yes I have. I rarely use it. I just need to now because i am transferring servers. Same settings on my new server with Putty and can log in there. So its not a network or firewall issue.
 
  


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
One specific Wireless wifi won't connect under Ubuntu under 20.04 focal; others connect fine and connect fine when booted into other OS's ajmcello Linux - Networking 8 08-23-2020 02:37 PM
connect to running screen instance on ssh connect, otherwise start one? daweefolk Linux - General 3 02-19-2020 10:11 AM
Able to connect via SSH but not able to connect via web port 80 Orange Sunshine Linux - Server 9 04-03-2010 07:11 PM
Able to connect to default Gateway, Unable to connect to internet Dumb.Coder Linux - Newbie 11 04-14-2009 04:22 AM
how do i connect my blue tooth headset to Ubuntu, it is unable to connect. salfuser Linux - Hardware 2 01-12-2009 10:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:31 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