Re: [wlug] hosts file

David wrote Hi After playing with my networking settings in Breezy, I seem to have lost some data from my /etc/hosts file. Partly it requires editing to add to add "ubuntuDavid" to it. However without it I can't log in as root to edit it. Can't find password! I can't edit it with Knoppix, I don't have permission. Is there any way to edit it or is it a reinstall job. As it is I can't connect to the net or anything requiring root privilege. Thanks David Bowen
Shane wrote:
Hi Dave, The file probably needs permissions changed for it to be edited under knoppix chmod a+w /mount/drive/etc/hosts
If this still doesnt work, its time to boot to single user mode <g> This should give you some direction from http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/s1-resc...
Select Ubuntu with the version of the kernel that you wish to boot and type e for edit. You will be presented with a list of items in the configuration file for the title you just selected.
Select the line that starts with kernel and type e to edit the line.
Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.
Back at the GRUB screen, type b to boot into single user mode.
Then edit your file
Regards Shane
*Thanks Shane. Changing the permissions worked. Thinking about it My command was probably trying to execute the file rather than open it and root did not have permission to execute it. I will look at the book I have at work to look into that next week. Then I can change the permission back again! I have to admit I tend to use command line only when necessary, but I am starting to get the hang of it Thanks all for the help. *
Here's a possibility:
root doesn't have a password set at all under ubuntu. Instead, log in as your user and run 'sudo nano /etc/hosts', and enter *your* password in. This assumes that your account is the first one that was created when you installed the machine.
If this doesn't work, it possibly means that more than the hosts file has become corrupted. Consider upgrading to dapper at about this point.
*Nope that didn't work either Fortunately the message at boot pointed to /etc/hosts and I just basically copied it from my dapper install and it all worked.*
I can't edit it with Knoppix, I don't have permission. Is there any way to edit it or is it a reinstall job.
With knoppix you'd still need to run a root terminal, instead of just the normal one.
*Yup I had tried that*
------------------------------
Message: 4 Date: Sun, 16 Jul 2006 10:49:27 +1200 From: zcat <zcat(a)wired.net.nz> Subject: Re: [wlug] hosts file To: Waikato Linux Users Group <wlug(a)list.waikato.ac.nz> Message-ID: <44B970F7.4020706(a)wired.net.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
With knoppix you'd still need to run a root terminal, instead of just the normal one.
You also need to mount the filesystem read-write, knoppix defaults to mounting things read-only.
The GUI way; right-click the icon for your filesystem, unmount if it's already mounted, then chose the option for mounting read-write.
The root-terminal way; mount /mnt/hda1 -o remount,rw (I forget exactly where knoppix mounts things and /mnt/hda1 is a guess... substitute the actual mountpoint here)
And as Daniel says, you'll need to edit the file as root too.
*Yup I had done that, It was HDA3 as it is dual bootede with that other OS*
------------------------------
participants (1)
-
David Bowen