The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
dhclient.conf - moving a file to the web server. changing owners (chown) 16 October 1998
Need more help on this topic? Click here
This article has no comments
Show me similar articles
In this section, I detail how I copied a file to my webserver and then changed the permissions on it so it could be published.
16 October 1998
Today I received an email asking about my /etc/dhclient.conf file.  So I decided to publish it.

I use FrontPage 98 on my NT1 box,  so the first step was to get the file from my FreeBSD box.  It was easy enough to find the dhclient file.  But it was much harder to find out where my web server files where.  I knew the location would be specified in httpd.conf, but I couldn't even find that.   My first stop was my virtual host notes for Apache.   I found out that the file I wanted was:

/usr/local/etc/apache/httpd.conf

In this file, I found a reference to DocumentRoot which contained this value:

/usr/local/www/data

I now had my destination directory.  I copied the file:

cd /usr/local/www/data
cp /etc/dhclient.conf dhclient.htm

I then went to NT1 and opened my browser and navigated to the home directory of my webserver and typed:

http://FreeBSD/dhclient.htm

And I received the dreaded Forbidden message:

Forbidden

You don't have permission to access /dhclient.htm on this server.

It's all about ownership
I was confused.  Is the file there?  Yes it is.  I tried to navigate to

http://FreeBSD/dhclientx.htm

And received a different message:

File Not Found

The requested URL /dhclientx.htm was not found on this server.

OK.  This is making sense.  It must be a permission thing.  Just like the original message said.  So I did an ls -l to see what I saw:

-rw-r----- 1 root   nogroup  377 Oct 16 18:27 dhclient.htm
-rw-r--r-- 1 nobody nogroup 4466 Sep 27 09:48 default.htm

At first I thought it was the permissions.  Then I thought it was the owners.   So after some discussion and much experimentation, I found that what I needed to do was:

chown nobody dhclient.htm

That allowed me to read the stuff using my browser.  And the contents appears below.

The clever amongst you will see that I was doing this as root.  Not a good idea.   I know.  I know.  But here's how to avoid that by using su.

Here it is, with some thing changed to protect the innocent.  Note the extra space within the quotes at the end of the domain-name line.  Note that although I mention the supersede command in resolv.conf is being modified, and not by me, it is not included below.  I have no idea why that is.   But I know the below worked for me.
timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
script "/etc/dhclient-script";

prepend domain-name "www.example.org ";
prepend domain-name-servers 127.0.0.1;

interface "ed0" {
        request subnet-mask, broadcast-address, routers, domain-name-servers,
        domain-name, host-name;
        require domain-name-servers;
        media "link2";
}

Hope this helps.


Need more help on this topic? Click here
This article has no comments
Show me similar articles