Difference between revisions of "Mounting CIFS Shares from the command line"

From Da Nerd Mage Wiki
Jump to navigation Jump to search
Line 15: Line 15:
Changing that mount command to  
Changing that mount command to  


*<code>sudo mount -t cifs -o username='''USER''',password='''PASSWORD''',dir_mode=0777,file_mode=0666 //'''SERVERNAME'''/'''SHARENAME''' ~/'''MOUNTPOINT'''</code>
*<code>sudo mount -t cifs -o username='''USER''',password='''PASSWORD''',dir_mode=0777,file_mode=0666 //'''SERVERNAME'''/'''SHARENAME''' /'''MOUNTPOINT'''</code>
allows actual access for ANYONE...
allows actual access for ANYONE...




*<code>sudo mount -t cifs -o username='''USER''',password='''PASSWORD''',uid='''1000''',gid='''1000''' //'''SERVERNAME'''/'''SHARENAME''' ~/'''MOUNTPOINT'''</code>
*<code>sudo mount -t cifs -o username='''USER''',password='''PASSWORD''',uid='''1000''',gid='''1000''' //'''SERVERNAME'''/'''SHARENAME''' /'''MOUNTPOINT'''</code>
Allows full access by the user with UID 1000 & GID 1000...
Allows full access by the user with UID 1000 & GID 1000...






<span style="color: rgb(132, 63, 161);" >(Gotta be a better way...)</span>
<span style="color: rgb(132, 63, 161);">(Gotta be a better way...)</span>


== Persistent mounting ==
== Persistent mounting ==

Revision as of 23:08, 19 January 2022

Install cifs-utils and samba-client

  • sudo apt install cifs-utils samba-client -y

Create a mount point

  • sudo mkdir /MOUNTPOINT

Mount the share

  • sudo mount -t cifs -o username=USER,password=PASSWORD //SERVERNAME/SHARENAME ~/MOUNTPOINT

Permissions

Changing that mount command to

  • sudo mount -t cifs -o username=USER,password=PASSWORD,dir_mode=0777,file_mode=0666 //SERVERNAME/SHARENAME /MOUNTPOINT

allows actual access for ANYONE...


  • sudo mount -t cifs -o username=USER,password=PASSWORD,uid=1000,gid=1000 //SERVERNAME/SHARENAME /MOUNTPOINT

Allows full access by the user with UID 1000 & GID 1000...


(Gotta be a better way...)

Persistent mounting

  • sudo vi /etc/fstab

Add a line:

//SERVERNAME/SHARENAME     /MOUNTPOINT     cifs user,username=USER,password=PASSWORD,_netdev	0	0

Check it out

  • ls /MOUNTPOINT

Usage Notes

List shares available

  • sudo smbclient -L HOSTNAME