How to Mount Samba Share in Linux

Share:
# Mount Samba Share in Linux This tip provides the necessary steps to mount a SMB share using Ubuntu. ## List available shares on server: Install the samba client library: ```sh sudo apt install smbclient ``` Then list the shares: ```sh smbclient -L // -U ``` You will then be prompted to enter a password (assuming your share requires one) and then will output something like this: ```sh >smbclient -L //192.168.0.105 -U greensamba Enter WORKGROUP\greensamba\'s password: Sharename Type Comment --------- ---- ------- greensamba_1 Disk greensamba_2 Disk sd_1 Disk sd_2 Disk IPC$ IPC IPC Service (UGREEN-2687) SMB1 disabled -- no workgroup available ``` Note the share name that you want to mount for later. ## Temp mount the share to a folder: - Install the cifs-utils package: ```sh sudo apt-get install cifs-utils ``` - Create the mount-point (folder): ```sh sudo mkdir /mnt/ ``` - Mount the share ```sh sudo mount -t cifs /// /mnt/ ``` ## Mounting at boot - add to /etc/fstab file: ```sh /// /mnt/ cifs user=,pass= /// /mnt/ cifs user=,pass=,iocharset=utf8,file_mode=0757,dir_mode=0757 0 0 /// /mnt/ cifs credentials= /// /mnt/ cifs user=,pass=,iocharset=utf8,uid=,gid= 0 0 ``` - reload /etc/fstab ```sh sudo mount -a ``` ## Use credentials ```sh credentials=filename|cred=filename specifies a file that contains a username and/or password and optionally the name of the workgroup. The format of the file is: username=value password=value domain=value This is preferred over having passwords in plaintext in a shared file, such as /etc/fstab . Be sure to protect any credentials file properly. ``` ## Tips - check help: man mount.cifs ## Issues - mount error(13): Permission denied check user name and passworld - smbclient getting NT_STATUS_LOGON_FAILURE check user name and passworld # Reference - [mount samba in ubuntu](https://www.chrisrmiller.com/mount-samba-share-in-ubuntu/) cover

No comments