How to setup access to Proxmox LXC container from Windows?

In this tutorial we will show how to setup file sharing between your LXC container and a Windows PC. The configuration is set for local network sharing, so the permissions are benevolent. If this is a publicly accessible installation, it will be necessary to set sharing in a more restrictive way.

In this article we will show a simple procedure to make a Proxmox LXC container folder accessible from a local network through Windows.

Having access to files stored in a Proxmox container on the local network directly from Windows can be helpful - in my case was the main reason for transcoding video and audio files which are in this container.

Step 1: Installing Samba in LXC Container

Connect to your LXC container using an SSH client (eg PUTTY) and install Samba.

sudo apt-get install samba

Step 2: Create User

Create new user "sambauser" to access shared folder and set user password.

sudo adduser sambauser
sudo smbpasswd -a sambauser

Now, let's set user authorizations - if you don't have ACL installed, you can install it using sudo apt-get install acl.

Use setfacl command to add permissions for sambauser to /DATA/Media folder .

The following command will add read, write, and execute permissions to the user on this folder.

sudo setfacl -m u:sambauser:rwx /DATA/Media

We will verify settings permissions:

getfacl /DATA/Media

Step 2: Configure shared folders

Open the configuration file for the Samba service.

sudo nano /etc/samba/smb.conf

At the end of the file,you just add a section for sharing the required folder, whose name we will indicate in square brackets.

[Media]
comment = My media directory
path = /DATA/Media
public = Yes
guest ok = Yes
read only = no
browsable = Yes
create mask = 0664
directory mask = 0775
force user = sambauser

After editing just press CRTL O and ENTER. This will save the file and we can restart the Samba service.

What mean individual configuration directives?

  • comment = My media directory - This comment serves as share description. This is an optional description that can be displayed to users.

  • path = /DATA/Media - Specifies the path to the directory that you want to share on the network. You can share any other directory on your system, just change the path.< /p>

  • public = Yes - Indicates that the share is public. No user login is required. Alternatively public = No requires users to be authenticated before accessing the share.

  • guest ok = Yes - Allows access without user authentication. Next set is guest ok = No means that they only have access authenticate users.

  • read only = no - Allows users not only to read but also to write to the shared folder. Alternatively, it is possible to set read only = Yes, which restricts users only to reading files.

  • browsable = Yes - Allows users to see the shared folder when browsing on the network. Alternatively it is possible to set browsable = Well then it hides the share and the folder will not be visible when browsing the network, but will be accessible if the user knows the exact name of the share.

  • create mask = 0664 - Sets default permissions for newly created files.

  • directory mask = 0775 - Sets default permissions for newly created directories

  • force user = sambauser - All operations on files will be performed as user sambauser.

Step 3: Restart Samba Services

After adjusting the configuration, nrestart the Samba service

sudo systemctl restart smbd

Step 4: Windows Settings for Access to Shared Folders

On Windows open File Explorer and type IP in the address bar address of the machine on which the Proxmox LXC container is running.

//192.168.1.50 #adresa LXC kontejneru v místní síti

Step 5: Mapping Network Drive (optional)

In Windows File Explorer you can map the shared folder as a network drive for easy access and reconnecting the drive after the next start of Windows. Just click on the browsed folder with the right mouse button and choose "Map network drive".