1834166 Members
2109 Online
110064 Solutions
New Discussion

Re: root password

 
SOLVED
Go to solution
sam kim_1
Frequent Advisor

root password

Hello,

1) i just added an user under adm.group thru sam.
2) after that, a system could not recognized the root password (or root itself maybe)
3) i just rebooted the machine, then typed at #whoami, then it does not recognized this command (whoami)
4) i already tried #set_parms root_passwd and #passwd (neither one is working)
5) can you help me out!!
17 REPLIES 17
Rick Garland
Honored Contributor

Re: root password

See if the /etc/passwd file still exists. There may be some SAM patches that are needed.
Antoanetta Naghiu
Esteemed Contributor

Re: root password

How did you add the user? Using sam, useradd or vi-ing the /etc/passwd?
If you edit the file with vi, more /etc/passwd and check if it is correct.
Check the new user ID and (silly thing), GID.
Take a look into /etc/group as well.
Rob Mallard
Valued Contributor

Re: root password

Sounds like you don't have a proper PATH. Check the HOME directory for root. It maybe it was changed. Some people set it to /home/root others prefer / If you have the wrong HOME directory you will not be reading your .profile file. Look for .profile in the two directories above, the one with the .profile is probably the one you started with.

Hope this helps.
Antoanetta Naghiu
Esteemed Contributor

Re: root password

run pwck and grpck (see man pwck, man grpck).
Acctualy, you can bring the system up, you can login as root, and after that what you try to run as root is mixed up. Can you login as a regular user?
sam kim_1
Frequent Advisor

Re: root password

i'm still working on it!!
1)i added it using sam not vi.
2)/etc/passwd is there, but root is not there
3)/etc/group is there
4)/home/root is there (with 4 files
that .cshrc, .exrc, .login, .profile)
5)neither #pwck nor #grpck is working
5)i did several things as follows:
a. reboot
b. ran #fsck then 'Y'
c. check mount (/var, /usr, /opt are
missing)
d. mount /var, /usr, /opt
e. now, i was able to go #sam
f. checked groups and users (nothing there)
g. created administrators group, but
nothing again after i created it
h. created root under user, but it does
not work since there is no group.
Antoanetta Naghiu
Esteemed Contributor

Re: root password

Try to get /etc/group and /etc/passwd files containing root, daemon, bin, sys, adm, and so one (see another healthy box for reference.
You can try to recover those files from a backup tape if you have...
Good Luck!
Rick Garland
Honored Contributor

Re: root password

Can you modify the file?

If possible, go into single user mode (reboot into single user mode) then vi the /etc/passwd file, add the missing root entry and then boot into multi-user mode.

If you have a trusted environment, you could rlogin -l root from another server and do the mods. You would not have to go into single user mode for that.

Restore from backup.

One of these options is sure to work.
sam kim_1
Frequent Advisor

Re: root password

i just did:
1)reboot
2)into single-mode (using >hpux -is)
3)mount to (/var, /usr, /opt)
4)vi /etc/passwd (nothing there)
5)i need to add missing root entry (but i dont know what entry should be... i know how to add and save from vi editor)
6)i am very beginner that i don't know how to check /etc/group and /etc/passwd [what i did was #more /etc/group then #ls, there were many dirs and files but nothing like adm,sys,daemon,bin,root. and also nothing there after i ran #more /etc/passwd then #ls]
did i checked it right!?
7)i still can go #sam then users and groups, but nothing there in GROUPS and USERS [if i tried to add groups such as administrators or users, it does not work.]
Rick Garland
Honored Contributor

Re: root password

Here is an example root entry for the passwd file:

root::0:0::/:/sbin/sh

There should be 7 fields in order of: username:passwd:uid:gid:comment:home dir:shell
The passwd field is blank for the time being - you can set the passwd after you get set. The uid for root is 0. The gid for root can start off at 0 - can change it later. The comment field you don't need right now (can put something in later). The home dir is root's $HOME and the shell is the default shell for root.

This is from an 11.00 system but this will work on 10.20 as well.

Once you get the root entry back in, further modifications such as adding additional users, setup for NIS, etc... can come after the fact.

BTW, always make a backup copy of the passwd file and the group file. I think you see why. This can be done via a simple script that is executed via cron.

Also, once you get the root entry back in, can you restore from backup?

For the group file, start with:
root::0:root

Again, additions can come later. Just need to get the system up first and then do the
restores.

Permissions for the passwd file are -rw-r--r-- root root
Permissions for the group file are -r--r--r-- bin bin


Antoanetta Naghiu
Esteemed Contributor

Re: root password

You are in single user mode.
cd /
ls -al /etc/passwd*
ls -al /etc/group*
You should have someting like:
-r--r--r-- 1 root sys xyvz Month day hh:mm /etc/passwd
where xyzv are the size in byte of the file.
Same for group but having, of course the name changed.

Do you have that?
to see that you have inside of the file, type more /etc/passwd respectivelly more /etc/group

If the size of the files are not 0, you should be able to see something as:
user_name:encrypted_paswword:UID:GID:comment:home_directory:login_shell
ex:
root:asdfghjk:0:3::/:/sbin/sh
For root you should have UID=0 and group=3.
If root doesn't exist, edit this line as:
root::0:3::/:/sbin/sh, you'll have blank password but you can change it after running passwd command
For group,
group_name::GID:user_that_belongs with this group
ex:
root::0:root
adm::4:root,adm
sys::3:root,uucp
and so on.
If you have another HP machine to take a look will be nice. If not, try to recover from the backup tape just those 2 files in another location (what backup tools are you using, and how looks the backup script?

From what you are saying is something wierd... Let's see...
Rick Garland
Honored Contributor

Re: root password

To get into vi:

cd /etc
vi passwd
go to the first line (the very first line)
press the letter "i" for insert
(do the additions above in previous post)
hit the escape key - should hear a beep or the screen flashes
<:>wq to write and quit.

If there is a passwd and group file already out there, copy them someplace safe.
cp /etc/passwd /etc/passwd.orig
cp /etc/group /etc/group.orig

If there are previous files existing, you may be able to just copy them into place.

Do: ls /etc | grep pass
If there was a previous copy of the passwd file, just copy it into place
cp /etc/passwd. /etc/passwd

You may need to do this in single user mode - depends on the access you have in multi-user mode.
sam kim_1
Frequent Advisor

Re: root password

i just :
1.added vi entry (root::0:0::/:/sbin/sh) then tried #whoami (it says 'root).
2.but, i don't know how to make backup copy for group file and passwd file
3.i don't know either how to restore that file.
4.i probably can do changing permission using #chmod command (is that right?!)

if you give me a step by step .. thanks!!
Antoanetta Naghiu
Esteemed Contributor

Re: root password

Congratulation, you are in the right way.
more /etc/passwd and more /etc/group.
Can you post the outputs?
Also, can you check if tcb directory exists?
ls -al /tcb
Let's ensure you have the good /etc/passwd and /etc/group.
To do the backup copy, just type the cp command that Rick posted.
Rick Garland
Honored Contributor
Solution

Re: root password

Good - you are heading in the right direction.

As to making a backup copy, lets begin by checking to see if another copy of the files exist. Do the following commands:
ls /etc | grep passwd
ls /etc | grep group

What is returned?

From this point I believe you are able to login as root in multi-user mode. I would investigate the backup and restore capabilities that are present in your environment.
Do a restore of those files from the backup tape. I am unable to give step by step as I do not know what your environment is.

Once these files are restored from tape, you should be at the point of having the files at the time the backup was performed. This should include all (or most of) the /etc/group entries and the /etc/passwd entries. From this point, it should just be a matter of making the additions that you recently attempted.

As to making a backup copy of the files, you can just do the cp command as I previously posted.

There should be a system backup/restore capability present in your environment. It is from this backup you want to restore from to get back as close as possible. If there is not a backup/restore methodology present, sorry to say that there is not a thing that anybody can do to help get the file back. It would have to be recreated. But, you are going in the right direction to doing that.

As a note, become aquainted with 'vi'. You will find it on all flavors on UNIX and it operates in the same manner on all flavors. It is somewhat of a standard. You can not always rely on SAM to help you as you are finding out.

Also, learn the backup/restore methodology that is being used in your environment. As you are finding out, it can be critical.

Always keep a copy of these files on the system and do the copy command before doing modifications.

Trevor Dyson
Trusted Contributor

Re: root password

Hi Sam,

Here are the default /etc/passwd entries:

root::0:3::/home/root:/sbin/sh
daemon:*:1:5::/:/sbin/sh
bin:*:2:2::/usr/bin:/sbin/sh
sys:*:3:3::/:
adm:*:4:4::/var/adm:/sbin/sh
uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico
lp:*:9:7::/var/spool/lp:/sbin/sh
nuucp:*:11:11::/var/spool/uucppublic:/usr/lbin/uucp/uucico
hpdb:*:27:1:ALLBASE:/:/sbin/sh
nobody:*:-2:-2::/:
www:*:30:1::/:

The above entry for root has no password set

Here are the default /etc/group entries:

root::0:root
other::1:root,hpdb
bin::2:root,bin
sys::3:root,uucp
adm::4:root,adm
daemon::5:root,daemon
mail::6:root
lp::7:root,lp
tty::10:
nuucp::11:nuucp
users::20:
nogroup:*:-2:

Without these entries there could be some issues with getting into multi user mode.

Please do not go to multiuser mode from single user mode. You should do a full reboot (sync;sync;reboot -r).

Let us know how you are getting on.

Regards, Trevor
I've got a little black book with me poems in
sam kim_1
Frequent Advisor

Re: root password

This morning;
1) boot up the machine (without #reboot -r, just reboot using power switch)
2) i didnt input anything such as 'hpux -is'
(until the screen appears CDE login screen)
3) i logged in 'root' as username, then hit just enter for password.
4) then, it was able to open xwindow (CDE)
5) then, i opened users and groups, only a user 'root' is there under 'users area', but nothing in 'groups area'. so, i have created
'administrator' group and 'root' is member of that group.
*********************
6) then, i checked several things as follows:
a. #more /etc/paswd [result : root::0:00/:/sbin/sh]
b. #more /etc/group [result : nothing]
c. #ls -al /tcb [result : /tcb not found]
d. #find . -name tcb [result : ./usr/newconfig/tcb]
e. #cd /etc (then) #vi passwd [result : root::0:0::/:/sbin/sh]
f. #vi group [result : nothing]
g. #ls /etc |grep passwd [result : passwd]
h. #ls /etc |grep group [result : group netgroup]
i: #ll /etc/passwd [result : -r--r--r-- 1 root 0 80 Aug 17 08:06 /etc/passwd] ; is this command same as #ls -al /etc/passwd* ??
j: #ll /etc/group [result : -r--r--r--
1 2 2 0 Aug 17 08:06 /etc/group] ; is this command same as #ls -al /etc/group* ??
************
7) this box is hp-9000 k-series and using o/s is hp-ux B.11.x.

[conclusion -
A. i am able to login by 'root' now since i added root entryfrom #vi passwd
B. but, i am still have a problem in 'group area' i think.
C. some reason, i could not open iexpoler and outlook express any more [strangely, there is a brand new file called 'core']
D. i really thanks to all help me out !!!
[am i a ntix guy now?!?]





Rick Garland
Honored Contributor

Re: root password

You are at a state in which you can boot and function as the root user.
A restore from your backup media is needed to get back to where you were.
The main point is that you are able to proceed with this task.

The 'l' command is similar but not quite the same as 'ls -al'. With the -a switch in the command it allows you to see ALL files in a directory. This would include the 'hidden' files - those that begin with a dot (.).

There is a previous post that defines the default passwd and group files. You may want to start making those entries. But get the backup files from the media after you are done.