LinuxQuestions.org
Visit Jeremy's Blog.
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-25-2020, 05:01 PM   #31
Hiram_A
LQ Newbie
 
Registered: Aug 2020
Posts: 12

Rep: Reputation: Disabled

Quote:
Originally Posted by mallen View Post
Yes.

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

restarted sshd but still refused the key. How do I set the permissions?
Use chmod

On the server you're trying to connect to...

cd /home

Make sure you own your home directory and the subdirectories below it (especially .ssh).

chmod 755 your_home_folder

cd your_home_folder

chmod 700 .ssh

cd .ssh

chmod 644 authorized_keys
chmod 600 any_keys_stored_there

Your public key should be stored in the .ssh directory with 600 permissions.
Your private key should be stored in Putty on your workstation.

Here's another thought, when you created your user on the server, you did set the password, right?
passwd your_user_name

Also try
passwd -u your_user_name
just to make sure you didn't lock yourself out.
 
Old 08-26-2020, 12:54 AM   #32
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Yes I set the password when I set up the server. I am the only one that uses it. I even set up the new server the same way. What is strange is I never go into my server via SSH. So there was no customization that would restrict me from logging in. The only reason I found out was when I tried using the transfer tool.

I have changed password
Turned off/on firewall
Checked port
Checked allowed users

Again none of this was ever changed before.

Last edited by mallen; 08-26-2020 at 02:02 AM.
 
Old 08-26-2020, 07:33 AM   #33
Hiram_A
LQ Newbie
 
Registered: Aug 2020
Posts: 12

Rep: Reputation: Disabled
Quote:
Originally Posted by mallen View Post
Yes I set the password when I set up the server. I am the only one that uses it. I even set up the new server the same way. What is strange is I never go into my server via SSH. So there was no customization that would restrict me from logging in. The only reason I found out was when I tried using the transfer tool.

I have changed password
Turned off/on firewall
Checked port
Checked allowed users

Again none of this was ever changed before.
Sorry, I'm out of ideas on this one.
 
Old 08-26-2020, 08:01 AM   #34
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
Going to repeat:
Either the user (myuser) is not a real Linux user
Or
You’re not entering the correct password.

Did you try using root?
Did you try from your “new” server instead of from putty?
 
Old 08-26-2020, 08:05 AM   #35
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Going to repeat:
Either the user (myuser) is not a real Linux user
Or
You’re not entering the correct password.

Did you try using root?
Did you try from your “new” server instead of from putty?
Yews the user name is correct. I have verified its there and its the only one I use. Password has been changed. Logs don't say password is incorrect. If I intentionally type the wrong password it will say its incorrect. Then I type the correct one and it disconnects. Yes I have logged into my new server just fine. I also have five other users and none of those will connect.

Last edited by mallen; 08-26-2020 at 08:06 AM.
 
Old 08-26-2020, 08:20 AM   #36
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
You said you’ve conned to this server with ssh in the past. What’s changed since then?
And, again, have you tried to connect as root?
 
Old 08-26-2020, 08:29 AM   #37
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
You said you’ve conned to this server with ssh in the past. What’s changed since then?
And, again, have you tried to connect as root?
Nothing has changed. I think have SSHd only a couple times because I have no need to log in. So I made no changes or customization. I have had this login for about five years. Yes if I try root it says access denied. If I try any other user it will close out. I am not a server pro and I am willing to check any log file someone can recommend. I have spent five days trying to log in.

Last edited by mallen; 08-26-2020 at 08:32 AM.
 
Old 08-26-2020, 08:42 AM   #38
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
Based on the log posted in your OP, either the user or the password is incorrect.
If you’ve logged in with that user/pass in the past something must have changed...
How long ago did you ssh to that server?
 
Old 08-26-2020, 09:10 AM   #39
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Based on the log posted in your OP, either the user or the password is incorrect.
If you’ve logged in with that user/pass in the past something must have changed...
How long ago did you ssh to that server?
A few years ago. Just to be sure I changed the password. But if you type it correct it closes. If you type it wrong it says its wrong.

If I type the wrong password I get this:
pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.xxx.xx.xx user=myname
Aug 26 10:20:35 ip-166-62-46-26 sshd[25649]: error: PAM: Authentication failure for myname from xxx.xxx.xx.xx
If I type it correct there is no record of it in the log. This looks like where its failing.

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

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
Quote:
Originally Posted by mallen View Post
There are all these failed logins from ips and users trying to get in. Then I can't find what I'm looking for.
The method in #19 above should show the login attempt and a reason for the failure, if you check the resulting file after you've tried logging in. That method will eliminate all the noise and leave you with log data specific to that one session and that session only.
 
Old 08-26-2020, 11:10 AM   #41
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
The method in #19 above should show the login attempt and a reason for the failure, if you check the resulting file after you've tried logging in. That method will eliminate all the noise and leave you with log data specific to that one session and that session only.
sudo /usr/sbin/sshd -d -d -d -p 2222 2>&1 | tee /tmp/sshd.log
debug2: load_server_config: filename /etc/ssh/sshd_config
debug2: load_server_config: done config len = 750
debug2: parse_server_config: config /etc/ssh/sshd_config len 750
debug3: /etc/ssh/sshd_config:21 setting Protocol 2
debug3: /etc/ssh/sshd_config:36 setting SyslogFacility AUTHPRIV
debug3: /etc/ssh/sshd_config:48 setting PubkeyAuthentication yes
debug3: /etc/ssh/sshd_config:49 setting AuthorizedKeysFile .ssh/authorized_keys
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
debug3: /etc/ssh/sshd_config:144 setting PermitRootLogin no
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-26-2020, 11:35 AM   #42
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,347
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
Because that appears truncated, I have to ask what response you get in the client when connecting to port 2222?
 
Old 08-26-2020, 12:08 PM   #43
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Because that appears truncated, I have to ask what response you get in the client when connecting to port 2222?
That was all that was outputted. Do you want me to try logging in with Putty? Sorry I am new to this.
 
Old 08-26-2020, 12:13 PM   #44
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,347
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
No problem. Please run the port 2222 option, then try to log in with PuTTY so that you get your error. Then check the file on the server after that.

Last edited by Turbocapitalist; 08-26-2020 at 12:15 PM.
 
Old 08-26-2020, 12:24 PM   #45
mallen
LQ Newbie
 
Registered: Aug 2020
Posts: 24

Original Poster
Rep: Reputation: Disabled
Please run the port 2222 option? Logged in with Putty at port 2222
Then try to log in with PuTTY so that you get your error. "Server unexpectedly closed network connection"
Then check the file on the server after that. What file?

Aug 26 13:10:44 ip-xxx-xx-xx-xx sudo: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/sshd -d -d -d -p 2222

There is alot in: /tmp/sshd.log I can't seem to copy and paste it all

Last edited by mallen; 08-26-2020 at 12:38 PM.
 
  


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 06:44 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