How to set up a file server on Ubuntu?

by aliya.yundt , in category: Networking & Wireless , 2 years ago

How to set up a file server on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by viola_gleichner , 2 years ago

@aliya.yundt 

Setting up a file server on Ubuntu can be done by following these steps:

  1. Install Ubuntu Server: Download and install the latest version of Ubuntu Server on the computer or virtual machine that will serve as the file server.
  2. Install Samba: Samba is an open-source software suite that allows file sharing between different operating systems. To install it, run the following command in the terminal:
1
2
sudo apt-get update
sudo apt-get install samba


  1. Create a shared folder: Create a folder that will be shared by the file server. For example, you can create a folder named "shared" in the /srv directory:
1
2
sudo mkdir /srv/shared
sudo chmod 777 /srv/shared


  1. Configure Samba: Open the Samba configuration file by running the following command:
1
sudo nano /etc/samba/smb.conf


Add the following lines to the end of the file:

1
2
3
4
5
[shared]
path = /srv/shared
read only = no
browsable = yes
guest ok = yes


Save the file and exit.

  1. Restart Samba: Restart the Samba service for the changes to take effect:
1
sudo systemctl restart smbd


  1. Access the shared folder: The file server is now ready to use. You can access the shared folder from any computer on the network by using the server's IP address and the shared folder name. For example, if the server's IP address is 192.168.1.100, you can access the shared folder by typing the following into the file explorer's address bar:
1
\192.168.1.100shared


You will be prompted for a username and password. You can either use the server's root credentials or create a new user specifically for file sharing.

by benny_schoen , 5 months ago

@aliya.yundt 

Here are the steps to set up a file server on Ubuntu:


Step 1: Install Ubuntu Server

  • Download the latest version of Ubuntu Server from the official website and install it on the computer or virtual machine that will serve as the file server.


Step 2: Install Samba

  • Open the terminal and run the following commands to update the package list and install Samba:
1
2
sudo apt update
sudo apt install samba


Step 3: Create a shared folder

  • Create a directory where you want to store the shared files. For example, create a folder named "shared_files" in the /srv directory:
1
2
sudo mkdir /srv/shared_files
sudo chmod 777 /srv/shared_files


Step 4: Configure Samba

  • Edit the Samba configuration file by running the following command:
1
sudo nano /etc/samba/smb.conf


  • Add the following configuration to the end of the file:
1
2
3
4
5
[shared_files]
   comment = Shared Files
   path = /srv/shared_files
   read only = no
   browsable = yes


  • Save the file and exit the text editor.


Step 5: Set up Samba users

  • To allow access to the shared folder, you need to create Samba users. You can use the smbpasswd command to create a Samba password for an existing user or create a new user specifically for file sharing.
1
sudo smbpasswd -a username


Step 6: Restart Samba

  • Restart the Samba service for the changes to take effect:
1
sudo systemctl restart smbd


Step 7: Access the shared folder

  • You can now access the shared folder from another computer on the network through a file explorer or command line using the server's IP address and the shared folder name.
1
\<server_IP_address>shared_files


  • You will be prompted to enter the username and password of the Samba user you created.


Your file server on Ubuntu is now set up and accessible for file sharing on the network.