CIFS: file getting locked after editing with vi/vim

Issues related to applications and software problems
Post Reply
NdFeB
Posts: 9
Joined: 2017/02/03 16:39:04

CIFS: file getting locked after editing with vi/vim

Post by NdFeB » 2017/06/20 18:02:37

Hello,

I have an heterogeneous share, between Linux and Windows systems, hosted on a NetApp. On Linux, I mount the share with those options:

Code: Select all

mount.cifs -o username=`logname`,dom=DOMAIN,cifsacl,multiuser,user_xattr,sec=krb5,iocharset=utf8,noserverino,mapchars //host/share /home/`logname`/mnt
All permissions (set from Windows) are correctly honored. However, there is a strange behavior:

If a user opens a file he created on Windows (or a copy of it) with vim or vi, the file is opened in readonly mode. If he modifies and writes it with :w!, the file gets locked, and cannot be read anymore, even by an administrator or root (permission denied). It can only be deleted by one of those. Gedit opens such files the same way: read only.

However, when such a file is opened with nano, it is precised [converted from DOS format], and when saved, it is flagged [dos format]. The file gets written, and no problem occurs at all.

Do you have any idea why it behaves like that ?

(I already tried to disable backups and swap files in /etc/vimrc. Also tried :w! ++ff=dos and ++ff=unix, without success )

Thanks!

PS: sorry but didn't know where to post this, "software" section for mount.cifs (which was part of samba suite for long), or "network".

Post Reply