Saturday, February 26, 2011

Setting up a server, the nanoTux way!

Good evening. I think I've built up enough oomph to attepmt AGAIN to setup a server. Using the nanoTux guide, http://nanotux.com/blog/the-ultimate-server/, I'm really hoping that it works and that I haven't gone insane by the time I reach the end of the HowTo. This guide was found on the Ubuntu Forums website in the Server Platforms area and seeing as it's had almost 27000 views, I'm sure it's the real McCoy.

For a complete HowTo, go to the address given above as this post will simply be making references to the code I use, and any workarounds that I implement. Begin! Shit...no coffee, plunger is missing...

To be continued...

Sunday, February 6, 2011

Just some useful stuff: bash networking commands


After all that clicking and scrolling for my last post, I ended up finding several other useful commands. Most of them are to do with networking and I'd just like to have them handy. Here goes.

Display total space and availability:
df -h

Display size of a folder, a couple of options here, may need to be sudo:
sudo du -hs /path/to/folder
sudo du -chks /path/to/folder

IP Scanning with range 192.168.1.1-192.168.1.254:
sudo nmap -sP 192.168.1.1-254

Scan operating system on target IP (cool!):
sudo nmap -O 192.168.1.3


...and that was all!

Ubuntu and Windows: admiring how they share


Up late again but I've struck some success. I've just found a neat little way to access a share folder located on a windows box on your current network. This will no doubt be a short How-To since it's 12:44AM and I didn't fall asleep till 3:30 this morning because it was so hot, great.

So, basically, you have a network, and because you are leet, you run a Ubuntu machine, but of course someone else will be running Windows (and others maybe even a Mac, God help me if I have to figure that out). If you have used Windows, then you will know that there is a somewhat simple way to setup folder sharing, but this requires you to be connected via a cable to the network. Not sure why.

To share a folder in Windows with the rest of the network, you just right-click on the folder you wish to share, then Properties > Sharing Tab > go down a bit. Then, you might see "Network Setup Wizard" or you'll see two check boxes:
1-"Share this folder on the network" and
2-"Allow network users to change my files".
If you see the wizard, then you need to follow it through and hopefully select everything correctly; there's a guide here at the MS site. For you (the leet user) to be able to access your mates'(clueless drongo) computer, both of these boxes must be ticked. And I'm sorry, but you can't do this without the owners consent...

Just to check if you or your friend have done the setup right, the shared folder will come up in Network Places (I think, not using Windows atm) under the workgroup that you chose in the wizard.

Ok, so the folder is being shared, how do I access it from Ubuntu? Well the simplest way is to just click there by going to Places > Network. It might take a while to load because it does some sort of search. The other way to access it is from the command line, useful for those who want to move stuff from a dead server box that doesn't have any USB ports! Lol...

I'm running Ubuntu 10.10 and I didn't have any dependency problems but that may be different on other distros. There are two packages, CIFS and smbfs which can be used to mount local machines to a place on your computer. Currently, it seems that they can only mount machines that have a wired connection. Maybe something to do with too many fingerprints...not sure.

Create a mount point on your computer first: I went with /mnt/test. But any will do.
sudo mkdir /mnt/test

Now, assuming that you know the IP address of your mates computer and have already obtained their username/password, run the following command for CIFS:
sudo mount -t cifs -o username=drongo,password=password //192.168.1.1/shared-folder /mnt/test

And for smbfs just remove the -t cifs:
sudo mount -o username=drongo,password=password //192.168.1.1/shared-folder /mnt/test

If they didn't use a password, just leave it out and when it prompts for one, just hit ENTER. I did run into one hiccup and I'll just voice that here. The IP address that you use has to be the address of the wired modem not the wireless modem, otherwise it won't work. That's it. I'm sure I've left some other important information out so please correct me if you find it.

Other than that, the folder should now be accessible at /mnt/test for you to copy, write, delete or even put stuff there. Maybe you're a nice friend and you want to give them some music? It's possible.

Don't forget to unmount!
sudo umount /mnt/test