22

I'm maintaining a heterogeneous network of mac and linux so I decided to create a little perl script to unify mounting strategies across machines.

The current implementation in linux is in /etc/fstab works fine:

//myserverhere.com/cifs_share /mnt/cifs_share cifs user,uid=65001,rw,workgroup=DEV,credentials=/root/.cifs 0 0

and /root/.cifs contains

username=ouruser
password=ourpassword

I tried translating that to a non-fstab format as follows:

mount.cifs //myserverhere.com/cifs_share /mnt/cifs_share user,uid=65001,rw,workgroup=DEV,credentials=/root/.cifs

But it doesn't seem to work.

Can someone point out what I'm doing wrong please?

Thanks in advance.

Ismael Casimpan :)

icasimpan
  • 606
  • 3
  • 6
  • 14

3 Answers3

25

Syntax of mount.cifs:

mount.cifs {service} {mount-point} [-o options] 

You need to pass the options after the "-o". For example, with your given options, your command should be:

mount.cifs //myserverhere.com/cifs_share /mnt/cifs_share \
    -o user,uid=65001,rw,workgroup=DEV,credentials=/root/.cifs

(I didn't test the options you gave.)

Barett
  • 103
  • 7
hmontoliu
  • 3,693
  • 3
  • 22
  • 24
  • the '-o' was the one I forgot. Thanks for pointing out. I tried it and it now works. Thank you so much :) – icasimpan Mar 09 '12 at 08:15
  • Also make sure that the credentials text file does NOT contain a byte order mark (BOM) when using UTF-8. Otherwise you will get a strange "Credential formatted incorrectly" message from ```mount```/```mount.cifs```. – ManuelAtWork Jan 10 '18 at 10:23
0

-o vers=1.0 option with mount fixed my issue. After an upgrade of RHEL from 7.4 to 7.7, looks like the SMB protocol version changed. Specify the version to match with the cifs server version.

Harish
  • 1
  • Version 1.0 means classic CIFS/SMBv1 protocol which is used by Windows versions older than Windows 7 or Windows Server 2008. I guess RHEL/Samba tried to stop you from using it after an update. Update your Windows!!!1! – thomas Dec 03 '21 at 19:35
0

The error I got was this one: mount error(5): Input/output error Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

-o vers=3.0 option with mount fixed my issue. I didn't upgrade my server, but my client did and did not inform me about.

-o vers=1.0 option works too as I tested right now.