- Computers & Software»
- Operating Systems
How to make a File Server in Ubuntu Server 12.04 LTS
In this tutorial we will be using samba to share files and folders. Samba is a software package which enables users to share files with Windows Machines. First make sure you're on the same network and have access to the internet. To check if you can access the internet, log-in and type
you should be able to get a reply if you have access to internet. To cancel ping request, press Ctrl+X.
Samba is used to share files between LInux and Windows machines. Now type the following command to download and install samba. Make sure your server is connected to internet.
sudo apt-get install samba smbfs
Now Lets create a directory for sharing
Type the following command to create a directory for sharing.
sudo mkdir -m 777 /myfiles
No. 777 means the directory has read and write access. myfiles is the directory name. And we're creating this directory in the root.
Finally Enable it to share files
Type the following command to open up the samba configuration file in vi Text Editor.
sudo vi /etc/samba/smb.conf
Type workgroup name
Goto Global Settings Section of the smb.conf file, press letter "I" to start editing. Type the name of the workgroup. Usually by default the name of the workgroup is WORKGROUP if you haven't changed.
Shared Directory Settings
Goto Authentication Section of the smb.conf file.
Change the lines as following, make sure to remove any "#" symbols from any line you edit. "#" is just for commenting.
Security = share
guest account = nobody
Then insert the following lines
[Home Shared Folder]
comment = Shared files for everyone at home
path = /myfiles
guest ok = yes
writeable = yes
browseable = yes
public = yes
A little explanation: In square brackets we write the name of the shared directory and how it should be displayed. The text you write in comment will appear when you hover over the shared directory. The aim of the comment is to give a brief description of the shared directory. Path is the actual location of the directory. If you want the directory to be Read-only, you can change the settings to "no" from "Writeable".
Finish Editing: When you have finished editing the file press Esc key, type ":wq" and press Enter to save and quit file.
Type the following command to restart samba.
sudo service smbd restart
or some people might have to use this command instead,
sudo smbd restart
Now try accessing the Ubuntu Shared Directory from a PC. Type \\<servername or IP Address>\<shared directory>
If you can't remember IP address, type ifconfig and it will show the current IP Address. Type hostname and it will show the Server's name.