I have previously written an article about how to mount a shared SMB folder on macOS (see:How to automatically load SMB shared network disks when macOS starts up ), and this article will briefly explain how to mount the SMB folder on the Debian 12 system at startup.
First install the required components:
apt-get install cifs-utils apt install samba-client
After the installation is complete, you can use the following command to verify whether you can log in to the corresponding shared device, such as nas:
smbclient -L your-ip -U username
Then create the mount directory:
mkdir /mnt/share
Mount the shared directory to the /mnt/share directory created earlier:
mount -o username=account,password=password//your-ip/shared directory/mnt/share
Note: If the debian12 here is LXC (linux container), the following error may be reported:
mount error(1): Operation not permitted lxc
This means that the LXC is an unprivileged container. So if you want to use the method in this article, you need to use a privileged LXC. If it is not a privileged container, there are other ways to implement it. I will write another article to talk about it later.
can usedf -h
command to check whether the mount is successful.
If you want to set it to automatically mount at startup, you need to editetc/fstab
document:
vim /etc/fstab
Then add the following configuration to the last line of the file, save and exit:
//your-ip/shared directory/mnt/share cifs defaults,username=account,password=password
at lastreboot
Post-usedf -h
Check whether the mount is effective.