Friday, May 9, 2008

Permanently mount a Samba (or Windows) share in Linux

Samba shares are easy enough to browse to, with the gui, but it's a lot more convenient having it mounted in a local folder. Also, I've found many programs that aren't able to see samba shares, even though the OS can.

First, let's test and see if it will do a temporary mount with this command....

mount -t smbfs //servername_or_IP/file_store /home/user/Desktop/file_storage
Use sudo above, if you're using Ubuntu, or other distros that don't have root active by default.

This will prompt for username and password. Enter one if necessary, or leave blank if you have anonymous access. Once you enter credentials, you should be able to browse to your local folder and see all your files.

To mount it permanently, you will have to add a line to your file /etc/fstab.
This file is what tells Linux what drives you want mounted on bootup. Use gedit, nano, or similar program of your preference to open and edit fstab. You need to add a line similar to these, depending on your exact setup......

For anonymous access, add a line like this. Your Samba share has to be setup to allow anyone to access it. (I'll provide that config at the end) This allows you to mount the share without providing credentials.

//servername_or_IP/file_store /home/user/Desktop/file_storage smbfs guest

To mount a samba share with credentials, you just need to provide the username and password like so.

//servername_or_IP/file_store /home/user/Desktop/file_storage smbfs username=username, password=password

If you're a security nut, or just plain paranoid, you may want to provide your credentials in a separate file.

//servername_or_IP/file_store /home/user/Desktop/file_storage smbfs credentials=/root/.smbcredentials

You can also place dmask=777, fmask=777 at the end of the fstab line to alter the credentials it mounts the folders and files with.

Here's how a typical samba share configuration should look to access it anonymously. This is typically stored in the file /etc/samba/smb.conf

[global]
workgroup = workgroup_name
local master = yes
preferred master = yes
netbios name = storage
server string = storage
security = SHARE
max log size = 1000
dns proxy = No
wins support = Yes
wins server = localhost

[File_Storage]
comment = file-storage
path = /mnt/hda/share/file_storage/
read only = No
writeable = Yes
create mask = 0777
directory mask = 0777
guest ok = Yes

In the global section, "security = SHARE" is the main key to anonymous browsing.
The other line that's key is in the individual share cofiguration of File_Storage.
"guest ok = Yes"
Without those two lines, you'll be banging your head against the wall for hours trying make your share work for anyone, without requiring credentials.

Note: This really isn't the best way to do things as far as security goes. But in my case, convenience wins over security. I have a firewall. My wife wants quick easy access to a large storage drive, as do I. I don't feel the data we're storing on there is of high value to anyone else. But, you'll have to evaluate these things for yourself.

Wednesday, May 7, 2008

The high price of running "legacy" hardware.

A lot of people seem to stick with their old hardware because they can't afford new hardware, or they think it's too expensive to buy / build a new computer.

Let's say I have a system with a Pentium 3 Processor that requires pc133 memory required by that architecture. Most likely, the system will have very little memory, especially by today's standards. If you go to a site like Newegg, $50 may at first look like a bargain for 512MB of memory. That is, until you look at prices of newer types of ram and realize you can get 2GB of DDR2 for the same price. It's almost impossible to find 1GB modules of memory for these older systems, as that was unheard of at the time. Even if you were able to find them, most motherboards at the time didn't support that large of memory modules. Then you start to look around at prices of everything else, and realize that computer components are dirt cheap these days. You can get a dual core AMD processor that will completely smoke your ol' P3 for a mere $56. Of course you'll have to get a motherboard and memory that will go with the processor, but you can get a Foxconn or similar motherboard with everything (sound, video, NIC) integrated for around $50.

Most likeley, you're waiting around a lot with your current system, especially if you're trying to run a more modern OS than Windows 98. Trying to upgrade your old system just isn't worth the price and hassle, for the amount of processing power you're going to end up with. New components are typically much more power efficient than old components as well, and will help reduce your carbon footprint and your electricity bill.

Next on the agenda is CRT monitors. These beasts were big, bulky, and consumed a large amount of power. If you're still using one of these, you could probably cut your electric bill by at least $25/month just by upgrading to a more power efficient LCD. LCD's are just as good or better quality than CRT's, and they're easier on your eyes. Refresh rates of 60hz on a CRT would cause a lot of eye strain, but that's a thing of the past with LCD's unless you have the brightness set way too high.

Another aspect that many may not think of is virtualization. I have a system that's powerful enough to run my OS, plus any other virtualized os's I may want or need to run at the time. This also saves me money, since I don't have to have extra test servers running, sucking up electricity and heating up the room. I've tested all sorts of OS's this way including Fedora, Ubuntu, Windows Vista, PCBSD, and any other beta release I feel like testing at the time. It saves me a lot of time, trouble, and hardware to just load them up as VM's, instead of using physical servers. Virtualization on an old P3 just wouldn't be that feasible.

So really, the best thing to do with those old systems is to donate them to a charity or school, and fork out the cash for some shiny new hardware. You'll appreciate that you did once you start using it and see all the advantages.