CIFS

From Omnia
Jump to navigation Jump to search

mount

apt install cifs-utils samba samba-client


mount.cifs //some-cifs.example.com/someshare somemount/ -o dom=ad,user=someuser,pass=SomePA@@

/etc/fstab

//some-cifs.example.com/someshare somemount/ cifs dom=ad,user=someuser,pass=SomePA@@ 0 0

-- credentials in file --

mount.cifs //myserverhere.com/cifs_share /mnt/cifs_share \
   -o user,uid=65001,rw,workgroup=DEV,credentials=/root/.cifs
/root/.cifs:
 username=ouruser
 password=ourpassword

Add domain if needed:

 domain=domain
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
sudo chmod 0600 /root/.cifs

refs: [1] [2]

-

Note this works:

username=user@example.com

And this works:

username=userid
domain=AD

But these forms do NOT work:

username=AD\userid
username=AD\\userid
username=AD//userid

--

Mount with specific userid: [3]

sudo mount -t cifs -o username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g) //server-address/folder /mount/path/on/ubuntu

Possibly might need to force:

sudo mount -t cifs -o username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g),forceuid,forcegid, //server-address/folder /mount/path/on/ubuntu