I sent Scott Adams an email outlining my desire to have the course deal with Linux, Samba, and possibly Apache or Perl.
Scott replies, favors Linux/Samba project, suggests books (Essential Systems Administration, Using Samba, Apache the Definitive Guide, Running Linux), and emails me information about Linux partitions:
4gig disk:
/ 500mb
/var 500mb
/usr 1gig
/home1.8gig
/tmp 200mbas linux swap space
I start exploring Metalab’s Linux Archive. Then I began looking for Linux installation instructions online, using Google, and the Linux Documentation Project however, everything I read seems to take for granted that I had a CD-ROM distribution of Linux, which is exactly what I didn’t have. I thought since I could download an entire distro in seconds from the Metalab FTP site, I would then be able to install it on my FAT32 formatted secondary hard drive. However, my situation seemed to be the exception, and thus I was unable to get started. In the very early morning I was searching the RedHat site, and I found out that I would need to choose a boot disk image from the /images directory on any RedHat mirrored FTP site, and that I would need to copy this image to a floppy and boot from it. The article even insinuated that I would be able to install directly from an FTP site, which is exactly what I wanted to do. At this point it was late. I went to bed.
After reading the RedHat download information again, I downloaded rawrite.exe as well as the bootnet.img boot disk image file that would allow me to install RedHat Linux 6.2 from the Metalab ftp site. So I put rawrite and bootnet.img on my C:\ drive, I ran it, and told it to use bootnet.img and to copy the file to A:\. It failed, telling me that there was a Bad Sector Detected. So I tried another disk. It failed. I tried another disk. It failed. I tried a fourth disk. It failed. So I began look for rawrite complaints on the Internet and I found some, however, they all seemed to imply that it was either the poor quality of the floppy disk (all four of them?) or the nonstandard floppy drive that was messing up somehow. At that point I decided to look for help, so I sent a message out to my Residential Computing Consultant listserv. I immediately got a reply from one Linux enthusiast who told me rawrite was probably flaky, and that he would burn me an ISO copy of RedHat. I also described my system, that I wanted to install Linux on my secondary 6GB hard drive that was attached to a Promise Ultra-66 controller card, and he immediately recognized that I’d need a distro that supported the Ultra-66 drivers, which RedHat did not. He suggested Linux-Mandrake, a RedHat+extensions distro that he’d burn for me instead.
While I waited for my custom burned copy of Linux-Mandrake, I downloaded another bootnet.img file, this time using an ftp client program, and I noticed immediately that the file was smaller than the one I downloaded the day before. This file was 1,474,560 bytes while the previous file was 1,480,050 bytes. I immediately tried rawrite with the slightly smaller file and it worked this time. I realized that the larger and error-prone bootnet.img file that I downloaded through Netscape was treated like an ASCII file (instead of binary), and this affected its file size. Having figured out the boot disk problem, I downloaded the Linux-Mandrake network.img boot disk image, copied it to a floppy, and rebooted my machine. It booted from the floppy, revealing a fancy picture of the Mandrake star with a Linux penguin. I pressed Enter to install and followed the preliminary instructions until it came to the part where it asked for my network information and FTP site. No matter what I did, I could not get the installation program to connect to the Metalab FTP site. Though I’m not certain, I assume it had to do with the DHCP issues that affected me several days later.
I finally got that copy of Linux-Mandrake from my friend. I made a boot disk using rawrite and cdrom.img, and then I booted my computer off of it, with the CD-ROM in the drive. I chose the custom installation route and proceeded to answer the configuration questions to the best of my ability. I had the installation program partition my 6GB hard drive like this:
/ 2249
/home 1999
/usr 999
/var 698
swap 249
The installation finished and I rebooted the system. I chose ‘linux’ from the GRUB boot manager, and Linux-Mandrake started to boot, until it reached this line:
INIT: Entering Runlevel: 3
I actually went away from the computer for about an hour and it was in the same place when I returned. It did not allow me to press Ctrl-Alt-Del, therefore I pressed my computer’s reset button. When it booted this time, it warned me that several filesystems were not cleanly unmounted, and then it locked in the same place, at INIT: Entering Runlevel: 3. I tried to boot with a linux boot disk, I tried failsafe mode, I tried rescue mode, but it always locked at that same place. I decided to reinstall the OS and default to the installation defaults. During the second installation, the partitions were:
/ 3499
/home 2448
swap 250
The installation was successful and Linux booted and continued past “INIT: Entering Runlevel: 3” until it got to the line:
Bringing up interface: eth0.
It hung here for 2 minutes and then printed a red [FAILED] message to the screen and continued to boot into Gnome. I assumed that I needed to configure Linux for the UNC network so I didn’t think much of it at the time. Using my laptop, I looked up a ResNet Linux documentation page written by another RCC friend of mine, so I went there and followed the instructions. When I typed ifconfig eth0 in a terminal window, I did get information about my Ethernet card, a 3C905B-TX 10/100Mbit, including its hardware address, so I assumed that the drivers were working correctly. However, when I looked through linuxconf to see if the card was set up for DHCP (it was), it wouldn’t let me activate the changes. I decided to speak with Cheryl Elia, a ResNet employee, and she allowed me to use a static IP to test my machine. As soon as I assigned myself the static IP, I had no problem pinging machines or visiting websites, but as soon as I tried to configure my system for DHCP, it wasn’t even able to activate the changes let alone get a lease from the DHCP server. I emailed Scott, and he sent me a link to the DHCP mini-HOWTO which I read through but really couldn’t figure out if or how it applied to me. After emailing a few other people, I gave up for the night.
After paying more attention to the eth0 problem at bootup, I notice that it was quickly spiting out this message: "Determining Information for IP via dhcpcd failed." I found out that dhcpcd was a client daemon that was responsible for obtaining and renewing my DHCP lease from UNC. The wording of the error message clearly pointed to a problem with dhcpcd not being able to get a lease from the server, not a problem with my card or my drivers or the DHCP server itself (which is what others were suggesting). I still didn’t know what to do, after many hours of reading through Linux related newsgroups and searching similar problems.
Not knowing exactly how to fix things, I decided to reinstall Linux-Mandrake for a third time, making sure to pay special attention to the network configuration segment. As it had before, it asked for an IP address or allowed me to push a button for DHCP. I made sure the IP address field was blank, I pressed the DHCP button and the installation process continued as it had both times before. This did not solve the problem. On another note, I found out through Cheryl Elia that the Triangle Linux User’s Group was planning on having a Linux InstallFest on the UNC campus, July 22nd. I signed up with the hope that someone in the group might be able to assist me, and I also mentioned, in signing up, that I was having trouble with DHCP/dhcpcd.
I got an email from Ed Hill, a UNC grad student and head of the TriLUG. He offered to help me with my DHCP problems over the phone, as he happened to be dealing with the same issue on another computer on campus. First, he had me download pump, a replacement for dhcpcd that RedHat uses. Then he showed me how to install it using the command:
rpm –Uvh pump-0.7.8-1.i386.rpm
and presto, it installed. Then we issued the command:
/sbin/pump -i eth0 -h hostname
it dropped back to the command line and I was able to ping www.unc.edu. It worked! For the time being he had me put that command in my /etc/rc.d/rc.local file which he told me was the last script run at boot up. Even though eth0 still tells me that it fails during boot up, pump comes in when the rc.local file is run, and now at least I have a connection to the Internet.
I emailed Scott and decided that the course’s scope should probably be limited to Linux and Samba, as learning Linux has been requiring a lot of overhead. I also inquired about editing scripts in hopes that I might be able to stop eth0 from failing during boot up—I realize that putting “/sbin/pump -i eth0 -h hostname” in the rc.local script was a superficial solution, and I wanted to try to get to the cause of the problem. I also thought that I had seen a file once, that had the words dhcpcd and pump right near each other. After poring through the /etc directory and its subdirectories, I found my script: ifup. Inside were the lines:
if [ -n "$DHCP" -a -z "$DHCP_CLIENT" ];then
if [ -x /sbin/dhcpcd ];then
DHCP_CLIENT=/sbin/dhcpcd
elif [ -x /sbin/dhclient ];then
DHCP_CLIENT=/sbin/dhclient
elif [ -x /sbin/dhcpxd ];then
DHCP_CLIENT=/sbin/dhcpxd
if [ -x /sbin/pump ];then
DHCP_CLIENT=/sbin/pump
else
echo "Can't find a dhcp client"
exit 1;
fi
fi
which I elegantly and intuitively edited to look like this:
if [ -n "$DHCP" -a -z "$DHCP_CLIENT" ];then
# if [ -x /sbin/dhcpcd ];then
# DHCP_CLIENT=/sbin/dhcpcd
# elif [ -x /sbin/dhclient ];then
# DHCP_CLIENT=/sbin/dhclient
# elif [ -x /sbin/dhcpxd ];then
# DHCP_CLIENT=/sbin/dhcpxd
if [ -x /sbin/pump ];then
DHCP_CLIENT=/sbin/pump
else
echo "Can't find a dhcp client"
exit 1;
fi
fi
Thus I hoped that this would force the ifup script to use pump and ignore the other dhcp clients that were installed on the machine. I saved the file, rebooted, and for the first time, Bringing up: eth0 was [OK]!
This week I played with Linux, exploring the Desktop Environments (KDE, Gnome) looking at webpages with Netscape for Linux and trying to read Essential System Administration.
As I was logging out of KDE, the mouse cursor shot up to the upper right-hand corner of the screen and the system locked up. I couldn’t find any key combination that would get me out of KDE. I was forced to power down the system. When I restarted it, the filesystems were all messed up and it booted into single user mode. I didn’t know what to do, so I just shut the system down.
Today I went to the TriLUG’s Linux Installfest in Gardner hall. It was raining, so I decided to bring my laptop. I was there from about 11a to 2:30p, and in that time, I had someone walk me through an installation of RedHat on one of my laptop’s 6GB partitions. The TriLUG members were full of knowledge and experience, and advised me on how to partition the drive, how to configure XF86Config for the Thinkpad, and they also showed me how to disable FTP and telnet services and install OpenSSH. I knew about the telnet vulnerabilities through a ResNet document so I was very eager to secure my system. In the file /etc/inetd.conf we commented out these lines:
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
and then we proceeded to download these files from an OpenSSH ftp site:
openssh-2.1.1p4-1.i386.rpm
openssh-askpass-2.1.1p4-1.i386.rpm
openssh-askpass-gnome-2.1.1p4-1.i386.rpm
openssh-clients-2.1.1p4-1.i386.rpm
openssh-server-2.1.1p4-1.i386.rpm
openssl-0.9.5a-1.i386.rpm
and then we used the command:
rpm –ivh open*
to install them all at once.
Now at least my laptop has Linux running operationally, but I made sure to break it. I decided to try and change my userID from Jwatt to jwatt and once I started rummaging roughshod through files, I couldn’t figure out how to reverse the process. In the end I decided to reinstall RedHat 6.2 on the laptop, seeing as though I had just seen it done the day before. But, there is nothing harder than trying to remember the steps that someone else takes when working on your computer. In particular, I couldn’t figure out exactly how they had partitioned the hard drive for me (even though I had been sitting right next to the guy) so I took some guesses, and everything seemed to work, except for the video card/graphics configuration. I remember him very slyly downloading a working copy of XF86Config for the Thinkpad 600X using Lynx—and of course everything worked fine for him. Except this time I couldn’t get it to work for the life of me. I had no problem with the command line, but I couldn’t get Xwindows/Gnome running again.
Since my only problem with the laptop was getting the LCD panel configured correctly I had the delusion that I should try and install RedHat on the desktop. I felt Mandrake was flaky in allowing those dhcpcd problems to crop up, whereas RedHat worked from the start (with the experienced advice of a TriLUG member). I was also turned off from Mandrake because of the problems I had with KDE that crashed the system beyond my ability to fix it. So I tried to get around the Ultra-66 problem by using a ultra66 boot image from Promise. However, that boot image was over a year old and it did not work for me. I thought maybe I could plug my hard drive back into the motherboard, install RedHat, recompile the kernel with the ultra-66 drivers, and then plug the hard drives back into the Promise Ultra66 controller card, but that was too complicated for me alone. So I gave up.
I reinstalled Linux-Mandrake on my desktop, opting for the Gnome workstation defaults.
I decided that I needed a book better suited to Linux than Essential System Administration (which I found hard to absorb without a good Unix/Linux foundation) and I happened to come upon the 3rd edition of the O’Reilly book, Running Linux in the Undergraduate library, so I checked it out.
Today I decided to make Linux work for me. I booted up Linux-Mandrake on my desktop computer, I installed pump, commented out the dhcpcd/dhclient/dhcpxd lines from the ifup file, I commented out FTP and telnet from the /etc/inetd.conf file, and I installed OpenSSH. In ten minutes I was back to where I was when I last left the system. I decided to stay out of the graphical user interface (though I had installed Mandrake as Gnome workstation this time around) because it just provided too much distraction and room for error. The command line, in my opinion was solid and stable. But I needed to be able to access my email, and for whatever reason, telnet and ssh were not working for me. With telnet, when I logged onto Isis and chose 2 for email (Pine), the screen would quickly scroll back to the menu of options. This is where I found that it helped to have access to the listserv of a Linux User’s Group. I posted the problem, and within minutes someone mentioned that my term variable might need to be xterm. So at the command time, on a hunch, I typed TERM=xterm and from then on, telnet worked. I also asked the listserv about how I could find out what version of samba was preinstalled on with my distribution, and again, within minutes they replied with this command:
rpm –qa | grep –I “name”
where “name” equals part of the string that I am looking for, in this case, “samba” and I discovered that I had samba 2.0.6. Seeing as though the most recent rpm is version 2.0.7, I figure 2.0.6 was good enough.
I realized that the reason I installed SSH was so that I would stop using telnet, which we know, sends passwords unencrypted, so I tried the command:
ssh isis.unc.edu
which worked (assuming I set TERM=xterm beforehand) but the second time I did this, it barked at me with this warning: “WARNING: POSSIBLE DNS SPOOFING DETECTED!” because (as I found out again from the TriLUG listserv) the domain name isis.unc.edu is actually a group of machines with different IP addresses, and that one is assigned at random when logging on. Of course when I got this error, ssh does not let me login, which effectively disables ssh for me. Then one of the TriLUG members suggested that I use a script like this: (I have slightly modified it)
#!/bin/sh
NUM_HOSTS=8
MY_UNC_NAME=jwatt
PATH=/usr/local/bin:/bin:/usr/bin
TERM=xterm
CT=$(($RANDOM%$NUM_HOSTS))
exec ssh $MY_UNC_NAME@login$CT.isis.unc.edu
so that the domain name includes the login# and keeps SSH from thinking that I’m the victim of DNS spoofing. I saved the script as “isis” in my /bin and now all I have to type is “isis” and then my password to login.
I started reading the Using Samba book to see if I could get samba working. My hope was that with my laptop running Windows 98, I would be able to share files with my desktop running Linux. I added this line to the /etc/services file:
swat 901/tmp
and I added these three lines to /etc/inetd.conf:
swat stream tcp nowait.400 root /usr/sbin/swat swat
netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd
The book advised using SWAT, the Samba Web Administration Tool by accessing the url http://localhost:901. Using SWAT, I was able to graphically set up a test fileshare in the Spencer group (the name of my dorm) that pointed to /export/samba/test (a directory I had created). I made sure that Windows 98 (on my laptop) was configured for my Linux UserID, but there was very little to change because I didn’t have to worry about setting up WINS, DNS or a static IP address—I was already configured for the UNC Network. Using the Network Neighborhood, I found my Linux box named “Bishop,” but when I double clicked on it, it prompted me for a password for IPC$. I realized that I had not finished configuring Samba, so I added this line to the smb.conf file:
encrypt password=yes
(because Win98 sends encrypted passwords) and then I issued the command:
smbpasswd –a jwatt
to add an encrypted password entry to the /etc/smbpasswd file. Several moments later, I went back to my laptop, and I was able to browse and even add files to the test shared drive that I had created. It worked!
I then went back through the smb.conf file, instead of using SWAT, and I set up some shares that related to my mounted windows hard drive on the desktop. That way, using my laptop running Windows 98, I could access files on my Windows 98 hard drive using Samba running on Linux! I also read further through the various configuration options in order to secure my files (and my machine) from the world. My current /etc/smb.conf file is below:
[global]
netbios name = BISHOP
server string = Samba %v on (%L)
workgroup = SPENCER
hosts allow = 152.2. localhost
encrypt passwords = Yes
log level = 2
log file = /var/log/samba/log.%m
max log size = 1000
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
[music]
comment = some music files
path = /mnt/windows/music/music
read only = yes
valid users = jwatt, justinwatt
[downloads]
comment = umm my downloads
path = "/mnt/windows/My Downloads"
read only = yes
valid users = jwatt, justinwatt
[everything]
comment = windows hard drive
path = /mnt/windows
read only = yes
valid users = jwatt, justinwatt
I read through the relevant information in the Samba book, so I decided to return to the Running Linux book which I really hadn’t really touched since I borrowed it from the library. I read nearly a quarter of it and took several pages of notes for later reference. I learned about Filename Expansion, Redirection, Pipes, File permissions and File compression and archiving. I found it to be much more accessible than the Systems Administration book, and very easy to understand after having played with Linux for almost a month. I also installed a program called PuTTY on my laptop so that I could securely logon to my desktop computer running OpenSSH and be able to test out the Linux commands while laying on my bed.