Help, I am Locked from my system

TheBaby

Member
Nov 4, 2001
33
0
0
I was installing proftpd and adding users giving them a /bin/false . All of a sudden the next time I try to SSH into the linux machine on m LAN I am locked out
help

I am now locked out of my system as root and I cant get in

I went to enter an SSH session , I tried to logon and it wasnt accespting roots password

I walked over the linux machine, rebooted, tried to logon as root/password and it said CANNOT START YOUR SHELL, IT COULD BE THAT THE SYSTEM ADMIN ...........

How do I fix this

RH 7.2
 

TheBaby

Member
Nov 4, 2001
33
0
0
I insrted RH 7.2 CD 1 and entered rescue mode but I dont know what to edit or fix so I can log back on as before
Before I used to just pick KDE or GNOME, enter root, and roots password

Do you know what I have to edit

I looked in the /etc/passwd file and it said root........./bin/bash (at the end)

I rebooted and I get the same
 

TheBaby

Member
Nov 4, 2001
33
0
0
Ok, I think I found the problem but I need help

I re did the linux rescue and this is what it said when it started.
Code:
RESCUE
Your sytem has been mounted under
/mnt/sysimage

Press enter to get to the shell. If you would like to make your system the root environment run the command

chroot /mnt/sysimage

The sytem will reboot automatically exit the shell

OK  SKIP

I pressed ok and it went to a command "sh-2.05#"

From here I went to

cd /etc
ls
pico passwd
and this is what passwd said
Code:
root::0:0:root:/:/bin/bash

As I said before I was editing this file on a windows machine on my LAN when I was trying to setup proftpd. I luckily had this passwd file on my windows machine and this is what it said

Code:
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:Daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/var/spool/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/bin/false
nobody:x:99:99:Nobody:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/dev/null
rpm:x:37:37::/var/lib/rpm:/bin/bash
xfs:x:43:43:X Font Server:/etc/X11/fs:/bin/false
ntp:x:38:38::/etc/ntp:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/bin/false
gdm:x:42:42::/var/gdm:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/bin/false
ident:x:98:98:Pident user:/:/sbin/nologin
radvd:x:75:75:radvd user:/:/bin/false
apache:x:48:48:Apache:/var/www:/bin/false
squid:x:23:23::/var/spool/squid:/dev/null
pcap:x:77:77::/var/arpwatch:/bin/nologin
mysqlusr:x:500:500::/home/mysqlusr:/bin/bash
marc:x:501:501::/var/ftp/marc:/bin/false [color=Red] <-- this was the ftp user that I added with bin/flase[/color]

As you can see the 'root" is missing an 'x" so I went to pico and edited the file within rescue. i have never done this before so I am not sure if I am doing it right

Anyways I told it to save the buffer over the curent /etc/passwd file with the "x" there

I rebooted and again it said CANNOT START YOUR SHELL, IT COULD BE THAT THE SYSTEM ADMIN ...........
It lloks like the password is ok but it wont atart the KDE or GNOME

I went back to linux recue cd'd over the /etc/passwd and again it did not take , it still says
Code:
root::0:0:root:/:/bin/bash

So it looks like whin I am saving the file in pico, the file is not saving

Do I have to do something else to edit and then save that file so I can change it to read
Code:
root:x:0:0:root:/root:/bin/bash
 

Heisenberg

Lifer
Dec 21, 2001
10,621
1
0
When you're at the LILO boot screen, enter "linux -s" (or whatever you call your RH install). You may have to hit "Ctrl-x" for text mode. This will boot RH into single user mode and give you a command prompt. Then just do "passwd" and change the root password. That should fix /etc/passwd. If it doesn't, try editing the file manually.
 

TheBaby

Member
Nov 4, 2001
33
0
0
1. i tried editing manually but ehen I entered the rescue mode again I cd'd over to /etc/passwd and it did not save

That is what my above post was about


2. I am realy not sure how to do that

I dula boot XP and RH 7.2, grub comes up and I can pick between RH or DOS (XP)

How do I do what you sid



Thanks




 

Heisenberg

Lifer
Dec 21, 2001
10,621
1
0
If you're using GRUB, hit "c" and then do "linux -s"(again, whatever your linux is called). I don't use GRUB but that should work. As far as it not saving the changes, did you do "chroot /mnt/sysimage"? You have to do that in order to edit the system files (only in rescue mode, not after doing "linux -s").
 

TheBaby

Member
Nov 4, 2001
33
0
0
No, I did not "chroot /mnt/sysimage"

It looks like I wasnt even looking at the corect "passwd" file. It seems I was on a temperary one for rescue

Someone told me that the problem is it has carriage returns. Earlier today I was editing the passwd file on a windows machine and then resaved it in linux
 

Heisenberg

Lifer
Dec 21, 2001
10,621
1
0
Yeah, you have to do "chroot /mnt/sysimage" You were looking at the CD I think. Root in rescue is off the CD I believe - chroot will make the directory the system is mounted under the root directory. I'm still trying to figure out what happened. It's possible carriage returns are the problem. I've had problems with editing a script file in Windows before. Give the rescue mode a shot again.

Edit: You can also just do "cd /mnt/sysimage" in rescue. You should then see all your directories as if you were at "/". So your passwd file would be "/mnt/sysimage/etc/passwd".
 

TheBaby

Member
Nov 4, 2001
33
0
0
Thank You, I am back up ;)

All I did was resave it within in pico while I was in chroot /mnt/sysimage

Now back to setting up proftpd

Do you know a windows editor that wont screw up these files
 

Heisenberg

Lifer
Dec 21, 2001
10,621
1
0
I would recommend ViM. It's an improved version of vi - THE *NIX text editor. I know there's a version for Windows.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
You are using Linux for a reason. Drop the Windows editting and just edit in the ssh connection. While you are at it, switch to key authentication and install sudo incase you need to get some root privledges again from your normal user account.
 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81


<< What is sudo, can you go into that more >>



Sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments.
 

TheBaby

Member
Nov 4, 2001
33
0
0
The way I have it setup now is that root is the only user

With SSH over my LAN I logon as root and edit there

So you are saying make another user and with this user install sudo, give them root access with sudo so In case this happens again I can logon as the other user and edit there

Where can I find sudo in RPM
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
You should only use root under specific instances. Do not use root to do day to day things. Its stupid. Much like using Administrator in Windows for day to day use. Check out freshmeat.net they may have a link to an rpm but I dont use that stuff.