File shares

From LUG
Revision as of 13:41, 3 March 2015 by GwenD (talk | contribs) (Splitting up the enormous Linux@WUR page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using the department fileserver

Finding the location of a share

In order to use the guides below, you'll have to know on which servers the windows shares reside. The easiest way is to use a Windows PC, start up Explorer, got to the share and look at the Properties.

Alternatively, you can use smbclient to find all shares on a server:

  • smbclient -I <server> -W -U yourname001 -L <server>

Where <server> is scomp0300 for PSG and scomp0291 for ESG.

Using smbmount (normal user)

Suppose the server your personal share is located on is called sdep001 and your username is annie001, your password is annie, and you want to mount this share on ~/mnt If you do not know this information you can get it out of the ActiveDirectoryServer or from the "My Computer" screen of a windows machine.

  • smbmount '//sdep001/annie001$' ~/mnt/ -o username=annie001,password=annie,workgroup=WUR

if you leave out the password, the program will ask you for your password during the mounting:

  • smbmount '//sdep001/annie001$' ~/mnt/ -o username=annie001,workgroup=WUR

Using mount (as root) =

you can also do this using regular mount, as Stephan Verrips writes:

  • mount -t smbfs -o username=verri001, //$ ~/mnt

Alternatively, the (newer) CIFS protocol can be used instead of SMB. The following example connects to the 'webdocs' share where web related files can be stored.

  • mkdir /mnt/webdocs
  • mount -t cifs -o username=annie001, //$ /mnt/webdocs

Automatically mounting at boot (/etc/fstab)

Add the following line to the file /etc/fstab

 //sdep001/annie001$ /mnt/wur smbfs username=annie001,password=annie,workgroup=WUR,uid=502 0 0

or a really working example for a shared network drive (for DPW - note the odd spaces in the name using \040):

//scomp0300/PSG~DPW\040Laboratory\040of\040Nematology$ /mnt/wur smbfs username=annie001,password=annie,workgroup=WUR,uid=501 0 0 

or try

//scomp0300/PSG~DPW\040Laboratory\040of\040Nematology$ /mnt/wur smbfs //username=annie001,password=annie,workgroup=WUR,uid=501 0 0 

The uid represents the user id you use - check your id with the id command:


it is also possible to use a gid (group id) to share the mounted drive with multiple users on one system.

Note: since it contains your password this option is not so secure!

 Safer is to use a separate password file:
  • cd ~
  • echo username=annie001 > .smbpassword
  • echo password=annie >> .smbpassword
  • chmod 600 .smbpassword
 This created a hidden password file that can only be read by you or the root

Change the line in the /etc/fstab into

  • //sdep001/annie001$ /mnt/wur smbfs credentials=/home/annie/.smbpassword,workgroup=WUR,uid=502 0 0

Note: you set the uid to your user id (see 'man id') so you can write/read from your normal account.

Another example, again using the CIFS protocol instead of SMB, to automatically connect to the 'webdocs' share:

  • //$ /mnt/webdocs cifs credentials=/home/annie/.smbpassword,,uid=502 0 0

Using Konqueror

Windows shares can also be accessed, without any mounting, with the SMB kio slave (KDE). The SMB kio slave can be used in Konqueror but also in other KDE applications.

The format of the url is:


where e.g.:

  • username: wur\annie001
  • hostname:
  • sharename: annie001$


If you get the error "Connection to .... failed" and you are sure you typed the server name correctly, you have to manually set the wins server in /etc/samba/smb.conf. Find the line that reads like:

  •  ; wins server = <something>

Remove the ; and change the <something>:

  • wins server =