CIFS: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with "== mount ==")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== mount ==
== 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: <ref>https://serverfault.com/questions/367934/how-do-i-pass-credential-file-to-mount-cifs</ref> <ref>https://serverfault.com/questions/367934/how-do-i-pass-credential-file-to-mount-cifs</ref>
-
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: <ref>https://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown</ref>
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

Latest revision as of 16:14, 10 June 2025

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