Modified /etc/passwd file

Asked by passionguy on 2009-02-17

I m running Gutsy. I used cat command to add an user to the file passwd file like this.
cat > passwd

& appended the following lines to the file.
test:x:501:501:Bob Morris:/home/test:/bin/bash

& pressed control-d.

I opened the file again & i m able to see only the line i added.

Will this affect my login next time.


Question information

English Edit question
Ubuntu shadow Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

This question was reopened

peter (peter-neuweiler) said : #1

If you are going to create a new user, I recommend to use the following:

1: Click System > Administration > Users and Groups

This method works very well. And I'm sure, your added line will influence the log in. Ubuntu is a very consistent system - Ubuntu won't forget *lol.

Hope it helps.

And I suggest you stop playing with system files :D Or install a secondary system to break and experiment !!

passionguy (fayazahmedj) said : #3

I thought i have appended but it was not. I am not able to login now even as root. Is there any backup created automatically which i can restore?

I played without creating a backup of it.


peter (peter-neuweiler) said : #4

If your PC is running, do the following:

1: Click System > Administration > Users and Groups

Change the password of the root and make sure that rest of the data is ok, I guess, ther's no backup solution.

passionguy (fayazahmedj) said : #5

It is giving up a message that GDM user does not exist & needs to be reconfigured.

passionguy (fayazahmedj) said : #6

Can i switch to root using the live cd & wts the password?

passionguy (fayazahmedj) said : #7

I m asking this to restore the /etc/passwd file.

peter (peter-neuweiler) said : #8

Did you copy the file /etc/passwd before you updated it? If the answer will be yes, copy the backup back to /etc/passwd. If you don't have a copy, it will be difficult.

passionguy (fayazahmedj) said : #9

I have made a copy thru the live cd & have made some modifications for the user permissions. It is not allowing me to replace saying 'Permission denied'. Is there any way to switch as root in the live cd so that i can replace?

peter (peter-neuweiler) said : #10

If your system is running, do the following:

sudo cp /dir/file.bak /dir/file

Hope it helps.

passionguy (fayazahmedj) said : #11

I tried the following:
cp /media/disk-2/passwd.bak /media/disk/etc/passwd

cp: cannot create regular file `/media/disk/etc/passwd': Permission denied

passionguy (fayazahmedj) said : #12

If i login as root i believe i can replace it. Any ways

peter (peter-neuweiler) said : #13

Ok, I'll keep my fingers crossed.

passionguy (fayazahmedj) said : #14

I m not an expert Peter.Just a guess & i thought there may be a default

peter (peter-neuweiler) said : #15

I'm not an expert too. Did you login as root? And what happened?

passionguy (fayazahmedj) said : #16

Used the EXT2IFS tool in XP & restored the live cd passwd file with modifications to the original location. It worked..

peter (peter-neuweiler) said : #17

Great. Enjoy Ubuntu and don't play again with system files *lol.