cannot ssh to a centOS 4.9 server

I have an old centOS 4.9 Server. I cannot ssh to it.

it's a vmware server, I can use console to log into the server as root. I checked the sshd service, it's on, I checked the iptables service, it's off.

I checked the .ssh folder under root and can only find one file called known_hosts. no other files found under the same folder, even no config file.

anyone can help me with this,thanks.
Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason YuAuthor Commented:
when i ssh to it from another linux server, it says "Access denied
Shiju JacobInfo Security ManagerCommented:
try to stop the selinux and login

check any PAM related files are updated

can you paste the logs when you are trying to ssh from remove

try this on the vmware console
tail -f /var/log/messages
Sudeep SharmaTechnical DesignerCommented:
also check what port the SSH is running from?

Check the file /etc/ssh/sshd_config and check for Port.

As suggested by Shiju above also check the selinux.

Verify the port which is set on sshd_config is configured on Firewall as well.

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Are you trying to log in as root or a user??

Check service is running:

service sshd status

Check iptables allows connections:

iptables -L -vn | grep "dpt:22"

Check if root is allowed to log in per config:

grep -i permitrootlogin /etc/ssh/sshd_config

Check if config allows password authentication:

grep PasswordAuthentication /etc/ssh/sshd_config
Jason YuAuthor Commented:
the result of tail -f /var/log/messages

pam_parse: unknown option; reject_username
Jason YuAuthor Commented:
This is the content of the ssh_config file:

#      $OpenBSD: ssh_config,v 1.19 2003/08/13 08:46:31 markus Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for various options

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
   PasswordAuthentication yes
#   HostbasedAuthentication no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
   Port 22
   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
#   EscapeChar ~
Host *
      GSSAPIAuthentication yes
# If this option is set to yes then the remote X11 clients will have full access
# to the local X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
       ForwardX11Trusted yes
Jason YuAuthor Commented:
iptables service is stopped. not running at all.
joolsSenior Systems AdministratorCommented:
check /etc/hosts.allow and /etc/hosts.deny and the log files /var/log/secure and /var/log/messages
Jason YuAuthor Commented:
I checked both files, there are nothing in there.

Do I need add my ip in, if so, what is the format?

joolsSenior Systems AdministratorCommented:
nope, if they are blank thats cool, they can also be used to restrict access to services most people forget about them.

Looking at your posts above it might be you have a bad entry in pam. Check out the log files again;

joolsSenior Systems AdministratorCommented:
btw, when you said its a vmware server, did you mean its a guest OS on a vmware server?
Jason YuAuthor Commented:
it's a guest os
Jason YuAuthor Commented:
IN /var/log/secure

Did not receive identification string from ::ffff:
Jason YuAuthor Commented:
in this file : /var/log/messages

There are many lines as below:

PAM-Cracklib[9775]: pam_parse: unknown option; reject_username.

Is there something with my pam_parse module?

Please advise.
Jason YuAuthor Commented:
I think maybe the pam modules under /etc/pam.d   need to be modified.

Please see the copy scrren for the file /etc/pam.d/sshd  .
joolsSenior Systems AdministratorCommented:
I dont think its that file, it might be in login or system-auth.

Unfortunately I dont have a CentOS 4.9 box I can use to check PAM.

Can you verify the pam package?

rpm -V pam
ls -altr /etc/pam.d

Open in new window

joolsSenior Systems AdministratorCommented:
I'm assuming it does local auth as well and you dont have some strange network auth setup, try running

authconfig --test

Open in new window

It should tell you what its expecting, check the man page for details.
Jason YuAuthor Commented:
here are the results. Unfortunately, I couldn't copy and paste the result to here, have to use the copy screen from vmware console.
Jason YuAuthor Commented:
Here is the detail of /etc/pam.d/system-auth file:
joolsSenior Systems AdministratorCommented:
system-auth was modified which is fine if thats what you needed for your setup but its worth having a look
joolsSenior Systems AdministratorCommented:
there it is, edit the system-auth file and hash out the line with the reject_username
Jason YuAuthor Commented:
how to test to bypass the system-auth file?

I want to first identify the problem, then consider how to resolve it.

Here I am attaching the detail of this system-auth file for your scrutinization.
joolsSenior Systems AdministratorCommented:
line 14, put a # at the start and save it, then try and ssh in
open another console window and try and login locally too or use ssh localhost in the console
joolsSenior Systems AdministratorCommented:
I found this if you need cracklib enabled
Jason YuAuthor Commented:
after I modified this system-auth file and run ssh localhost as root, it shows "Permission denied, please try again.

please see the copy screen.
joolsSenior Systems AdministratorCommented:
ok, put the cracklib line back but just remove the reject_username so it reads;

password requisite /lib/security/$ISA/ retry=3 minlen=8 minclass=3

Open in new window

Jason YuAuthor Commented:
the result is the same:

Please see the copy screen.
Jason YuAuthor Commented:
Here are the two configuration files.
Jason YuAuthor Commented:
Jason YuAuthor Commented:
I tried to catch the log from /var/log/secure and found the following lines when tried to login

Failed password for jasony from ::ffff: port 53389 ssh2
Jason YuAuthor Commented:
I checked the secure file, it keep saying "Failed password for myusername from ::ffff:XXX.XXX.XXX.XXX(my desktop IP) port 54043 ssh2.

Please see the copy screen.
joolsSenior Systems AdministratorCommented:
can you reset the password??
Jason YuAuthor Commented:
I just reset the password for my username. but when I ssh to the server, it still says "access denied".

from the /var/log/secure file, it shows:

Failed password for jasony from  ::ffff:my ip port 60157 ssh2.

The port number is different every time I tried to login.

joolsSenior Systems AdministratorCommented:
Is it doing local auth? can you post the output to authconfig --test as mentioned above.

The port number mentioned in the log is the source port which varies so thats ok.
Jason YuAuthor Commented:
what do you mean by usering authconfig --test?

How to use it for test?

I tried to run "ssh -vvv localhost" and get the following error as it showed in the attachment.
Jason YuAuthor Commented:
I got it running, please see picture.
Jason YuAuthor Commented:
This is the second page of the result of authconfig --test command.
joolsSenior Systems AdministratorCommented:
it uses kerberos....

do you need that?

I'm not suggesting you change it as it might affect your security policy.

running authconfig --test should have displayed printed output,
joolsSenior Systems AdministratorCommented:
if you want to test it without then save a copy of the auth files in pam and make notes of the settings then (only if you are allowed) change the setting to disable kerberos and try that, if you can then login you now know where to look and you should involve your security team if you have one.

Alas I dont know much about kerberos.. :-D
Jason YuAuthor Commented:
What is this Kerberos authentication? Is the settings for Kerberos crashed?

How can I use SSH with Kerberos? Or I need disable Kerberos to use SSH, please advise.

Thanks in advance.
Jason YuAuthor Commented:
After I disabled Kerberos, it's still not working.

The error message is the same in /var/log/secure file.

joolsSenior Systems AdministratorCommented:
kerberos needs an external server for auth as far as I know. Can you post your authconfig again please.

we need to be sure its disabled.

Is there any possibility in showing more of the secure file and is there anything in messages?
joolsSenior Systems AdministratorCommented:
I just build a 4.8 vm and the system-auth file on a base install looks like this;

# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      /lib/security/$ISA/
auth        sufficient    /lib/security/$ISA/ likeauth nullok
auth        required      /lib/security/$ISA/

account     required      /lib/security/$ISA/
account     sufficient    /lib/security/$ISA/ uid < 100 quiet
account     required      /lib/security/$ISA/

password    requisite     /lib/security/$ISA/ retry=3
password    sufficient    /lib/security/$ISA/ nullok use_authtok md5
password    required      /lib/security/$ISA/

session     required      /lib/security/$ISA/
session     required      /lib/security/$ISA/

Open in new window

not sure if it helps?!
Jason YuAuthor Commented:
The KerberoAuthenticsation is enabled.

Please see the attached copy screen from the file /etc/ssh/sshd_config.

I will copy the secure file and message file later.
Jason YuAuthor Commented:
Here are the copy screens of the command "authconfig --test". I talked to my coworkers, they said this server is integrated with Active directory for authentication. From the second copy screen, you can see a domain controller's name.
joolsSenior Systems AdministratorCommented:
ok, well I'm guessing thats why you cant login, you should try to disable the kerberos stuff and then make sure you can login from the local network before looking to re-enable it..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason YuAuthor Commented:
I got a new problem right now, I cannot use root user to login from the console, it says root user is locked. I have to use my own account to login from the console ans su to root.
Jason YuAuthor Commented:
I found a line

UsePam yes

Do I need disable it for testing?
Jason YuAuthor Commented:
This time, it works now. After I set up KerberosAuthentication to no, it works.

# Kerberos options
KerberosAuthentication no
KerberosOrLocalPasswd no
#KerberosTicketCleanup yes

But my root account is still locked, how could I unlock it?

joolsSenior Systems AdministratorCommented:
did you modify the auth-config file??
Jason YuAuthor Commented:
Thanks experts for all of your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.