Monday, April 15, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1404  / 1 Year ago, tue, april 11, 2023, 11:37:35

I have two machines running Ubuntu 22.04 LTS. The first is a home server which is used for network attached storage using SMB. The second is a desktop, for which I want to create a permanent mount to the network attached storage.


I can connect to the network share using the Ubuntu GUI (below):
Ubuntu Network Authentication


The problem with this approach is that some applications fail to write to the storage when it's mounted that way. Apparently I need to create a permanent mount point so that it's always mounted and authenticated.


I've been following this tutorial about how to do it
https://wiki.ubuntu.com/MountWindowsSharesPermanently


Steps Taken


Install cifs and setup mount point...


sudo apt install cifs-utils
sudo mkdir /media/storage

Create credentials file ~/.smbcredentials...


gedit ~/.smbcredentials

Contents...


username=MY_SERVER_USERNAME
password=MY_SERVER_PASSWORD
domain=SERVER

Permissions...


chmod 600 ~/.smbcredentials

Note: I actually never know what domain refers to, do I just use "SERVER", which is the name of the machine, and that seems to work, but I haven't got the foggiest idea whether or not that's right.


Create entry in /etc/fstab...


//SERVER/storage /media/storage cifs credentials=/home/user/.smbcredentials,iocharset=utf8,sec=ntlm 0 0 

At this point, I have my credentials set up, I have an entry in fstab, and Ubuntu recognises the share, but when I try to access it, I get this:



mount:cifs Permission Denied



No useful reason why I can't get access.


What I've Tried


Apparently SMB doesn't support sec=ntlm anymore? So changing the entry in /etc/fstab/ to this almost works:


//SERVER/storage /media/storage cifs credentials=/home/user/.smbcredentials,iocharset=utf8,nofail 0 0 

Now I can access the share, but I only have read access.


Questions



  • How do I set up my permanent mount to the network share so that I have full read/write access?

  • If sec=ntlm no longer works, how do I find out what sec= should be?

  • What should the domain entry in my credentials file be?


More From » networking

 Answers
4

using v22.04 (and for that matter 20.04) I have set up an SMB share in fstab to access my Synology video NAS share with the following command which works faultlessly:


//192.168.1.117/video /media/NAS/video cifs username=[user],password=[password],rw,uid=1000,gid=500

Of course, replace the credentials in square brackets with your own and the ip address to your NAS as well as the uid and gid with values that are appropriate for your user... (and further, if it works, restore the credentials file to the line in fstab to preserve security).


Maybe try first without the smbcreditials file as in the example above then add in the credentials file to fstab if that works (to replace the open username and password credentials to fine tune your entries.
The other steps already taken creating the mountpoint appear correct.


I would suggest, if keeping the smb credentials open works, then initially copy the validated line after which simply commenting out (#) the line with the open to view creds, then remove the line when the smb credentials file is resolved in order to preserve what you have done.


[#318] Wednesday, April 12, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
disdry

Total Points: 133
Total Questions: 128
Total Answers: 109

Location: Greenland
Member since Fri, Jul 31, 2020
4 Years ago
disdry questions
Thu, Oct 13, 22, 19:09, 2 Years ago
Fri, Oct 28, 22, 15:06, 1 Year ago
Sat, Feb 25, 23, 11:33, 1 Year ago
;