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:26] – 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 53: | Line 52: | ||
</ | </ | ||
- | ---- | ||
- | |||
- | Make the following entry in your /etc/fstab file : | ||
- | |||
- | <file bash / | ||
- | // | ||
- | </ | ||
- | |||
- | Now when the share is mounted all files and folders will appear as the user with uid 1000. | ||
---- | ---- | ||
Line 77: | 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 93: | 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 105: | Line 97: | ||
</ | </ | ||
- | Next create | + | ---- |
+ | |||
+ | ==== Create mount points ==== | ||
+ | |||
+ | Create | ||
<code bash> | <code bash> | ||
Line 113: | Line 109: | ||
</ | </ | ||
- | Make sure you have cifs installed. | + | ---- |
- | Edit **/ | + | ==== Edit /etc/fstab ==== |
+ | |||
+ | Edit **/ | ||
<file bash / | <file bash / | ||
Line 122: | Line 120: | ||
// | // | ||
</ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | ** NOTE:** If the system complains add the ' | ||
+ | </ | ||
---- | ---- | ||
- | ==== Mount the shares | + | === Mount the shares === |
<code bash> | <code bash> | ||
sudo mount -a | sudo mount -a | ||
</ | </ | ||
+ | |||
+ | or Reboot. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Extended fstab settings ===== | ||
+ | |||
+ | Make the following entry in your /etc/fstab file : | ||
+ | |||
+ | <file bash / | ||
+ | // | ||
+ | </ | ||
+ | |||
+ | Now when the share is mounted all files and folders will appear as the user with uid 1000. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | <WRAP info> | ||
+ | **__FURTHER INFORMATION: | ||
+ | |||
+ | |||
+ | **__dir_mode / file_mode__** | ||
+ | |||
+ | Setting the uid or gid is fine if you are the only user of the system. | ||
+ | |||
+ | On a multiuser system this is problematic as other users will still be denied. | ||
+ | |||
+ | Therefore use **dir_mode / file_mode** to give everyone access: | ||
+ | |||
+ | |||
+ | <file bash / | ||
+ | // | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== 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> | ||
+ | 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.1575836798.txt.gz · Last modified: 2020/07/15 09:30 (external edit)