Showing posts with label articles. Show all posts
Showing posts with label articles. Show all posts

Thursday, November 12, 2009

Free Disk space in Linux (df command)

Have you ever wondered how to find out how much free space you have on your hard drive? It's really easy to find out and we will discuss this in today's article. Just run this command:

df

 This will give you a table with remaining space on all of your disks. There are some options you may use with this command. I will list some of the most important.

  • -h, --human-readable - will show results in human readable format (e.g. 256M, 80G)
  • -H, --si - likewise, but use powers of 1000, not 1024
  • -l, --local - limit to local file systems only
  • -t, --type=TYPE - limit to file systems of given type only

So this is how to find out your free disk space. It should work on all linux distributions.

Saturday, November 7, 2009

How to set up Samba server

Imagine, that you have a computer running linux (e.g. home server) and you would like to share some files with your windows computer. Now you have two possibilities. You can either install nfs client on your windows computer, or a samba server on linux. Today we will have a look on how to set up a samba server on your linux system.

First you will need to install the samba itself. This differs a lot according to your distribution, but on debian I would do simply

apt-get install samba

Now, that you have the samba installed on your computer, it's time for the funny part, the configuration. The main configuration file of samba should be /etc/samba/smb.conf. It will be filled with some default data, but I recommend you to delete this file and start writing a new one with your favourite editor.

rm /etc/samba/smb.conf
nano /etc/samba/smb.conf

Now fill your new file with this:


[global]
workgroup = MASLIK.CZ
server string = maslik.cz samba server
browseable = yes
hosts allow = 10.0.0.
security = user
hide dot files = yes

[sharing]
path = /export
browseable = yes
writable = yes

 This is the very basic configuration. You should of course fill your own values to workgroup and hosts allow in the global part. After that part we define all of our shares. I have one folder defined. For windows clients it will be shown as a sharing folder (the [sharing] string manages this), but the real folder shared is /export. You may of course also set writable = no, if you wish to have a read-only folder.

After changing the configuration file you should restart the samba daemons, if you are not planning to restart your computer.

/etc/init.d/samba restart

Now the last step, you have to take is to make a new samba password for any user, that will have access to your samba server. You will do that by this command:

smbpasswd -a user

After entering this command you will be prompted to enter the new password. This would create a password for user user, so fill your own username. Finally you may also like to use chmod to update the access rights to your shared folder.

So I wish you good luck with setting up your server. Samba of course gives us many more possibilities of settings. One of the most important is a printer sharing. We will have a look at that next time.