ubuntu:samba:mount_a_windows_share
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:samba:mount_a_windows_share [2019/12/08 20:33] – peter | ubuntu:samba:mount_a_windows_share [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 18: | Line 18: | ||
mount -t cifs -o username=USERNAME, | mount -t cifs -o username=USERNAME, | ||
</ | </ | ||
+ | |||
---- | ---- | ||
Line 27: | Line 28: | ||
<code bash> | <code bash> | ||
mount -t cifs -o username=USERNAME, | mount -t cifs -o username=USERNAME, | ||
- | |||
- | sudo mount -t cifs -o username=${USER}, | ||
</ | </ | ||
Line 68: | Line 67: | ||
</ | </ | ||
- | which will look like: | + | </ |
- | <file bash /etc/fstab> | + | ---- |
- | // | + | |
- | </file> | + | |
+ | <code bash> | ||
+ | sudo mount -t cifs -o username=${USER},password=${PASSWORD},uid=$(id -u), | ||
+ | </code> | ||
- | </ | ||
---- | ---- | ||
Line 84: | Line 85: | ||
===== fstab persistent mount ===== | ===== fstab persistent mount ===== | ||
- | Quick basic example of a cfis mount entry in fstab to connect to shares | + | Permanently |
- | Permanently mount the shares so that they will be available after reboot. | + | ==== Edit the host file ==== |
Edit your **/ | Edit your **/ | ||
Line 96: | Line 97: | ||
</ | </ | ||
- | Next create | + | ---- |
+ | |||
+ | ==== Create mount points ==== | ||
+ | |||
+ | Create | ||
<code bash> | <code bash> | ||
Line 104: | Line 109: | ||
</ | </ | ||
- | Make sure you have cifs installed. | + | ---- |
- | Edit **/ | + | ==== Edit /etc/fstab ==== |
+ | |||
+ | Edit **/ | ||
<file bash / | <file bash / | ||
Line 113: | Line 120: | ||
// | // | ||
</ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | ** NOTE:** If the system complains add the ' | ||
+ | </ | ||
---- | ---- | ||
+ | |||
+ | === Mount the shares === | ||
+ | |||
+ | <code bash> | ||
+ | sudo mount -a | ||
+ | </ | ||
+ | |||
+ | or Reboot. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Extended fstab settings ===== | ||
Make the following entry in your /etc/fstab file : | Make the following entry in your /etc/fstab file : | ||
Line 125: | Line 148: | ||
---- | ---- | ||
+ | |||
+ | <WRAP info> | ||
+ | **__FURTHER INFORMATION: | ||
+ | |||
**__dir_mode / file_mode__** | **__dir_mode / file_mode__** | ||
Line 143: | Line 170: | ||
---- | ---- | ||
- | ==== Mount the shares | + | ===== Extende fstab to assign full permissions to newly created files and directories ===== |
+ | |||
+ | Add these lines to / | ||
+ | |||
+ | <file bash / | ||
+ | ... | ||
+ | create mask = 0666 | ||
+ | force create mode = 0666 | ||
+ | directory mask = 0777 | ||
+ | force directory mode = 0777 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | This gives 0777 permission to every samba users in the write list for new created directory or files. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Hide Credentials ===== | ||
+ | |||
+ | Setup a credentials file so you don't need to enter your password in the command; causing it to be stored in your command history in plain-text) or at the prompt (a nuisance). | ||
<code bash> | <code bash> | ||
- | sudo mount -a | + | sudo mount -t cifs //nas/docs / |
</ | </ | ||
+ | |||
+ | Note the **credentials option** | ||
+ | |||
+ | <file bash / | ||
+ | username=peter | ||
+ | password=[REAL PASSWORD] | ||
+ | domain=WORKGROUP | ||
+ | </ | ||
ubuntu/samba/mount_a_windows_share.1575837210.txt.gz · Last modified: 2020/07/15 09:30 (external edit)