Menu

Mounted samba share in linux – cannot create regular file ‘FILENAME’: Permission denied

0 Comments

logo
Error thrown during file copy: “cp: cannot create regular file” – but file are created.

Something connected to file permission… 😀

 

Cannot chmod target file "FILENAME"
Operation not permitted (1)

001. Introduction.

Usually i mounted share from windows with something like that one:

mount -t cifs //192.168.0.130/litwin /media/130/litwin -o "username=USERNAME,password=PASSWORD"

and sometime i got an error during file copy:

[litwin@forum ~]$ cp /home/litwin/multipageproject.pdf /media/130/litwin/adasdsadasdsa/
cp: cannot create regular file ‘/media/130/litwin/adasdsadasdsa/multipageproject.pdf’: Permission denied

 

 

or in graphical mode (Midnight Commander):

Midnight Commander error - chmod

Midnight Commander error – chmod

 

 

 

But file are created with correct rights:

[litwin@forum ~]$ ll /media/130/litwin/adasdsadasdsa/
 total 262144
 -rw-r----- 1 1026 users 7723920 Jan 8 23:48 multipageproject.pdf

 

When i check remote filesystem, everything looks good – file created (above) as user 1026 (lower – litwin user), group are also correct.

litwin:x:1026:100::/var/services/homes/litwin:/sbin/nologin
-rw-r----- 1 litwin users 7723920 Jan 8 23:51 multipageproject.pdf

Where is the problem?


 

 

002. Solution

This is simple… Mount with “noperm” option.

mount -t cifs //192.168.0.130/litwin /media/130/litwin -o "username=USERNAME,password=PASSWORD,noperm"
 

And this is all…

 

If problem still persist, try to add uid + gid.
They are displayed as numberic in remote /etc/passwd file – USERNAME:x:UID:GID:………

mount -t cifs //192.168.0.130/litwin /media/130/litwin -o "username=USERNAME,password=PASSWORD,noperm,uid=1026,gid:100"

 

 

 

 

 

 

 

.

Tags: , , ,
Translate »