If you’re using CIFS to mount the remote fs, you’ll want to give the login user and group as part of the mount command. For security,. you’d put the info in your ~/.smbcreds
file and reference that from your mount command in /etc/fstab
.
So in /etc/fstab
:
> //myserver.local/work /work cifs vers=2.1,credentials=/home/myuser/.smbcreds,uid=5001,gid=6000,iocharset=utf8,rw,file_mode=0660,dir_mode=0770
And in your ~myuser/.smbcreds
:
username=myuser
password=mypassword
workgroup=MYWORKGROUP
Then make sure the file has owner and group of root, and permissions are read-write for owner and read-only for group:
$ l ~myuser/.smbcreds
-rw-r----- 1 root root 58 Feb 28 2021 /home/myuser/.smbcreds