LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-24-2020, 04:52 PM   #16
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,742

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222

Quote:
Originally Posted by mallen View Post
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.
The log entries you posted indicate basically say that you used the wrong password. I was able to duplicate them on my server by intentionally mistyping the password.

Couple other things to try.
Connect/login to the new server and try to ssh from it to the old server.
Try using root on the old server. You said it was set to allow root logins, where the new server does not.
 
Old 08-24-2020, 08:04 PM   #17
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
The log entries you posted indicate basically say that you used the wrong password. I was able to duplicate them on my server by intentionally mistyping the password.

Couple other things to try.
Connect/login to the new server and try to ssh from it to the old server.
Try using root on the old server. You said it was set to allow root logins, where the new server does not.
If I try using 'root" it will say access denied.
 
Old 08-24-2020, 08:12 PM   #18
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,742

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Quote:
Originally Posted by mallen View Post
If I try using 'root" it will say access denied.
Will it? How do know if you don’t try? Going by what you’ve already posted root login is permitted on the old server, but not on the new server.

Did you try the other idea? What happened?

Are you sure about the password for that user? You need to use the Linux/pam password, not the user/password used for whm/cpanel.
I use Webmin, the “superuser” login there doesn’t even exist as a user that could login via ssh. To ssh to the server I need to use a “real” Linux user.

Last edited by scasey; 08-24-2020 at 08:18 PM.
 
Old 08-25-2020, 12:12 AM   #19
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,348
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
Quote:
Originally Posted by mallen View Post
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]
Wow. That is an old version of OpenSSH. (I'd upgrade from backports if possible, but that's a separate topic.)

Here is a work-around by redirecting stderr and using a pipe to tee to capture the output to a file while still viewing it:

Code:
sudo /usr/sbin/sshd -d -d -d -p 2222  2>&1 | tee /tmp/sshd.log
It will allow you to connect (or try to connect and fail) just once on port 2222.
 
Old 08-25-2020, 08:58 AM   #20
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Wow. That is an old version of OpenSSH. (I'd upgrade from backports if possible, but that's a separate topic.)

Here is a work-around by redirecting stderr and using a pipe to tee to capture the output to a file while still viewing it:

Code:
sudo /usr/sbin/sshd -d -d -d -p 2222  2>&1 | tee /tmp/sshd.log
It will allow you to connect (or try to connect and fail) just once on port 2222.
debug2: load_server_config: filename /etc/ssh/sshd_config
debug2: load_server_config: done config len = 668
debug2: parse_server_config: config /etc/ssh/sshd_config len 668
debug3: /etc/ssh/sshd_config:21 setting Protocol 2
debug3: /etc/ssh/sshd_config:36 setting SyslogFacility AUTHPRIV
debug3: /etc/ssh/sshd_config:66 setting PasswordAuthentication yes
debug3: /etc/ssh/sshd_config:70 setting ChallengeResponseAuthentication yes
debug3: /etc/ssh/sshd_config:81 setting GSSAPIAuthentication yes
debug3: /etc/ssh/sshd_config:83 setting GSSAPICleanupCredentials yes
debug3: /etc/ssh/sshd_config:97 setting UsePAM yes
debug3: /etc/ssh/sshd_config:100 setting AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
debug3: /etc/ssh/sshd_config:101 setting AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
debug3: /etc/ssh/sshd_config:102 setting AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
debug3: /etc/ssh/sshd_config:103 setting AcceptEnv XMODIFIERS
debug3: /etc/ssh/sshd_config:109 setting X11Forwarding no
debug3: /etc/ssh/sshd_config:132 setting Subsystem sftp /usr/libexec/openssh/sftp-server
debug3: /etc/ssh/sshd_config:139 setting PermitRootLogin no
debug3: /etc/ssh/sshd_config:140 setting UseDNS no
debug3: /etc/ssh/sshd_config:141 setting PermitRootLogin no
debug3: /etc/ssh/sshd_config:142 setting PermitRootLogin no
debug3: /etc/ssh/sshd_config:143 setting DenyGroups cpaneldemo cpanelsuspended
debug1: sshd version OpenSSH_5.3p1
debug3: Not a RSA1 key file /etc/ssh/ssh_host_rsa_key.
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug3: Not a RSA1 key file /etc/ssh/ssh_host_dsa_key.
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]='-d'
debug1: rexec_argv[2]='-d'
debug1: rexec_argv[3]='-d'
debug1: rexec_argv[4]='-p'
debug1: rexec_argv[5]='2222'
debug3: oom_adjust_setup
Set /proc/self/oom_score_adj from 0 to -1000
debug2: fd 3 setting O_NONBLOCK
debug1: Bind to port 2222 on 0.0.0.0.
Server listening on 0.0.0.0 port 2222.
socket: Address family not supported by protocol
 
Old 08-25-2020, 10:31 AM   #21
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,348
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
Thanks. That shows the SSH daemon starting up, but what did it output as you tried to log in?

The only part that looks suspect is this part:
Code:
debug3: /etc/ssh/sshd_config:143 setting DenyGroups cpaneldemo cpanelsuspended
If your account is a member of either the cpaneldemo or cpanelsuspended group then you won't be able to log in.

Also it looks like you have PermitRootLogin set several times. Once is enough.
 
Old 08-25-2020, 10:51 AM   #22
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Thanks. That shows the SSH daemon starting up, but what did it output as you tried to log in?

The only part that looks suspect is this part:
Code:
debug3: /etc/ssh/sshd_config:143 setting DenyGroups cpaneldemo cpanelsuspended
If your account is a member of either the cpaneldemo or cpanelsuspended group then you won't be able to log in.

Also it looks like you have PermitRootLogin set several times. Once is enough.
"Server expectantly closed network" if I log in to port 2222

How can I tell if my username is part of cpaneldemo or cpanelsuspended group?

Last edited by mallen; 08-25-2020 at 10:52 AM.
 
Old 08-25-2020, 10:53 AM   #23
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,348
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
Was there nothing after the following?

Code:
Server listening on 0.0.0.0 port 2222.
There should have been some information in /tmp/sshd.log after that line, including information about the login attempt and the disconnection.
 
Old 08-25-2020, 11:15 AM   #24
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Was there nothing after the following?

Code:
Server listening on 0.0.0.0 port 2222.
There should have been some information in /tmp/sshd.log after that line, including information about the login attempt and the disconnection.
Server listening on 0.0.0.0 port 2222.
socket: Address family not supported by protocol
 
Old 08-25-2020, 01:41 PM   #25
Hiram_A
LQ Newbie
 
Registered: Aug 2020
Posts: 12

Rep: Reputation: Disabled
Have you checked /var/log/secure on the server for why it may be rejecting you?
 
Old 08-25-2020, 01:50 PM   #26
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Hiram_A View Post
Have you checked /var/log/secure on the server for why it may be rejecting you?
Yes I have. You can see the results above. I have tried looking at every log file and setting I can. Whatever you can recommend I will try. Thanks.

Last edited by mallen; 08-25-2020 at 02:19 PM.
 
Old 08-25-2020, 02:37 PM   #27
Hiram_A
LQ Newbie
 
Registered: Aug 2020
Posts: 12

Rep: Reputation: Disabled
Quote:
Originally Posted by mallen View Post
Yes I have. You can see the results above. I have tried looking at every log file and setting I can. Whatever you can recommend I will try. Thanks.
Generally when I run across issues with ssh connections I've found that the permissions set in the users home folder and corresponding .ssh folder are incorrect.
Make sure it's something like:

755 user_home_folder
700 .ssh
644 authorized_keys
600 any_keys_used_for_auth

You could also try adding a line at the end of your /etc/ssh/sshd_config file like:

AllowUsers your_username

And speaking of keys, you could also try key-based authentication and skip the need for passwords.

Make sure you restart sshd after making changes.
 
Old 08-25-2020, 04:12 PM   #28
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Hiram_A View Post
Generally when I run across issues with ssh connections I've found that the permissions set in the users home folder and corresponding .ssh folder are incorrect.
Make sure it's something like:

755 user_home_folder
700 .ssh
644 authorized_keys
600 any_keys_used_for_auth

You could also try adding a line at the end of your /etc/ssh/sshd_config file like:

AllowUsers your_username

And speaking of keys, you could also try key-based authentication and skip the need for passwords.

Make sure you restart sshd after making changes.
I made the change to AllowUsers

Tried RSA key and DSA key and Putty says server refused our key
 
Old 08-25-2020, 04:27 PM   #29
Hiram_A
LQ Newbie
 
Registered: Aug 2020
Posts: 12

Rep: Reputation: Disabled
Quote:
Originally Posted by mallen View Post
I made the change to AllowUsers

Tried RSA key and DSA key and Putty says server refused our key
Permissions have be correct on the server for the .ssh directory and underlying files otherwise it won't work.
Just to verify, you're initiating the connection from Putty and the private key you created is on the workstation with Putty and the public key is on the server you're accessing.
 
Old 08-25-2020, 04:43 PM   #30
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Hiram_A View Post
Permissions have be correct on the server for the .ssh directory and underlying files otherwise it won't work.
Just to verify, you're initiating the connection from Putty and the private key you created is on the workstation with Putty and the public key is on the server you're accessing.
Yes.

/etc/ssh/sshd_config uncommented the following lines
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

restarted sshd but still refused the key.

But I would rather avoid using keys right now because I need to login for the purpose of transferring to a new server.

Could this be an issue? Does this mean port 22 is blocked?
grep Port /etc/ssh/sshd_config
#Port 22
#GatewayPorts no

Last edited by mallen; 08-26-2020 at 01:36 AM.
 
  


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 11:30 AM.

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