Last night after I wrote the blog entry about my failures with the vi editor I was lying in bed rehashing the situation. It occurred to me that I was attacking the problem all wrong.
I was not thinking like a command line guru. There are many ways to edit a file, only one of which is to do so locally with vi. For one thing, I could transfer the file to this machine and edit the file in a gui editor. What a genius! I will do that tomorrow, I thought. With that, I fell asleep.
This evening, as I started to work on this problem, I was confident that I had logically solved the issue. All I had to do was copy the file over. For that part of the problem I used scp. That command worked flawlessly. I edited both the interfaces file and the hosts file. I then saved both files and ran scp again to copy them back.
Permission denied.
I can tell that I am not thinking *nix yet. Of course. After viewing the files with the 'ls -l' command I could tell that when I saved the files, they were saved under my username and group.
I seem to recall a unix command that would change the permissions of files. There must be one to change the ownership as well. After some digging I found the chown command. I changed the owner and group to root and ran the scp command again.
Permission denied.
OK, that's cool. I'll bet that I need to be root when I transfer the file. I change to rrot with the sudo command and run scp yet again.
Permission denied.
Hmmm. Maybe I need to copy the files from the remote machine to the local server. That means attaching a monitor and keyboard. Well, it is still better than using vi. I attach the hardware and run scp from the server.
Permission denied.
Damn! Looks like I am going to have to use vi after all. But wait. Aren't there other editors on the machine? I seem to recall that unix is famous for numerous versions of everything. I look around and find a text editor called nano. Since I have the keyboard and monitor attached to the server I run nano and modify the interfaces file and save it as I exit.
Permission denied.
DAMN! (You know the window glass in my office does need to be replaced. Maybe I should gently toss the server.... Nah...)
Wait! I ran nano as a normal user, not root. This time I run 'sudo nano interfaces' and begin to modify the file. I attempt to save the file and IT WORKS! Woohoo!
I finish the interfaces file and then make the necessary changes in hosts. I reboot the server and all is well.
I can tell that it will take some time to think like a *nix geek. It should be fun along the way though.