Linux Server Diary

The trials and tribulations of a Linux newbie trying to setup a home server.

Friday, November 17, 2006

Great Web Resource for Samba

I found this page that outlines how to do what I just did in v.5.10.

http://www.howtoforge.org/samba_setup_ubuntu_5.10

More Samba Setup

It seems to be working OK. I can create files and directories in my new share, and the groups and permissions look good.

However, my guides are telling me that a little more setup is needed.

Enable WINS host resolution
Edit /etc/nsswitch.conf and change hosts: files dns to hosts: files wins dns
Add the root user to the SAMBA password database
sudo smbpasswd -a root
Setup the Adminstrator alias in /etc/samba/smbusers
sudo echo "root = Administrator" > /etc/samba/smbusers
Setup the default domain groups for windows
sudo net groupmap modify ntgroup="Domain Admins" unixgroup=root
sudo net groupmap modify ntgroup="Domain Users" unixgroup=users
sudo net groupmap modify ntgroup="Domain Guests" unixgroup=nogroup
Restart the service daemon
sudo /etc/init.d/samba restart

Unless I want to setup a printer someday, the Samba config should be done.

Labels:

Setup the Other Users

For each family member, I created the user in Linux, set the password, and added them to Samba.
sudo useradd username -m -G users
sudo passwd username
sudo smbpasswd -a username

No worries!

Labels:

Thursday, November 16, 2006

Samba Work - It's Easy This Time

I started with the smb.conf file from the old server without the [homes] section.

[global]
workgroup = GENTRY
server string = Ubuntu-Samba %v on %L

security = user
encrypt passwords = yes

wins support = yes

local master = yes
preferred master = yes
domain master = yes
os level = 95

[files]
comment = Shared Files
path = /export
create mask = 0775
directory mask = 0775
force group = users
read only = no
hide unreadable = yes


Next, I created the /export folder in / and set the file permissions and group.
sudo mkdir export
sudo chmod 0777 export
sudo chgrp users export

Finally, I added my user in Samba
sudo smbpasswd -a username

Now, it's time to restart Samba and try to connect.
sudo /etc/rc.d/init.d/smb restart

Well, the restart command isn't working. How about:
sudo /etc/init.d/samba restart

That worked much better. Let's try to connect.

Worked like a charm! I was able to connect, create a folder, and create a file. Both had the correct permissions and group settings. Sweet!

That's all for tonight.

Labels:

Sunday, November 12, 2006

Do Over

Now, I get to redo what I did before.

Assign a Static IP
Setup SSH
Repository Updates
Software Updates
SSH Configuration Changes
Install Samba

No problems. I did notice that I had another, simpler editor already installed called nano. It looks to be much easier to use for a person like myself raised on MS-DOS rather than Unix.

Also, with Samba providing a WINS service, I don't need to use a hosts file on the clients to resolve the server name to an IP.

Labels:

GRUB Error 18

OK, so I installed on the 250GB drive pretty much choosing all defaults. At reboot, I never got past GRUB, which failed with the dreaded Error 18.

A little research (I love the Internets) told me that the kernel resided in an area that can't be seen by the BIOS. The consensus seems to be that I need to setup a /boot partition at the beginning of the drive. (see here and here)

So, I'm starting over ... again.

(I can't tell you how many times I've tried using the wrong keyboard to answer prompts for the install. Having two of them is confusing!)

DISCLAIMER!! If you don't know much about partitions (like me), don't follow my instructions. This is more of a journal than a tutorial. It is likely that I will screw up something, and I don't want your loss of data on my conscience for the rest of my life. However, if you do know about such things, please critique my attempt in the comments.

I ran the normal install, except for these changes to the partition step:
When the first partitioner screen is displayed, choose Manually Partition Drive
Scary, but I'll try it
Delete the existing partitions
It's probably possible, and even preferable to do this without starting from a clean slate, but since I haven't done anything to the box yet, I'm not losing anything. If you don't know what you are doing and have something to lose, DON'T DO THIS!
Start creating new partitions
I selected the FREE SPACE for (hda)
The /boot partition
I'm using 300MB, Primary, Beginning, Ext3, /boot, and the bootable flag on
The main partition
245 GB, all defaults
The swap partition
Set 'Use as:' to swap area
Finish Partitioning and Write Changes to Disk
Here goes nothing!

Well, what do you know. It worked! (If I weren't such a refined gentleman, I'd type the expletives that flew out of my mouth when I saw the login prompt.)

Forget what I said earlier about not knowing about partitions. I'm an expert!

Labels:

Dress Rehearsal

OK, so I've had a bit of a setback, not a big thing, but I do get to start over.

I spent yesterday doing some hard drive jockeying, and I now have the 250GB drive ready to put in the server. However, the Compaq case (why do I keep working with old Compaqs?) uses a non-standard drive mounting system, so there was no way to install the drive. Executive decision time, I decided to remove the 6.4GB drive already in the computer (the plan was to host the operating system there with the data files on the 250GB), and just use the 250GB for everything.

However, nothing goes easy with a Compaq. The BIOS still reports 6.4GB, while the Ubuntu partitioner is seeing 250GB. I haven't hit the go button yet, but I really have nothing to lose. The worst that could happen is that it doesn't work or it reports much less than 250GB. If so, I'll punt!

Lucky for me that I have documented my steps thus far in this diary. Back to step 1.

Labels:

Sunday, November 05, 2006

Installing Samba

It just took one command to install everything I need for Samba (at least, what my Ubuntu Hacks book tells me I need).

sudo apt-get install samba samba-doc libcupsys2 libkrb53 winbind smbclient cupsys-common samba-doc-pdf smbfs

Apt-get also threw in the samba-common package. In addition, it suggested smbldap-tools, but I'm going to wait and see if I need it.

The daemons have been started. Now it's time to wade through the configuration file.

Labels:

Planning for Samba

I'm going to install Samba today, but I haven't really decided how I will set things up. My first task was to read the old posts from last time.


It was important at the time to allow each user to designate some files as public and others as private, and I also talked about having files viewable to only my wife and I. However, no one else but me knows how to do that, and no one seems to care. I myself haven't used that feature, except for testing. This time, I may setup just one user that we all share.

With that change, I won't need to (or be able to) setup a Home directory for each user mapped to H: on the clients. Once again, no one cares.

This could be easier!

I'm going to review the smb.conf file from the existing server today, and install the software on the new one. We'll see how it goes.

Labels:

Saturday, November 04, 2006

SSH Configuration Changes

I've been reading that a couple of the default SSH settings in Ubuntu may need to be changed.

First, remote login for root is enabled, so I turned that off. Also, since I won't be running remote graphical applications, I denied X11 forwarding.

The settings are found in /etc/ssh/sshd_config.

Change:

PermitRootLogin yes

To:

PermitRootLogin no

And Change:

X11Forwarding yes

To:

X11Forwarding no

Save the file.

Finally, use the following command to restart SSHD.

sudo /etc/init.d/ssh restart

Labels:

Software Upgrades

This command will check for patches and fixes for the operating system and installed software:

sudo apt-get upgrade

Since I just installed yesterday, it found no updates today.

Labels:

Repository Updates and New Editor

I modified /etc/apt/sources.list to include the 'Universe' repositories (by uncommenting those two lines), and then ran an update add the packages to the catalog.

sudo apt-get update

No issues.

Next, I installed a different editor called JED so that I could escape VI.

sudo apt-get install jed

I've only tried it once, but it looks to be a little more intuitive for me.

Labels:

Headless? No Problem - But I Need a Keyboard

After setting up SSH and testing, I disconnected the monitor and keyboard and did a shutdown/restart. Nothing.

I reconnected the monitor to see the error, and found that the machine wasn't going to boot up without a keyboard. I went through the BIOS setup screens, but couldn't find a setting to stop the test. I guess this Deskpro wasn't designed to be a server. :)

After reconnecting the keyboard, it booted without a monitor just fine.

I think I'll look for some sort of dongle that can look like a keyboard, but for now I'll just keep one plugged in.

UPDATE:

This link offers instructions for a DIY keyboard dongle. I'll give it a try.

http://archives.neohapsis.com/archives/openbsd/2003-12/1112.html

Labels:

Hosts

For some reason, I am unable to modify, rename, or replace my hosts file in XP. I get the error:

Access to C:\windows\system32\drivers\etc\hosts denied

This happens when logged on as a user and as the administrator, so I'm thinking that some program is using the file.

My solution was to boot into safe mode, login as administrator, and edit the file.

Labels:

Setup SSH

SSH allows me to open a command window for the server from a remote machine. It only took one command to install the software.

sudo apt-get install openssh-server

The install program asked for the CD.

I connected from my desktop machine using PuTTY, and it came up the first try!


Click for full sized screen

Labels:

Friday, November 03, 2006

Assign a Static IP

To assign a static IP in Ubuntu, modify the file /etc/network/interfaces.

But first, pick an address that is not in the pool used for your DHCP server (probably in your router - the user manual should help you with this). The gateway should be set to the router's internal network address. It is likely that your settings will differ from mine.
Get the current settings
ifconfig eth0 (Note the Mask setting)
Open the file with VI
sudo vi etc/network/interfaces
Find the primary network interface configuration
auto eth0
iface eth0 inet dhcp
Change to the static settings
auto eth0
iface eth0 inet static
address 192.168.254.1
netmask 255.255.255.0
gateway 192.168.254.254
Save the file
Restart the network interface
sudo /etc/init.d/networking restart
Check the interface by pinging your router
ping 192.168.254.254 (use your gateway address here - CTRL-C to stop the ping)
Alternatively, you can ping a public server, such as Google
ping www.google.com

Now that a static IP is assigned, add a line to the hosts file on the client machines to assign a name to the server. (If you are using a local DNS, you're way beyond my level!)

NOTE: I should note that I really hate the editor VI. As soon as learn about another command line editor, I'll never use it again. Until then, I'm using this cheatsheet page of commands.

Labels:

Step 1: Install the Operating System

Ubuntu makes things pretty easy. I popped in the CD, powered up, answered a few questions, and I'm up and running.

The first things on the list are to:

  • Assign a static IP address
  • Setup SSH for headless operation


So these are my weekend tasks.

Labels:

New Server Project

Since building a new desktop machine for my son this summer, we've passed his old machine to my daughter and her machine is now available to become the new file server. (I'm ready to retire the original Compaq server, since it always takes a few tries to boot up after a power outage.) I'll be installing a 250GB drive in the new box (also a Compaq) to give us a little breathing room.

The operating system this time will be Ubuntu 6.10 Server Edition.

I've been reading through the old posts, and I'm glad that I documented all of my hints and trials from the first go-round. This should make this install go a little easier.

Labels: