Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Why can Evince not save to samba shares?

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
mrspuck
Posts: 26
Joined: 2017-11-20 09:28
Has thanked: 1 time

Why can Evince not save to samba shares?

#1 Post by mrspuck »

Hello,

I am saving PDF files on a Samba share that I mount from /etc/fstab with lines like the following:

Code: Select all

//192.168.2.2/share /mnt/share cifs guest,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,iocharset=utf8,x-systemd.automount 0 0
When I open a PDF from a directory on this share in Evince, add annotations and try to save the PDF, this fails with following error message in Evince:

Code: Select all

The file could not be saved as “file:///mnt/share/test.pdf”.
Error renaming temporary file: Permission denied
I do have write permission to the folder and can create files where the PDF is stored.
Does anyone know where Evince may be trying to create the temp file, or what else may be going wrong?
This seriously impacts my productivity, having to copy files forth and back every time I edit them.
There is no additional info when I start Evince from a console.

Thanks

User avatar
kent_dorfman766
Posts: 529
Joined: 2022-12-16 06:34
Location: socialist states of america
Has thanked: 56 times
Been thanked: 69 times

Re: Why can Evince not save to samba shares?

#2 Post by kent_dorfman766 »

Have you tried different variations of PDF files and different names for the files, or just reporting based on a single file failure?
Can you save the annotated file to a local filesystem?
Are you sure the share allows writing to it as guest? uid/gid options just tell mount what to alias the owners as on the client side.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: Why can Evince not save to samba shares?

#3 Post by CwF »

This has something to do with your method. I do have a mix to test with but not your exact example. Opening and saving to smb for me only works with installations that provide a fuse link in /run/user/uid/gvfs/smb-share:...
So any fuse or fuse3 configured install should work. On installations without that link evince will default to a local last used directory, or fail if redirected to the share. Also related maybe in my examples without fuse also fail to query meta data on any smb file while still able to open.

User avatar
NFT5
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 596
Joined: 2014-10-10 11:38
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 41 times

Re: Why can Evince not save to samba shares?

#4 Post by NFT5 »

Finding what is causing this takes a very methodical approach.

First start the machine where your Samba share resides. If that folder is mounted from a drive in fstab, then disable that line in fstab. You need to look at the permissions of the empty folder, not what is mounted to that point.

For example, I have a server that holds a lot of files that I might work on or access from other machines, but let's just look at my desktop and, for an example, I'll use the folder that I store music in. On the server there is a folder named MUSIC in the /home folder. When the server boots it mounts a specific drive (sdg1 in my case) to that folder. So I have a line in the fstab file which looks like this:

Code: Select all

UUID=58828b62-2ada-4d87-a559-1d225fbc4384	/home/chris/MUSIC	ext4	defaults	0	0
So, for this exercise I'd need to comment out that line with a # at the beginning of the line and reboot the machine. Now I can negotiate my way to the folder at /home/MUSIC which will, of course, be empty but I can look at the permissions for that folder only, not what would otherwise be mounted there. Using ls -l I get:

Code: Select all

drwxrwxrwx 2 chris chris 
Which tells me that I, as the owner, can read, write and modify and so can members of my group as well as any others. This is what I want, so it's ok. There's more on this line but it's not relevant here, so I've left it out.

Now I need to edit fstab again, this time removing the # from the beginning of the line that mounts the drive to the folder at /home/chris/MUSIC. I do that and reboot.

This time, when I run ls -l I get

Code: Select all

drwxrwxrwx 1687 chris chris
This tells me that what is now mounted there has the same permissions (read, write and modify) for myself, my group and others.

Just a note here - I allow others permission to read, write and modify because other members of my family might want to add files to our music collection. If this was more sensitive data then the permissions might be different, as perhaps they may be depending on who might have access to this drive. You need to make your own decisions on this for your case.

Now have a look at your Samba configuration file, which is /etc/samba/smb.conf. I use Kate, but you could use your text editor or nano or vim. At or near the end of smb.conf is a section, as follows:

Code: Select all

[MUSIC]
path = /home/chris/MUSIC
available = yes
browsable = yes
public = yes
writable = yes
These permissions must agree with those you've set for the individual files and/or folders. If not, make any necessary changes, save the file and reboot.

Now move to your client machine, in my case, my desktop. As above, when booting, the share folder MUSIC is mounted to /home/chris/MUSIC. This is done in fstab by the line:

Code: Select all

//10.1.1.10/MUSIC   /home/chris/MUSIC  cifs    uid=1000,credentials=/home/chris/.smb,file_mode=0775,dir_mode=0775     0   0
Note that I use a credentials file to ensure that correct information is relayed to the server on who I am and therefore should be allowed access,

Repeat the exercise that you've just completed on the other machine, checking permissions of the folder that you're mounting the share drive to.

If I run ls -l I get:

Code: Select all

drwxrwxr-x   2 chris root
I could, if I wanted, give my group permissions instead of the root group and achieve almost the same result but since I'm the only one who uses this machine it doesn't matter. Make your own decision here. Others can read only since there shouldn't be any others on this machine. Note that on the PC that runs our audio visual, in the lounge next to the TV and sound systems, that I allow much more relaxed permissions since any one of the family might be signed in there. Again, look at your use case and make appropriate decisions.

If you have a /etc/samba/smb.conf file on the client machine then check permissions there, just as done before on the server.

One final word. If you're mounting drives from remote machines and using fstab to do it on boot, then I've generally found it's a better idea to create the mount point yourself (so it gets your permissions), preferably somewhere in your /home folder. If you let fstab create the mount point then it will get root permissions, unless you specify otherwise in fstab. I find that all too complex, so just create the mount points myself. Only need to do it once and their permissions are what I need.

mrspuck
Posts: 26
Joined: 2017-11-20 09:28
Has thanked: 1 time

Re: Why can Evince not save to samba shares?

#5 Post by mrspuck »

kent_dorfman766 wrote: 2023-01-29 14:16 Have you tried different variations of PDF files and different names for the files, or just reporting based on a single file failure?
Can you save the annotated file to a local filesystem?
Are you sure the share allows writing to it as guest? uid/gid options just tell mount what to alias the owners as on the client side.
The problem happens with all PDF files in Evince. I could save them to a local drive but that takes too much time.
I can however save text files to the mounted samba share, so the problem is with Evince, not the mounted file system itself.

mrspuck
Posts: 26
Joined: 2017-11-20 09:28
Has thanked: 1 time

Re: Why can Evince not save to samba shares?

#6 Post by mrspuck »

CwF wrote: 2023-01-29 19:00 This has something to do with your method. I do have a mix to test with but not your exact example. Opening and saving to smb for me only works with installations that provide a fuse link in /run/user/uid/gvfs/smb-share:...
So any fuse or fuse3 configured install should work. On installations without that link evince will default to a local last used directory, or fail if redirected to the share. Also related maybe in my examples without fuse also fail to query meta data on any smb file while still able to open.
I am not sure I understand what you are saying. Previously I mounted the SMB shares through nautilus. When double clicking files mounted that way, the application gets passed a URL starting with smb:. Some applications do not understand such URLs, so I switched to the method using /etc/fstab. That created problems booting the machine when the network connection was coming up late. So I added the parameter that mounts on demand. Still it seems I cannot find a method to perform this simple task.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: Why can Evince not save to samba shares?

#7 Post by CwF »

mrspuck wrote: 2023-02-03 21:01 Still it seems I cannot find a method to perform this simple task.
I'm simple in my ways so I use xfce with it's helper gigolo. Of all the methods for smb I almost know one.

Anyway, in limited testing I managed to knock off the smb connection for other users! Their gigolos had their smoke break and remounted with a click. I used a few older installations to duplicate evince mucking up the works and it simply expects a gvfs mount, not a fstab cifs alternative whatever. It is an issue with evince and since gvfs works (same bed) I'd expect a 'will not fix'.
My limited summary is for bullseye up, use fuse3 in whatever way it integrates with your chosen desktop. My smb server was the same in all these test, so nothing to do with that end of things.

Gigolo can automate the mount and will be late with user logon and not boot, better I think. I'm sure there are some other ways.

Post Reply