Skip to main content
clarify problem
Source Link

I have an SMB share mounted through nautilus. I am noticing that the gnome-screenshot tool seems to be able to access this mounted share automatically, as I do not get any password prompt when running the following:

gnome-screenshot -w -f "smb://<server>/<share>/path/image.png" 

This works and I see the uploaded screenshot.

I would then like to create/upload a text file from a bash variable with no user interaction, but I am unhappy with the solutions I have come up with so far:

  • echo directly into the mountpoint of the share (/run/user/XXXX/gvfs/...)
    • I don't love having long hardcoded paths that contain userIDs and server addresses that may change, however unlikely
  • Use smbclient to put a copy of the file after creating it locally
    • Requires me to either enter credentials again, or store it in the bash file

Is there a way to make smbclient recognize the already mounted share without re-entering credentials, or is there another tool like gnome-screenshot that would allow me to accomplish similar functionality with a text file?

Or, is the ugly mountpoint solution the best there is?

I have an SMB share mounted through nautilus. I am noticing that the gnome-screenshot tool seems to be able to access this mounted share automatically, as I do not get any password prompt when running the following:

gnome-screenshot -w -f "smb://<server>/<share>/path/image.png" 

This works and I see the uploaded screenshot.

I would then like to create/upload a text file, but I am unhappy with the solutions I have come up with so far:

  • echo directly into the mountpoint of the share (/run/user/XXXX/gvfs/...)
    • I don't love having long hardcoded paths that contain userIDs and server addresses that may change, however unlikely
  • Use smbclient to put a copy of the file after creating it locally
    • Requires me to either enter credentials again, or store it in the bash file

Is there a way to make smbclient recognize the already mounted share without re-entering credentials, or is there another tool like gnome-screenshot that would allow me to accomplish similar functionality with a text file?

Or, is the ugly mountpoint solution the best there is?

I have an SMB share mounted through nautilus. I am noticing that the gnome-screenshot tool seems to be able to access this mounted share automatically, as I do not get any password prompt when running the following:

gnome-screenshot -w -f "smb://<server>/<share>/path/image.png" 

This works and I see the uploaded screenshot.

I would then like to create/upload a text file from a bash variable with no user interaction, but I am unhappy with the solutions I have come up with so far:

  • echo directly into the mountpoint of the share (/run/user/XXXX/gvfs/...)
    • I don't love having long hardcoded paths that contain userIDs and server addresses that may change, however unlikely
  • Use smbclient to put a copy of the file after creating it locally
    • Requires me to either enter credentials again, or store it in the bash file

Is there a way to make smbclient recognize the already mounted share without re-entering credentials, or is there another tool like gnome-screenshot that would allow me to accomplish similar functionality with a text file?

Or, is the ugly mountpoint solution the best there is?

Source Link

Is there a better way to upload to a mounted SMB share without providing credentials again?

I have an SMB share mounted through nautilus. I am noticing that the gnome-screenshot tool seems to be able to access this mounted share automatically, as I do not get any password prompt when running the following:

gnome-screenshot -w -f "smb://<server>/<share>/path/image.png" 

This works and I see the uploaded screenshot.

I would then like to create/upload a text file, but I am unhappy with the solutions I have come up with so far:

  • echo directly into the mountpoint of the share (/run/user/XXXX/gvfs/...)
    • I don't love having long hardcoded paths that contain userIDs and server addresses that may change, however unlikely
  • Use smbclient to put a copy of the file after creating it locally
    • Requires me to either enter credentials again, or store it in the bash file

Is there a way to make smbclient recognize the already mounted share without re-entering credentials, or is there another tool like gnome-screenshot that would allow me to accomplish similar functionality with a text file?

Or, is the ugly mountpoint solution the best there is?