ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Make some money - linux/Plesk guru



  172 CUP
Im mega stuck on something to do with one of my Linux boxes running plesk

I have broken the /etc/passwd file and /etc/shadow file. I cant seem to edit it in single user mode any experts out there fancy making a quick £50 im in need of some help. my knoledge is limited

Steven
 
  172 CUP
More info.
I know its a problem with mounting the drive as i can create a file reboot and its gone again.
I know im missing a simple command but just cant find it anywhere
Steven
 

KDF

  Audi TT Stronic
Hi got your PM.

When you boot into single user mode does it boot without problem ? and are your drives being mounted correctly or are you having to manually mount them.

Have you tried booting into linux rescue mode ?

If you can, boot to rescue mode then cd to /mnt/sysimage/etc and edit your /etc/passwd and /etc/shadow directly or with vipw

Also, if you can create a /etc/passwd and /etc/shadow then you can leave the root password blank and then change it by going to single user again and typing passwd.
 
Last edited:
  172 CUP
I make all the changes in single user ( recovery) mode as root can now not login to normal mode via ssh

Ive tried mounting it but not with that command so will try that in a bit,

Ive tried editing /etc/passwd and shadow with pico save the file see its changed by going ls -la

reboot out of single ser mode and the file reverts back and any changes are not saved.

Im going to try
mount -uw /
now andsee what happens and your mnt/ comand
 

KDF

  Audi TT Stronic
I make all the changes in single user ( recovery) mode as root can now not login to normal mode via ssh

Ive tried mounting it but not with that command so will try that in a bit,

Ive tried editing /etc/passwd and shadow with pico save the file see its changed by going ls -la

reboot out of single ser mode and the file reverts back and any changes are not saved.

Im going to try
mount -uw /
now andsee what happens and your mnt/ comand

root is normally disabled for remote SSH logins by default (for security), you should log in with a normal user account then su to root.

if your running in rescue mode then your running a 'virtual' filesystem, your editing a virtual file...

dont edit /etc/passwd and /etc/shadow

DO edit

/mnt/sysimage/etc/passwd

and

/mnt/sysimage/etc/shadow



otherwise next time you reboot it will be back the way it was !

Your REAL filesyste is located in /mnt/sysimage when you go into rescue mode.... hence to edit your REAL passwd file you have to edit /mnt/sysimage/etc/passwd

hope that makes sense.
 
  172 CUP
root@wpc0049:~# /mnt/sysimage/etc
-bash: /mnt/sysimage/etc: No such file or directory


as with some other mount commands this one dosnt work either

2.6.15.7-ubuntu1-live #1 SMP Mon Sep 4 15:12:51 UTC 2006 i686 GNU/Linux
Welcome to your recovery system!
 

KDF

  Audi TT Stronic
ah okay your using ubuntu, forget the /mnt/sysimage then.

Your drives are mounted as read-only when you go into rescue mode so you must re-mount them as read/write using

mount -rw -o remount

that will remount / as read/write. if you /etc is on a seperate partition you must remount that aswell.

The command

pwconv

will rebuild your shadow file from the passwd file, then change your root password using the

passwd

command.

Its worth check /var/backup as you may have passwd and shadow file backups in there. they will have the .bak extention on them, eg shadow.bak...


when you boot the system normally what error are you getting ?
 
  172 CUP
just trying now

your mount command dosnt work but


mount -o remount,rw /

did so ust rebooting after making a change to see if it stayed there.
 
  172 CUP
nope /etc/passwd is back to old date and a folder i created before rebooting it is now gone again. Its still as if i dont have write permission
 

KDF

  Audi TT Stronic
Sorry, yes you must specify the filesystem that you want to remount eg / or /etc or /var etc.

I'll check back tommorow to see how you got on ;)
 
  172
It doesn't the users do, and it's bloody complicated to sort out, that's why I never get too deep into Linux, it starts to melt my shitty brain :(
 
It doesn't the users do, and it's bloody complicated to sort out, that's why I never get too deep into Linux, it starts to melt my s**tty brain :(

Nah, it's easy to fix compared to Windows servers.

You ever seen a Windows Active Directory domain which is out of sync between the controllers?
Same with IIS - I can fix Apache quicker than IIS Manager loads, let alone look at the mess which is inside it!! ;)

Altho, technically, "Linux" is just the kernel.. so.. :p
 
  172
I don't do servers ;) I hate anything like that it bores the pants off me. I'm down on the list to be 2nd in command with all our servers @ work (inc. gentoo linux servers), but I just don't want to. I need to though as I feel sorry for the guy who looks after them all now, poor lad is worked to the bone with them and needs some backup.
 
  172 CUP
Ive sorted it now Ill explain in a bit mounting it was the right way but what to and how to mount it was the question.
 
  172 CUP
Solution:

We log in in single user mode and found the correct part to mount issued these commands

# mkdir /mnt/hda3

# mount /dev/hda3 /mnt/hda3

That’s where all of the harddrive data is kept. Took a while to find it.

cp /mnt/hda3/etc/passwd-backup /mnt/hda3/etc/passwd
cp /mnt/hda3/etc/group-backup /mnt/hda3/etc/group

reboot to normal mode

Done – Thanks to the help of someone over MSN we both had the challenge but took a while 4 commands in the end. Im so grateful for all the help I received.
 

KDF

  Audi TT Stronic
Glad you got it sorted..

Daz is right.. Linux boxes are easier/faster to fix than windows !
 


Top