Debian 파일 공유 설정

Sharing files on a Debian system can be quite useful, especially in scenarios where multiple users need access to the same set of files or when transferring files between different systems. In this blog post, we will explore how to share files on a Debian system using Bash commands.

Configure Samba

Samba is a popular open-source software suite that provides file and print services for Linux and Windows clients. To enable file sharing on Debian, we will start by installing and configuring Samba.

  1. Install Samba by running the following command:
sudo apt-get install samba
  1. Once the installation is complete, open the Samba configuration file using a text editor:
sudo nano /etc/samba/smb.conf
  1. In the configuration file, locate the [global] section and add the following lines:
    workgroup = WORKGROUP
    server string = %h server (Samba, Debian)
    

Replace WORKGROUP with the appropriate workgroup name for your network.

  1. Scroll down to the end of the file and add the following configuration for each directory you want to share:
[shared_directory]
   comment = Shared Directory
   path = /path/to/directory
   browseable = yes
   read only = no
   guest ok = yes
   create mask = 0755
   directory mask = 0755

Replace shared_directory with the desired name for the share and /path/to/directory with the actual path to the directory you want to share.

  1. Save the file (Ctrl + O) and exit the text editor (Ctrl + X).

  2. Restart the Samba service for the changes to take effect:

sudo systemctl restart smbd

Configure NFS

NFS (Network File System) is another popular file-sharing protocol used in Linux environments. To configure NFS on Debian, follow these steps:

  1. Install the NFS server package by running the following command:
sudo apt-get install nfs-kernel-server
  1. Open the exports file using a text editor:
sudo nano /etc/exports
  1. In the file, add the following line for each directory you want to share:
/path/to/directory client_ip(rw,sync,no_subtree_check)

Replace /path/to/directory with the actual path to the directory you want to share and client_ip with the IP address or hostname of the client system allowed to access the share.

  1. Save the file and exit the text editor.

  2. Restart the NFS server for the changes to take effect:

sudo systemctl restart nfs-kernel-server

Conclusion

In this blog post, we have covered the steps required to set up file sharing on a Debian system using both Samba and NFS protocols. By following these instructions, you can easily share files with other users or systems on your network.

Remember to secure your shares by adjusting the permissions and user access to prevent unauthorized access.