Mounting Samba (CIFS) shares: Difference between revisions
m Text replacement - "<code>" to "{{code|" |
m Text replacement - "</code>" to "}}" |
||
| Line 10: | Line 10: | ||
password=53cr3T$ | password=53cr3T$ | ||
Then to mount, use {{code|-o credentials=/etc/cifs_passwd | Then to mount, use {{code|-o credentials=/etc/cifs_passwd}} like: | ||
mount -t cifs -o credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share | mount -t cifs -o credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share | ||
==== /etc/fstab ==== | ==== /etc/fstab ==== | ||
If you plan on mounting it in {{code|/etc/fstab | If you plan on mounting it in {{code|/etc/fstab}}, append: | ||
//10.1.1.123/share /mnt/share cifs credentials=/etc/cifs_passwd 0 0 | //10.1.1.123/share /mnt/share cifs credentials=/etc/cifs_passwd 0 0 | ||
==== Default User / Group ==== | ==== Default User / Group ==== | ||
To set the default user/group ID, define the {{code|uid | To set the default user/group ID, define the {{code|uid}} and {{code|gid}} value as part of the options. eg: | ||
mount -t cifs -o uid=1024,gid=512,credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share | mount -t cifs -o uid=1024,gid=512,credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share | ||
Revision as of 19:14, 24 February 2017
Linux
Mounting
Ensure you have samba-utils installed, then run:
mount -t cifs -o username=leo,password=53cr3T$ //10.1.1.123/share /mnt/share
You can also have the secrets placed in a separate file rather than have it in line with the mount command. To do so, create a separate credentials file with the following contents:
cat /etc/cifs_passwd # can be placed anywhere. Ensure it's not world readable. username=leo password=53cr3T$
Then to mount, use {{{1}}} like:
mount -t cifs -o credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share
/etc/fstab
If you plan on mounting it in /etc/fstab, append:
//10.1.1.123/share /mnt/share cifs credentials=/etc/cifs_passwd 0 0
Default User / Group
To set the default user/group ID, define the uid and gid value as part of the options. eg:
mount -t cifs -o uid=1024,gid=512,credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share
Unmounting
Unmount as usual:
umount /mnt/share
FreeBSD
Mounting
mount_smbfs -I 10.1.1.4 //leo@remote_host/share /mnt/share
where -I takes the remote host's IP address. Your username @ the NetBIOS name / path to your share comes next. The mount path follows after that.