Just say I am a normal user and not sure if I have an account in remote server xyz.

Case1: I have the account on remote server, but have forgot the password.

Case2: I don't have my account on remote server.

In both case when I try to login I will get a permission denied message.

We could easily contact admin to check if account exist, but just wondering if there is a way to set up, so that I can distinguish between two above cases when I try to login.

Am using Red Hat 5.1

  • 2
    years of security-hardening efforts will undermine your success in this regard. Knowing whether a local account exists helps a would-be attacker narrow their focus for brute-forcing a password. Can't pinpoint the source code change, but most login programs have probably been modified to elide the difference. – Jeff Schaller Oct 20 '15 at 15:35
  • Set everything up on config management and/or identity management and then you can be sure it's set up on each system because it gets pushed down to the servers. – Bratchley Oct 20 '15 at 15:43

You would have to call the following command that will return the user account details. To do that you don't have to be root (/etc/passwd has -rw-r--r-- permissions by default), but you still need to be using cli as some valid user.

grep <username> /etc/passwd or id <username> or you could check if a folder with your username exists in /home directory

  • This doesn't apply to my above 2 cases. thanks – Chittha Shetty Oct 20 '15 at 15:51
  • The best way to check it would be to simply run ls /home, which will run on almost any system irregardless of how permissions are set up. – Peter Gerhat Oct 20 '15 at 15:53
  • Their use case involves them not even being able to login. They're wanting to know how to differentiate between a login that fails due to credentials and due to the user not existing which isn't possible by design. – Bratchley Oct 20 '15 at 15:54
  • This applies to Case 2 as long as you can access the remote server through command line interface as any registered user and with some modifications also Case 1. But you should specify in the question what are your accessing options. – Peter Gerhat Oct 20 '15 at 15:57
  • Bratchley is right on my question and Jeff is more appropriate. – Chittha Shetty Oct 20 '15 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.