23

We have a windows file server with an address like this:

\\bioinf-filesrv2.mycompany.fr\cluster15

How can I access it from Linux?

On a Ubuntu 14.04 I tried to access this through nautilus, but it crashed. Here is the crash report:

http://pastebin.mozilla.org/5533388

polym
  • 10,672
  • 9
  • 41
  • 65
qed
  • 2,529
  • 6
  • 21
  • 27
  • 1
    Please give us some more information. What Linux are you running? Do you have a graphical interface? Have you tried opening the file browser (just clicking on any directory) and checking the network section? Also, [we expect users](http://unix.stackexchange.com/help/how-to-ask) to first try and solve their issue themselves before posting here. Did you try any of the [several thousand results](https://duckduckgo.com/?t=lm&q=How+to+access+windows+file+server+from+linux) you get when copy/pasting your question's title into a search engine? How did they fail? – terdon Jul 08 '14 at 12:56

3 Answers3

22

Assuming a recent Linux, do this:

$ mount -t cifs //bioinf-filesrv2.mycompany.fr/cluster15 /mnt

Which will mount it at /mnt. You will need sufficient privilege (or be root).

If you need to add credentials, try:

$ mount -t cifs -o username=myuser,password=mypass //bioinf-filesrv2.mycompany.fr/cluster15 /mnt

You may need to install a package from your distro's repository called cifs-utils but, hopefully, it would already be there as part of the standard install.

polym
  • 10,672
  • 9
  • 41
  • 65
starfry
  • 7,302
  • 6
  • 47
  • 69
  • It is secure to put password on the command line? – qed Jul 08 '14 at 13:23
  • Only as secure as where the command-line is. If you're putting them in a script then they are as secure as the permissions in that script. There is an alternative which is to use a credentials file. This is described [here](https://www.samba.org/samba/docs/man/manpages-3/mount.cifs.8.html). – starfry Jul 08 '14 at 15:11
  • On Debian GNU/Linux 10 (buster), I get a `bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program.` UPDATE: OK, I probably need to `apt install cifs-utils`... – NoOne Dec 24 '19 at 13:04
  • If you don't want to put your password in the command line, just use `mount -t cifs -o username=myuser //bioinf-filesrv2.mycompany.fr/cluster15 /mnt` and then you will be asked to enter your password. – Sina Jul 19 '22 at 14:17
8

I'd suggest adding it to your /etc/fstab, so it's online as soon as you boot. Mine has a (long) line reading:

//1.2.3.4/share_name/    /media/mount_point    cifs    uid=1000,guid=1000,rw,credentials=/etc/cifspasswd    0    0
  • The first field is the address and share name.
  • The second field is the mount point on your system (the folder must exist).
  • cifs is the type of the file system for any Windows share.
  • uid=1000,guid=1000,rw means that anyone on the system can access this share
  • credentials=/etc/cifspasswd means that that credentials found in /etc/cifspasswd will be used to authenticate access to the share on the Windows server.

This credential file should contain the username and password necessary for accessing the Windows share, i.e.

username=foo
password=bar

As /etc/fstab is (usually) readable by other users of the system, you can create the file as root and chmod go-=rwx to remove access for other users, to protect your password.

Caveat If you boot your system and the server isn't available, Linux will wait a bit during the boot sequence before giving up.

polym
  • 10,672
  • 9
  • 41
  • 65
Marmaduke
  • 261
  • 1
  • 3
  • 1
    This worked great for me, except the options part of the line should be: `uid=1000,gid=1000,rw,credentials=/etc/cifspasswd`. Note that the `guid` was changed to `gid`. – Michael Johnson Mar 27 '17 at 19:41
  • 1
    Oh, and I had to change the file system section to use `\040` for spaces (gotta love Windows admins). Got that info from [this Stack Overflow answer](http://stackoverflow.com/questions/15316017/how-do-i-specify-a-label-path-with-spaces-in-etc-fstab). – Michael Johnson Mar 27 '17 at 19:47
5

In Ubuntu click alt+f2.

Type smb://bioinf-filesrv2.mycompany.fr/cluster15. Enter.

See the new mount in Nautilus.

Source: http://www.howtogeek.com/howto/29167/3-easy-ways-to-connect-to-windows-shared-folders-from-linux/

AlikElzin-kilaka
  • 561
  • 1
  • 8
  • 20