How to Mount an SMB Share in Linux

Linux 服务器挂载 QNAP SMB/CIFS 共享:Ubuntu 22.04 实测与 3 种身份验证方案 本文详细介绍了在Ubuntu 22.04上挂载QNAP SMB/CIFS共享的三种身份验证方案,包括明文密码、凭据文件和Kerberos认证,并提供了性能优化和持久化挂载的实用指南。适用于需要跨平台文件共享的运维人员和开发者,提升NAS使用效率与安全性。 阅读详情

The Server Message Block (SMB) protocol facilitates network file sharing, allowing applications to read and write to files and request services from server programs. This protocol is pivotal for seamless communication between different devices in a network, particularly in mixed OS environments like Windows and Linux.

Users can access files on a Windows server or any SMB-enabled device straight from their Linux workstation by mounting an SMB share. In order to ensure seamless file sharing and network connectivity, this tutorial will walk you through the process of mounting an SMB share on Linux.

Linux terminal is important tool to install SMB Share in Linux

Prerequisites for Mounting SMB Shares

Before mounting an SMB share, ensure the following prerequisites are met:

  • A Linux system, such as a Hostman cheap cloud server, with root or sudo privileges.

  • The cifs-utils package installed on your Linux system.

  • Access credentials (username and password) for the SMB share.

  • Network connectivity between your Linux system and the SMB server.

Installing Necessary Packages

The cifs-utils package is essential for mounting SMB shares on Linux. Additionally, the psmisc package provides the fuser command, which helps manage and monitor file usage.

Update Package List and Upgrade System

First, update your package list and upgrade your system:

 

sudo apt update

Install cifs-utils and psmisc

Install the necessary packages:

 

sudo apt install cifs-utils psmisc

Verify Installation

Verify the installation of cifs-utils and availability of the fuser command:

 

mount -t cifs fuser

Finding SMB Share Details

Get the SMB share information, such as the share name and the server name or IP address. You may need to examine the server setup or speak with your network administrator.

Example:

  • Server: smbserver.example.com
  • Share: sharedfolder

Mounting SMB Shares Using the mount Command

To mount the SMB share, use the mount command with the -t cifs option, specifying the SMB protocol.

Create a directory to serve as the mount point:

 

sudo mkdir /mnt/smb_share

Mount the SMB share using the following command:

 

sudo mount -t cifs -o username=your_username,password=your_password //192.0.2.17/SharedFiles /mnt/smb_share

Replace your_username and your_password with your actual username and password. Ensure /mnt/smb_share is an existing directory.

Verifying the Mount

To confirm that the SMB share is successfully mounted, use the mount command:

 

mount -t cifs

Navigate to the mount point and list the files:

 

cd /mnt/smb_share ls

Creating a Credentials File

Make a credentials file so you don't have to enter your credentials every time. This file has to be guarded and hidden.

Use a text editor to create the file:

 

nano ~/.smbcredentials

Add the following content, replacing with your actual credentials:

 

username=your_username password=your_password

Set appropriate permissions for the file:

 

sudo chown your_username: ~/.smbcredentials sudo chmod 600 ~/.smbcredentials

Mount Using the Credentials File

Mount the SMB share using the credentials file:

 

sudo mount -t cifs -o credentials=~/.smbcredentials //192.168.2.12/SharedFiles /mnt/smb_share

Quick example of how SMB Shared is mounted in Linux terminal

Automating SMB Share Mounts

To automate the mounting process, add an entry to the /etc/fstab file. This will ensure the SMB share is mounted at boot.

1. Open /etc/fstab for editing:

 

sudo nano /etc/fstab

2. Add the following line:

 

//smbserver.example.com/sharedfolder /mnt/smbshare cifs username=johndoe,password=securepassword,iocharset=utf8,sec=ntlm 0 0

3. Save and close the file.

4. Test the fstab entry:

 

sudo mount -a

Ensure no errors are displayed.

Troubleshooting Common Issues

Permission Denied

Check your credentials and permissions on the SMB server.

No Such File or Directory

Ensure the server IP, share path, and mount point are correct.

Mount Error 13 = Permission Denied

Double-check your username and password.

Mount Error 112 = Host is Down

Verify network connectivity and server availability.

Unmounting an SMB Share

To unmount the SMB share, use the umount command followed by the mount point:

 

sudo umount /mnt/smb_share

Conclusion

Mounting an SMB share in Linux is a straightforward process that enhances file sharing capabilities across different operating systems. By following this tutorial, you can efficiently set up and troubleshoot SMB share mounts, facilitating seamless network communication and file access.

Don't forget to check how to configure server image on Lunix!

Frequently Asked Questions

What is Samba in Linux and how does it relate to SMB?

Samba is an open-source implementation of the SMB/CIFS protocol in Linux. It allows Linux systems to share files and printers with Windows devices over a network.

What is the command to mount a Windows share in Linux?

Use mount -t cifs //server/share /mnt/share -o username=your_user.

How can I auto-mount an SMB share on boot in Linux?

Add the mount configuration to /etc/fstab using proper credentials.

Do I need root access to mount an SMB share?

For traditional mounting, yes. But user-space tools like gio mount can be used without root.

33、Unix系统下SMB/CIFS文件共享访问指南 本文详细介绍了在Unix系统(包括Linux和FreeBSD)下访问SMB/CIFS文件共享的方法与最佳实践。内容涵盖CIFS文件系统的安装与挂载、用户权限管理、跨平台兼容性、常见问题解决、性能优化建议及安全注意事项,并对比了不同系统的操作流程,帮助用户实现高效、安全的网络文件共享访问。 阅读详情

相关推荐

Databricks Genie:语义编译器架构与企业级智能解析实践

语义层是现代数据平台实现自然语言查询的核心基础,其本质是将业务术语映射为可执行、可治理的数据契约。原理上依赖结构化元数据、值字典与数据血缘三支柱协同,通过分层AI代理(如Intent Parsing、Retriever、Verifier)实现意图识别→语义对齐→安全执行的闭环。技术价值在于降低SQL使用门槛的同时保障审计性、一致性和权限可控性,适用于销售运营、财务分析等一线业务场景。本文深入解析Databricks Genie作为典型语义编译器的落地逻辑,涵盖Unity Catalog知识注入、七层Agen

weixin_29053695的博客 355

nfs mount密码_Linux SMB和NFS文件共享

SMB配置(大多数用于windows与linux之间的共享访问)服务端: windowds系统 设置共享文件夹,默认是基于samba的cifs文件系统,windows文件夹共享大家都比较熟悉这边省略,开通账号keph,密码123321客户端:linux系统,充当客户端客户端配置:yum -y install samba-client cifs-unit //安装samba客户端软件和cifs文件系...

weixin_39579483的博客 4523

如何对EMB电子机械制动器的热衰退问题进行优化

摘要 电子机械制动器(EMB)在新能源汽车和自动驾驶中具有重要应用价值,但其在高强度工况下会出现热衰退现象。本文分析了EMB热衰退的五大机理:摩擦副热效应、电机热衰退、减速机构热失效、温度对控制策略干扰以及结构设计导致的热积累。针对这些问题,提出了从材料、结构、控制三个维度的优化措施:升级耐高温材料、改进散热设计、优化控制算法等。通过"热生成抑制-热传导优化-热失效补偿"的系统方案,可有效改善EMB的热衰退问题,为智能汽车提供更可靠的制动保障。

m0_59012156的博客 350

linux share (samba), how to list all shares with the path to local directory actually shared

Follow。

allway2的博客 233

使用 MATLAB/Simulink + Simscape Electrical + SimPowerSystems + Stateflow,构建一个多能互补微电网系统的动态响应仿真模型

本文详细介绍了使用MATLAB/Simulink构建多能互补微电网动态响应仿真模型的方法。文章从系统架构设计入手,包含光伏、风电、柴油发电机、锂电池储能等多种组件,重点讲解了建模过程、控制策略(下垂控制、PLL、SOC管理)和模式切换逻辑(Stateflow)。通过四种典型场景(负荷突增、光伏出力骤降、并网/孤岛切换、电动机启动)的仿真分析,验证了微电网在动态响应中的关键性能指标,并提出了高可靠性设计建议。该模型为微电网的稳定性分析和优化设计提供了有效工具,特别强调了储能系统在快速功率支撑中的重要作用。

amy_mhd的博客 164

R数据分析:潜在转化分析LTA的做法和解释(一)

之前给大家写了很多潜在类别分析的教程Mplus教程:如何做潜在类别分析LCAR数据分析:用R语言做潜类别分析LCAMplus数据分析:潜在类别分析(LCA)流程(详细版)R数据分析:再写潜在类别分析LCA的做法与解释,今天继续给大家拓展一步。 今天要介绍的就是潜在转换分析,这个东西就是LCA的纵向版本。是一个专门用来研究质变的统计技巧。有一句话叫做量变起质变,你怎么知道质变到底发生没有?就用潜在转换分析。 Latent transition analysis is an extension of...

Codewar的博客 7710

How to Access Samba Share on Linux and Windows Systems

【代码】How to Access Samba Share on Linux and Windows Systems。

allway2的博客 257

34 python 时间和日期

介绍python里时间和日期的常用方法,以及案例,还有注意事项。

水滴爬呀爬 349

Samba windows 10 share: mount error(112): Host is down

Windows 10 Share File://10.108.xx.xx/lnxvda-rf/ROBOT [root@rhels73 robot]# mount -t cifs -o username=administrator,password=xxxxxx //10.108.xx.xx/lnxvda-rf/ROBOT /opt/robotmount error(112): Ho...

a18563862293的博客 794

在实车上进行lio-sam测试

PS:将雷达和imu相对固定后,拆下来,原地晃啊晃,直到xyz进度达到百分百,参考gif。标定完成后,会在result文件夹下生成result.txt。

如果想成为中心,那么就到中心去吧。 1003

【AUTOSAR-COM】-10.5-APP CAN Frame/PDU“发送周期不准“的影响因素

一个Tx PDU在COM模块中的数据流; Tx APP CAN Frame/PDU"发送周期不准"的影响因素;

「汽车电子助手」的博客 2392

linux挂载cifs磁盘_SMB、CIFS和NETBIOS协议概念及linux挂载远程文件系统

一、SMB(Server Message Block)协议SMB协议是基于TCP-NETBIOS下的,一般端口使用为139,445。服务器信息块(SMB)是微软(Microsoft)和英特尔(Intel)在1987年制定的协议,主要是作为Microsoft网络的通讯协议,用于在计算机间共享文件、打印机、串口等。SMB 协议可以用在因特网的TCP/IP协议之上,也可以用在其它网络协议如IPX和Net...

weixin_39732534的博客 1031

openpi 入门教程(一)安装、训练、微调与推理

OpenPI是由物理智能团队发布的机器人开源模型和软件包,包含两种主要模型:基于流的扩散视觉-语言-动作模型(VLA)的π₀模型和基于FAST动作标记器的自回归VLA的π₀-FAST模型。这些模型已在超过10,000小时的机器人数据上进行了预训练,并提供了基础模型检查点,支持开箱即用或根据用户数据集进行微调。OpenPI的实验性质意味着它可能不适用于所有平台,但鼓励研究人员和从业者进行创造性实验。运行这些模型需要至少具备NVIDIA GPU,推荐使用RTX 4090或更高规格的显卡。OpenPI支持在Ubu

2506_90492529的博客 5127

cifs挂载 mount ubuntu_在Linux上使用CIFS,如何挂载Windows共享

在Linux和UNIX操作系统上,可以使用mount命令的cifs选项将Windows共享安装在本地目录。常见的Internet文件系统(CIFS)是网络文件共享协议,CIFS是SMB的一种形式。在本教程中,解释如何在Windows共享上手动和自动挂载Linux系统。安装CIFS程序包要在Windows系统上挂载Linux共享,首先需要安装CIFS程序包。在Ubuntu和Debian上安装CIFS...

weixin_31776191的博客 1725

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

linux挂载smb中vhd

原文 How to mount Virtual Hard disk (VHD) file in Ubuntu Linux? - Linux Shout 1 安装所需程序 # 安装vhd挂载所需程序 ┌──(kali㉿kali)-[~] └─$ sudo apt-get install libguestfs-tools # 安装smb挂载所需程序 ┌──(kali㉿kali)-[~] └─$ sudo apt-get install cifs-utils 2 smb目录挂载 ...

qq726232111的博客 983

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

将 Windows PC 作为网络文件共享(SMB)服务器 V2.1—— 局域网内高速传文件

如何在局域网内通过Windows PC共享文件夹? 本文提供了一键配置和手动配置两种方法,让局域网内的设备(电脑、手机、电视、NAS等)通过SMB协议访问同一共享文件夹,无需额外硬件或U盘拷贝。 核心步骤: 创建共享文件夹:设置NTFS权限,仅允许授权用户访问。 启用SMB共享:使用Windows内置的Server服务,确保SMB 3.1.1协议(安全加密)。 防火墙配置:精准放行445端口,仅允许局域网IP段访问。 安全加固:禁用SMB 1.0(易受勒索病毒攻击),使用强密码账号,限制共享权限。

hjjhl的博客 470

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

remote mounting from windows to linux

8 Ways To Mount SMBfs (SAMBA FILE SYSTEM) In Linux. Sep 8, 2009 How to Mount smbfs (SAMBA file system) permanently in Linux.In this post I am going to give some examples how to do SMB (Server Mess...

weixin_30535043的博客 116

how to mount remote disk as local disk at startup

1 sudo vi /etc/fstab in this file, add the line as, //host_machine_name/d$ /mount smbfs user=foo,domain=bar,password=alice_password,iocharset=utf8 0 0 notice that you should replace the corre

abcgogo的专栏 683

linux挂载cifs命令,如何使用 CIFS 在 Linux上挂载 Windows 共享

在Linux和UNIX操作系统上,可以使用mount命令的cifs选项将Windows共享安装在本地目录树中的特定安装点上。通用Internet文件系统(CIFS)是一种网络文件共享协议。CIFS是SMB的一种形式。在本教程中,我们将说明如何在Linux系统上手动和自动安装Windows共享。一、安装CIFS实用程序包要在Linux系统上挂载Windows共享,首先需要安装CIFS实用程序包。在U...

weixin_33178459的博客 4711

access windows share with smbclient and mount with cifs

suppose my windows server is YJ104. and hthe work group is "WORKGROUP", and I have created a user name called "bq".  you'd first share a folder and enables permission for YJ104\bq;,  to visit hte fi

redalert2c的专栏 894

学习smb的心得

我现在向大家介绍如何在windows和linux中双方共享,本人这些天一直在研究,当然要靠了各位兄弟指点。再这里还要谢谢来自五湖四海的兄弟   先来讲讲从linux中访问windows中的共享把首先你要把windows中的共享打开,这样我门以后才能访问。在fc[56]中,原来的smbmount 改成了 mount -t cifs  对 ,我们就是用这个命名来实现共享的 比如说我们想共享wind

hover_online的专栏 1886

Linux mount(挂载) Windows分区的方法

资料:http://www.furyu.atnifty.com/cgi-bin/readtext.cgi?title=NFS-mount&fname=./memo/Linux/PC-HowTo/nfs_mount.txt  smbclient 用法 smbclient –L IP或者NETBIOS名称,作用是显示某台提供samba服务的服务器上的共享资源。命令执行效果如下:

【昆山人在上海】 1235

linux工作站文件访问记录,在Linux中smbfs文件系统的挂载

mount 的用法,加载网络中的共享文件夹到本地机;mount就是用于挂载文件系统的,SMB做为网络文件系统的一种,也能用mount挂载;smbmount说到底也是用mount的一个变种;mount 挂载smbfs的用法;mount -t smbfs -o codepage=cp936,username=用户名,password=密码 , -l //ip地址/共享文件夹名 挂载点或mount -t...

weixin_42097557的博客 287

【LinuxService】 SMB and CIFS

# porpose: Shareing file system between windows and linux using networkprotocol:smb(Service Message Block): Shareing linux file system to windowscifs(Common Internet File System):Shareing ...

weixin_33724059的博客 92

Linux支持CIFS协议嘛,如何使用CIFS在Linux上挂载Windows共享

在Linux和UNIX操作系统上,可以使用mount命令的cifs选项将Windows共享安装在本地目录树中的特定安装点上。通用Internet文件系统(CIFS)是一种网络文件共享协议。 CIFS是SMB的一种形式。在本教程中,我们将说明如何在Linux系统上手动和自动安装Windows共享。安装CIFS实用程序软件包要在Linux系统上挂载Windows共享,首先需要安装CIFS实用程序包。在...

weixin_30013029的博客 515
上一篇: How to use the command ‘fusermount‘ (with examples)
下一篇: uos desktop 20 professional 1070操作系统中编译和安装dde-file-manager
allway2
博客等级 码龄16年 6724粉丝 8048原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值