Mounting Samba (CIFS) shares: Difference between revisions
m Added categories |
No edit summary |
||
| Line 1: | Line 1: | ||
== FreeBSD == | ==FreeBSD== | ||
=== Mounting === | ===Mounting=== | ||
{{highlight|lang=terminal|code= | {{highlight|lang=terminal|code= | ||
# mount_smbfs -I 10.1.1.4 //leo@remote_host/share /mnt/share | # 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. | where <code>-I</code> takes the remote host's IP address. Your username @ the NetBIOS name / path to your share comes next. The mount path follows after that. | ||
== Linux == | ==Linux== | ||
Ensure you have {{code|samba-utils}} installed. | |||
{{Navbox Linux}}[[Category:Linux]] | To mount a samba share, use <code>mount.cifs</code>. Credentials can be passed in as mount options.{{highlight|lang=terminal|code= | ||
# mount -t cifs -o username=leo,domain=uc,vers=2.1 //10.1.1.123/share /mnt/share | |||
}}You can also have the credentials placed in a separate file rather than passing it directly as mount options. Create a file with the username, password, and optionally domain defined and then mount using the <code>credentials=filename</code> option. For example:{{highlight|lang=terminal|code= | |||
## Create a file. Ensure it's not world readable. | |||
# cat /etc/cifs_passwd | |||
username=leo | |||
password=53cr3T$ | |||
domain=uc | |||
# mount -t cifs -o credentials=/etc/cifs_passwd,vers=2.1 //10.1.1.123/share /mnt/share | |||
}} | |||
==== Default user/group ID ==== | |||
To set the default user/group ID, define the {{code|uid}} and {{code|gid}} value as part of the mount options. For example:{{highlight|lang=terminal|code= | |||
# mount -t cifs -o uid=1024,gid=512,credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share | |||
}}<br /> | |||
{{Navbox Linux}} | |||
[[Category:Linux]] | |||
[[Category:LinuxUtilities]] | [[Category:LinuxUtilities]] | ||
Revision as of 03:57, 30 November 2021
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.
Linux
Ensure you have samba-utils installed.
To mount a samba share, use mount.cifs. Credentials can be passed in as mount options.
# mount -t cifs -o username=leo,domain=uc,vers=2.1 //10.1.1.123/share /mnt/share
You can also have the credentials placed in a separate file rather than passing it directly as mount options. Create a file with the username, password, and optionally domain defined and then mount using the credentials=filename option. For example:
## Create a file. Ensure it's not world readable.
# cat /etc/cifs_passwd
username=leo
password=53cr3T$
domain=uc
# mount -t cifs -o credentials=/etc/cifs_passwd,vers=2.1 //10.1.1.123/share /mnt/share
Default user/group ID
To set the default user/group ID, define the uid and gid value as part of the mount options. For example:
# mount -t cifs -o uid=1024,gid=512,credentials=/etc/cifs_passwd //10.1.1.123/share /mnt/share