How to make a home server using Ubuntu desktop?
I was thinking to make my Ubuntu desktop machine in file server for using it at home . I am having one old laptop . Could I use it as a file server so my other 4 system can download data or view data from that old machine (server). I want to make it wireless and want to access over the internet also , and have a router . But I don't have any idea how doing it on Ubuntu Desktop or Ubuntu server. I don't want to install Ubuntu server .
Want to Share all of my Drive . Want Some Password or some kind of security for some folder to restrict access .
*I am seeing for Step by Step Guide how I can do it and How to access from other computer also * .
I tired using filezilla but in Ubuntu it is only client based application is available. It there anything like filezilla server in ubuntu .
The other system is on windows as well as Ubuntu .
I am new to networking and server type thing any help would be appreciated .
Since you want a GUI based server (Which is an Ubuntu Desktop transformed into a awesome server ;) ) then just do the following steps before proceeding:
-
Update everything. Make sure you have already updated and upgraded the system
sudo apt-get update && sudo apt-get upgrade
This way we are on the same page.
Make sure your wireless card is working correctly. If you happen to have a Broadcom based wireless card check the Installing Broadcom Wireless Drivers . If you have another it is very likely you will find the answer in askubuntu after searching for it with the name of the wireless card. Anyway I will assume that it is working correctly.
Install Samba Service and configure it by following the How to turn on Network Discovery and Share between computers with Samba
Installing SSH Service (mostly to help ease your way between 2 Ubuntu computers) by following the How to enable file sharing between two PCs? . You can also use putty in Windows if you like. A How to use SSH (ssh & rsync commands)? guide is also available.
If you are going to share the internet via the server. With this I mean, your router will connect to the server via a wired cable and then share the internet wirelessly to other computers then follow the How to Connect & Share your Internet Connection (Wired & Wireless) . Else if you want to do it via wired to another computer then Sharing Connection to other PCs (Via Wired Ethernet)
If you want to also share a printer with the other computers you can follow the What is CUPS server and how to share a printer (Locally or over a network)
-
Since you will be making a server, I also recommend installing SQUID PROXY if you happen to share the internet connection via the server. This will improve the bandwidth usage in general and it will feel like the internet is faster for all client PCs. To install follow the first answer in the What Updated Web Cache Servers are available (Caching HTTP Proxy) (By Rinzwind)
Remember to configure squid proxy in
/etc/squid/squid.conf
or/etc/squid3/squid.conf
for site permissions, what should be reversed cached and other stuff.After doing this 7 steps we should have a system that
Can share a folder with other computers in the LAN and they can see the shared folder without too much hassle, permissions or additional steps.
Can connect to the server via SSH or Samba sharing with no problem.
The server can share internet via a wireless or wired connection.
The server can now share a printer to all other computers including Windows like ones.
Let me know if any of this steps seems difficult to help you along the way.
Additional stuff can be to install xbmc and put all movies on the server. Then via the xbmc configuration options, enable web service so the rest of the computers can watch movies from the same server. There is a lot of stuff you can actually do with an ubuntu server.
well you can do that with samba file server.
you can install it by sudo apt-get install samba
First, edit the following key/value pairs in the [global] section of /etc/samba/smb.conf:
workgroup = EXAMPLE
...
security = user
The security parameter is farther down in the [global] section, and is commented by default. Also, change EXAMPLE to better match your environment.
Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared:
[share]
comment = Ubuntu File Server Share
path = /srv/samba/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755
comment: a short description of the share. Adjust to fit your needs.
path: the path to the directory to share.
This example uses /srv/samba/sharename because, according to the Filesystem Hierarchy Standard (FHS), /srv is where site-specific data should be served. Technically Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.
browsable: enables Windows clients to browse the shared directory using Windows Explorer.
guest ok: allows clients to connect to the share without supplying a password.
read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share is read only.
create mask: determines the permissions new files will have when created.
Now that Samba is configured, the directory needs to be created and the permissions changed. From a terminal enter:
sudo mkdir -p /srv/samba/share
sudo chown nobody.nogroup /srv/samba/share/
[Note]
The -p switch tells mkdir to create the entire directory tree if it doesn't exist. Change the share name to fit your environment.
Finally, restart the samba services to enable the new configuration:
sudo restart smbd
sudo restart nmbd
Credit goes here:Samba & for more information also you view that.
Installing openssh-server
would enable you to access your entire drive securely over the internet or from devices in your home, as long as they support sFTP. If any don't for any reason, a Samba share could supplement that as detailed in another answer. Here's how I set mine up:
Install OpenSSH Server: apt-get install openssh-server
Open up port 22: There are a number of ways of doing this, I use gufw
(you might need to install it, I'm not certain if it's default). If you want to open it up to the internet at a later stage, you'll need to forward port 22 to the server from your router. You can normally do this via a web interface on the router. If you can, assign the server a static ip there too (ie turn DHCP off for the server).
Edit the ssh config settings: Back up and open the file /etc/ssh/sshd_config
and change/add the settings
PermitRootLogin no
AllowUsers guarav_java other_user_if_necessary
For maximum security, you can set up key-based logins as detailed here https://help.ubuntu.com/community/SSH/OpenSSH/Keys, but it would suffice if you just set up a really strong password and saved it on each client machine.
You might like to create a user for each person connecting. If you do that, you can add them all to the same group (ssh_users, say) and allow everyone in that group to connect using AllowGroups ssh_users
. (For more information see http://knowledgelayer.softlayer.com/learning/how-do-i-permit-specific-users-ssh-access)
Check the settings are valid: You can check if you've made any syntax error in the config file with sshd –t
Connect from the server to itself: At this point you should be able to connect to the machine from itself in a terminal by ssh localhost
(assuming you already have openssh-client
). Then try it from another machine on your network, ssh <ip-address>
.
If the server's ip is static on your home network, you can add an entry to /etc/hosts
on an Ubuntu computer connecting to it with the line
server_ip_address theserver
This will mean you can connect with simply ssh theserver
, or whatever you called it. You can do the same for Windows (see here: http://helpdeskgeek.com/windows-7/windows-7-hosts-file/)
Connecting via sFTP: If you can connect to the server from another machine on your home network in a terminal, you can connect to it via sFTP and browse and transfer files securely. Personally, I set up a keyboard shortcut so I can mount/unmount my server with keyboard commands (on Ubuntu):
gvfs-mount sftp://user@ipaddress
gvfs-mount -u sftp://user@ipaddress
(The -u
flag is the umount command)
Put those into the "Command:" box of System Settings > Keyboard > Shortcuts > Custom Shortcuts > + (New shortcut), give it a name, click Apply, then click the right column and enter a key combination (CTRL+SHFT++
and CTRL+SHFT+-
respectively seem logical).
You can replace the ip address with what is in /etc/hosts
. This will mount the server as a drive in Nautilus and you can browse the folders just like those on your local computer. In Windows, you could connect using FTP software (Filezilla etc.). I've not tried it but I'm sure there is probably sFTP integration in Windows Explorer itself too.
Another advantage of key-based logins at this point is that you aren't prompted for a password each time you connect (unless you set one up to protect the key). You might like to look into it after you've got it working with password logins (and before opening up it to the outside).
Connecting from outside: The final step would be to see if you can connect from the internet, ie next door or whatever. If you haven't got a static ip address for your home, it could be tricky keeping up with what your ip address is. I use a dynamic dns service (http://afraid.org/ is a free one) personally, but you might find another solution better. Then you would replace the ipaddress in the above mount commands with the dynamic web address which points to your home network.
One final security hint, keep tabs on your SSH log if you go for this (/var/log/auth.log
), just to make sure nothing untoward is happening. If you find it is, Fail2Ban is one solution (http://www.fail2ban.org/wiki/index.php/Main_Page and https://help.ubuntu.com/community/Fail2ban). To minimize the risk you can change the port SSHD listens on to something non-standard like 500, and changing the corresponding port forwarding rules on your router and the firewall of the server (Why: https://serverfault.com/questions/189282/why-change-default-ssh-port) though I haven't personally tested that with gvfs-mount
.