Difference between revisions of "File shares"
Line 24: | Line 24: | ||
Usage: | Usage: | ||
− | + | <code>smbclient -L <server> -U username</code> | |
This will show you all the mounts available to you on that machine. | This will show you all the mounts available to you on that machine. | ||
Line 30: | Line 30: | ||
To test the mount: | To test the mount: | ||
− | + | <code>sudo mount //server/share -ousername=username,domain=wur /tmp/smb</code> | |
This will hold until you unmount it. | This will hold until you unmount it. | ||
Line 38: | Line 38: | ||
The above example will only mount when called. You want it to mount on boot. However, a simple issue is present - you must authenticate to mount. Thus, you need to have some credential stash. Modify the options to this: | The above example will only mount when called. You want it to mount on boot. However, a simple issue is present - you must authenticate to mount. Thus, you need to have some credential stash. Modify the options to this: | ||
− | + | <nowiki>//WURNET.NL/Homes/username /mnt/mdrive cifs credentials=/home/localuser/.smbpassword,user,username=username,domain=wur,uid=localuser,gid=localuser 0 0</nowiki> | |
Then you can make the credential file. Set it 600 so that only you or root may read or write. | Then you can make the credential file. Set it 600 so that only you or root may read or write. | ||
− | + | <code>cd ~</code> | |
− | + | ||
− | + | <code>echo username=username > .smbpassword</code> | |
− | + | ||
+ | <code>echo password=mypassword >> .smbpassword</code> | ||
+ | |||
+ | <code>chmod 600 .smbpassword</code> | ||
Line 54: | Line 57: | ||
Most modern CIFS implementations are able to handle DFS properly, thus a config like: | Most modern CIFS implementations are able to handle DFS properly, thus a config like: | ||
− | + | <nowiki>//scomp0863/DFS-Root /mnt/wdrive cifs noauto,user,username=username,domain=wur 0 0</nowiki> | |
Should work. | Should work. |
Revision as of 14:36, 26 January 2018
Contents
Mounting Home Directories - CIFS
As WUR has moved to a new home directory storage method, the path to finding it is much simpler:
Write yourself an /etc/fstab entry that looks like this:
- //WURNET.NL/Homes/username /mnt/mdrive cifs noauto,user,username=username,domain=wur,uid=localuser,gid=localuser 0 0
(Replace username with your own WUR account name, and localuser with the account you have locally)
Now you can simply:
mount /mnt/mdrive
And after entering your password, you have access to your M drive share.
Caveats
This may occasionally not work on the first try, as the hostname WURNET.NL points to multiple machines. You may need to do this repeatedly to get a stable connection.
The easiest way to gather information about available CIFS shares is using smbclient. On Ubuntu, you need the pacakge 'smbclient' to provide this.
Usage:
smbclient -L <server> -U username
This will show you all the mounts available to you on that machine.
To test the mount:
sudo mount //server/share -ousername=username,domain=wur /tmp/smb
This will hold until you unmount it.
Automatically mounting at boot (/etc/fstab)
The above example will only mount when called. You want it to mount on boot. However, a simple issue is present - you must authenticate to mount. Thus, you need to have some credential stash. Modify the options to this:
//WURNET.NL/Homes/username /mnt/mdrive cifs credentials=/home/localuser/.smbpassword,user,username=username,domain=wur,uid=localuser,gid=localuser 0 0
Then you can make the credential file. Set it 600 so that only you or root may read or write.
cd ~
echo username=username > .smbpassword
echo password=mypassword >> .smbpassword
chmod 600 .smbpassword
What is the DFS-Root
DFS is Microsoft's Distributed File System. The purpose of a distributed file system is that the user can access files without knowing on which server the files are locates. The root of a distributed files system is called the DFS-Root. In the DFS-Root are virtual directories which are actual 'links' to shares on some servers.
Most modern CIFS implementations are able to handle DFS properly, thus a config like:
//scomp0863/DFS-Root /mnt/wdrive cifs noauto,user,username=username,domain=wur 0 0
Should work.