How to edit the /etc/passwd file not using root?
Hi All,
Today I faced a problem trying to log in as root. The output error is cannot execute sh: No such file.... I doubted there is something wrong with shell interpreter which resides in /etc/passwd file for every user who logs in. I checked and the line for root account was self-corrupted like below: root:x:0:0:root:/root:sh THe line for the user I`m using looks fine elton:x:1000:1000:Elton,,,:/home/elton:/bin/bash Can anyone tell me how to modify the line of root to add the proper path of shell? Thanks |
Sorry can't help with your problem, just wanted to say hello to a fellow Elton (Don't see many of us around)
Elton |
There may be a simpler way, but I'd boot a live cd, mount the relvant volume and edit it that way
|
Quote:
|
You could log in as a normal user and use "su" or "sudo" to edit the /etc/passwd file.
Code:
su -c "vi /etc/passwd" Code:
sudo vi /etc/passwd |
try booting single user and editing the file
when you come to grub boot screen type e then type init=/bin/bash then enter |
Quote:
|
curious
I'm just curious:
how can the /etc/password file get self-corrupted? And even so only by having the shell definition changed? You surely must have done something to it... Xen in Hardy |
No worries, glad to help
|
Quote:
Just for your curiosity I`m not that stupid to change my self the passwd file and specifically the line belonging to the root :) I don`t know what happened, as far as i remember before yesterday nothing critical was installed in the system...so it will be a mystery :) Thanks |
All times are GMT -5. The time now is 06:04 PM. |