Where are the password saved in a UNIX server?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Where are the password saved in a UNIX server?
# 8  
Old 10-18-2006
Quote:
Originally Posted by Corona688
Wasn't meant to be. We get "help I forgot the root password" posts all the time but almost never get asked without at least telling us anything at all about situation. your unix? which unix? Syntax of lines in /etc/passwd is:

usernameSmilieasswordhash:uid:gid:undefined:homedir:loginshell

When the password hash is x, that means it's stored somewhere else, possibly /etc/shadow. It's not stored plaintext, but as an unrecognizable hash. When someone tries to login, it hashes what they type and compares the hashes.

You don't edit any of these files yourself, you use the passwd command. See 'man passwd'.
Thanks Smilie And sorry if I was rud to you to. And thanks for all the other replays. Smilie


I went down in det shadow file and found this:

root:$1$Oaj/9dOP$RzZBTVpfYril1tW9.QsDO/:10957:0::::: //the hash is cahnged so if you crack it good work Smilie

Is the led here the same as in the last one: usernameSmilieasswordhash:uid:gid:undefined:homedir:loginshell

our?

Last edited by hast5; 10-18-2006 at 02:50 PM..
# 9  
Old 10-18-2006
Mostly the same, but this isn't a standard the way /etc/passwd is. It'd be defined by shadow or whatever other program you have does this. The entries are seperated by :. The first two are username and password hash. With the rest of the information available in /etc/passwd, the other fields probably don't mean much. I don't know what the 10957 is but that's sure not root's uid or gid.

Root definitely has a password already, whatever it is.

How did you see that? The whole point of keeping /etc/shadow seperate is so that you can restrict it to root-only.

Last edited by Corona688; 10-18-2006 at 03:16 PM..
# 10  
Old 10-19-2006
Quote:
...the other fields probably don't mean much. I don't know what the 10957 is but that's sure not root's uid or gid.
My man page on "shadow" describes a C struct which has fields that correspond to the /etc/shadow file. What threw me off initially is that these fields are in days, not seconds, since the epoch.
Code:
DESCRIPTION
       shadow manipulates the contents of the shadow password file, /etc/shadow. The
       structure in the #include file is:

       struct spwd {
             char          *sp_namp; /* user login name */
             char          *sp_pwdp; /* encrypted password */
             long int      sp_lstchg; /* last password change */
             long int      sp_min; /* days until change allowed. */
             long int      sp_max; /* days before change required */
             long int      sp_warn; /* days warning for expiration */
             long int      sp_inact; /* days before account inactive */
             long int      sp_expire; /* date when account expires */
             unsigned long int  sp_flag; /* reserved for future use */
       }

       The meanings of each field are:

       ·  sp_namp - pointer to null-terminated user name

       ·  sp_pwdp - pointer to null-terminated password

       ·  sp_lstchg - days since Jan 1, 1970 password was last changed

       ·  sp_min - days before which password may not be changed

       ·  sp_max - days after which password must be changed

       ·  sp_warn - days before password is to expire that user is warned of pending
          password expiration

       ·  sp_inact - days after password expires that account is considered inactive and
          disabled

       ·  sp_expire - days since Jan 1, 1970 when account will be disabled

       ·  sp_flag - reserved for future use

# 11  
Old 10-19-2006
OK, I have reinstalled my UNIX and this is what I got.
I go in the terminal and type cd .. cd .. etc to I come to det folder etc in this one I type sudo cat etc and get this: (I only use the root as exampels )

Code:
root:x:0:0:root:/root:/bin/bash

But someone did say something about the shadow file? right?
So I try that one... And get this:

Code:
root:$1$HG6PJiO0$Lk4OpOTdD632/qAdPzAYo/:13440:0:99999:7:::

So I am a littel confjused now... Where can I find the password hash?
Our have i found it in the shadow file. Is it only me that dident se the hash, and what kind is it?

NB: The examples are un changed. If someone find the password dosent matter. I used a exampel password.

Thanks for helping me with this. And for evry one that have been giving med good advice and exampels.
# 12  
Old 10-19-2006
Where is the hash?
You're looking at it.

http://dictionary.reference.com/browse/hash

Basically, it's the output of an obfuscation mechanism. The string of characters after "root:" is not the actual password. The actual password is represented by a fixed string of characters that only means something useful to the security/authentication mechanisms built into the system.

The password has been hashed (see link above).

So it is not trivial to get the root password if it is forgotten (or someone wants to try to steal the password from the files you've been looking at). Smilie
# 13  
Old 10-19-2006
Quote:
Originally Posted by hast5
So I am a littel confjused now... Where can I find the password hash?
It's this bit:
Code:
root:$1$HG6PJiO0$Lk4OpOTdD632/qAdPzAYo/:13440:0:99999:7:::

Yes, it looks like garbage. That's kind of the point Smilie
Quote:
Our have i found it in the shadow file. Is it only me that didn't see the hash, and what kind is it?
It may be old-fashioned UNIX crypt(), but these days they're switching over to the more secure MD5.

See the linux shadow password HOWTO. It's a bit out of date, particularly in that I don't know of a Linux system that doesn't use shadow by now, but it's a good outline of the what and why.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How to ssh from an AIX OS server to a Fabric OS server without password?

Hi I'd like to ssh from an AIX OS server ( v5.3) to a Fabric OS server ( v6.1.2 ) without password. I tried using dsa or rsa keys but it didn't work, the aix server still asked for the password. Somebody help, please :(:(:( (8 Replies)
Discussion started by: bobochacha29
8 Replies

2. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

3. Shell Programming and Scripting

Connect to one server from other server without asking password

Hi , I am using redhat linux 5.I.I need a command or script which need to login from one server to another without asking password.This can be done even providing password on the command line is also fine.I have tries sshpass but it didn't work.ssh key generations is not preferred here. ... (7 Replies)
Discussion started by: muraliinfy04
7 Replies

4. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

5. Shell Programming and Scripting

Find and delete files and folders which are n days older from one unix server to another unix server

Hi All, Let me know how can i find and delete files from one unix server to another unix server which are 'N' days older. Please note that I need to delete files on remote unix server.So, probably i will need to use sftp, but question is how can i identify files and folders which are 'N'... (2 Replies)
Discussion started by: sachinkl
2 Replies

6. Shell Programming and Scripting

Connecting to multiple unix server from unix server using shell script

Hi Gurus, I'm a unix newbie and I would like to connect to multiple unix servers from unix server using shell script i.e from server a to server b,c,d etc. I want to copy the files from unix server a to server b, c, d. I can access staright using ssh without the need to have password and user... (5 Replies)
Discussion started by: sexyTrojan
5 Replies

7. UNIX for Advanced & Expert Users

How to update my account password on 100 unix server ?

Hi We have over 100 unix servers. They include linux,solaris,aix,hp and sgi. I use telnet for some and ssh for rest. Note: none of this server has expect which i can use to update.So i am looking for expert who can help me with their script or guide me write KSH script to automate this. Thank... (6 Replies)
Discussion started by: humaurtum
6 Replies

8. Shell Programming and Scripting

How to connect unix server to unix server through shell scripts

Hi, I would like to connect UNIX server to UNIX server through shell scripts and i have some concepts . But i am totally confused how to connect UNIX server to UNIX server throuth running a script. It will be greatful to me if any buddy will help me. Thanks in advance. Phatan:) (2 Replies)
Discussion started by: phatan
2 Replies

9. UNIX for Dummies Questions & Answers

How can I tranfer an OS/ Unix (from old HD to new HD / include all files saved )

-------------------------------------------------------------------------------- How can I tranfer an OS/ Unix (from old HD to new HD / include all files saved ) Could anyone help me out. :confused: Thanks (0 Replies)
Discussion started by: Vietnam
0 Replies

10. UNIX for Dummies Questions & Answers

I inhereted a Unix server that is password protected...Help!

I inhereted a project server that has UNIX installed with a SCO OS. I am trying to learn UNIX but I cannot go beyond the password and login. The original engineers have left the company and nothing was ever written down. How can access our server? (1 Reply)
Discussion started by: fxsaint
1 Replies
Login or Register to Ask a Question