I have a client who had hired a web developer to help him take his site to the next level. This developer moved 3 of his sites to a server that provides no tech support whatsoever. Now this web developer has sold his company and moved on to another job, leaving my client with a lot of problems. I've called the hosting company, but they refuse to help, stating they cannot give him any passwords, nor can they help him retrieve his files. They have sent me instructions on how to access the server via Putty to reset the root password, but I am unable to get past a certain point in those instructions. One of the websites cannot even be accessed - I get a Server Not Found message, although the company tells me the site is up and running (according to their pings). The scenario gets more complicated, but in short, my client wishes to move his sites back to his old host.
The sites are on a linux server, and I have a Windows computer. The only way I can (or am allowed to) access these files are via SSH, hence a need for someone who understands Putty - or has an understanding linux and can retrieve files from the server directly.

Recommended Answers

All 10 Replies

ssh root@IP address should create connection, although I would expect it to require root password before log in in fact for any case. Could you maybe share some of the instructions?

Thanks for the quick response/interest.

What I am attempting to do below is to get the root password reset, as I do not have access to the current root password and the host techs tell me they do not have it - although they, for some strange reason, can confirm if the password I have it correct - go figure.

To request the root password - or reset it to a new password,
First I have to log in to the host's manager panel and put the server (it is a dedicated server) into rescue-pro mode.
Once that is done, I receive an email with a temporary password to log in via Putty using root as the user.

I open Putty, type in the ip address, than am
prompted to enter the password I've received by email, and doing so, I will have access to the server. However, none of its hard drives are yet mounted, so the change cannot yet be made.

  1. I then need to identify which drive contains my “/” directory, which I will later be mounting. Type the following command:

parted -l

I am then suppose to be presented with a list of unmounted drives and their respective partitions.

But that is where it breaks, as I get no list. I have attempted to continue with the instructions, but from that point on, all I get is "file or directory not found."

The rest of the instructions go as follows.

You will need to use the “tune2fs” tool on each partition to find the “/” directory. Here is an example of what you should be typing:

tune2fs -l /dev/mda0
tune2fs -l /dev/mda1
tune2fs -l /dev/mda2
tune2fs -l /dev/mda3

tune2fs -l /dev/sda1
tune2fs -l /dev/sda2

You're looking for a line with the following result (it's usually among the first lines of the output):

Last mounted on: /

If a server has a software RAID, you will see “Model: Linux Software RAID Array (md) ”. You'd be looking for something like /dev/md1 or /dev/md3 for example. If the server has no RAID configured, you will see the partitions for each disk by look at "Disk /dev/sda" and then checking the "Number" column below it: paritions would be then /dev/sda1, /dev/sda2, etc.

Once you have identified the appropriate partition, for example /dev/md1 (which is in RAID), you will need to mount that drive. Type the following command:

mount /dev/md1 /mnt

Now, /dev/md1 will be mounted in /mnt. The next step is to become the root user associated with that drive. Type the following command:

chroot /mnt

Once this is done, enter the following command:

passwd root

You will then be prompted to change the password (and then type it again to confirm it) of the root account. Once that's done, you'll have to change back the option in The Manager to "Boot on hard disk". You can then reboot your server.

Since I cannot get past a certain point here, I thought perhaps I could find someone who knew Putty or linux servers I could hire to help retrieve these files so I can move them to a different host. While the former web developer was obviously quite comfortable with this type of server setup (he hates cpanel, which is what my client had before), I am not a developer and would prefer to use cpanel, as I am at a loss with Putty.

On my system, man parted shows option

       -l, --list
              lists partition layout on all block devices

If parted -l doesn't work for you, I would try fdisk -l and see if that works, in fact fdisk would be my primary choice, it should list all partitions

If fdisk -l doesn't work, try: sudo fdisk -l

I think that the following should work (in bash shell):

To enter bash shell, type "bash" at the prompt:

# bash

Then enter the following on one line:

for i in $(fdisk -l | awk '/^\/dev/ {print $1}'); do echo ""; echo $i; tune2fs -l "$i" | head -3 | grep -v tune2fs; done | more

If that doesn't work, you may need to use "sudo":

for i in $(sudo fdisk -l | awk '/^\/dev/ {print $1}'); do echo ""; echo $i; sudo tune2fs -l "$i" | head -3 | grep -v tune2fs; done | more

What does it do? Basically, it runs fdisk -l and searches for lines that start with "/dev". For each of the results found (ex: /dev/sda1, /dev/sda2, etc...), it echo's (prints to terminal window) the partition name (ex: /dev/sda1, etc...) and then runs tune2fs -l on it--returning the first 3 lines of output and eliminating the line that has "tune2fs" in it. The "more" pauses it if there is more than one screen of data to give you time to read it.

The stuff between / /, is a pattern. The caret (^) means "starts with", and the "\" escapes the "/".

I tested it in linux.

Note: When using "more", use space bar or enter key to see more data.

Alternatively, you can do the following:

# fdisk -l | awk '/^\/dev/ {print $1}'

Note: You can just type fdisk -l and look through the output for the information (eliminating | awk '/^\/dev/ {print $1}') if you like.

you should see values like:


and then for each value, run "tune2fs -l":

# tune2fs -l /dev/sda1 | head -3 | grep -v tune2fs
# tune2fs -l /dev/sda2 | head -3 | grep -v tune2fs

Note: You can just type tune2fs -l /dev/sda1 and look through the output for the desired info if you like.

Then continue with the rest of the instructions you posted.

tune2fs commands

awk for loop

Note: In the 2nd for loop above, the "sudo" in front of "tune2fs -l" may not be necessary.

Also in the "alternatively" section, if you have trouble running the commands, try adding "sudo" in front. Example: sudo fdisk -l

Wow, lots of useful suggestions. Thanks so much, everyone, for responding.
I love Daniweb! Will have to post back if/when I get the task completed.

Well, I did get a bit further in the process, thanks to all your suggestions. However, I was not able to mount any partition, as nothing indicated any partition existed, in all my searching.

Is there anyone who is willing to work for hire on this project? The ultimate goal in this thing is for me to get a new password for root (part 1) and download all the existing files to a new server (part 2)....one with cpanel so I can better manage this client.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.