I'm currently mounting my shared drive using

cifs -o "username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g)" //server-address/folder /mount/path/on/ubuntu

I'm trying now to run this command using a desktop shortcut instead of terminal so I did this:

  1. Right click the desktop and create an empty file named connecttoshareddrive.desktop.
  2. Pasted this into this file:

    [Desktop Entry] Name=Connect to shared drive Exec=cifs -o "username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g)" //server-address/folder /mount/path/on/ubuntu Terminal=true Type=Application

But it's not working, and I don't know how to debug so I wonder what I'm missing?

  • $(id -u) is a shell (e.g. bash) syntax; your .desktop file is not a shell parser. – Ipor Sircer Jul 23 '18 at 10:20
  • @IporSircer So is there a way to run this mount without using terminal? – Tak Jul 23 '18 at 10:22
  • of course; terminal is not shell. But you can run shell from .desktop, like Exec=sh -c "<blablabla...>". – Ipor Sircer Jul 23 '18 at 10:26
  • @IporSircer I tried changing it to Exec=sh -c " Exec=cifs -o "username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g)" //server-address/folder /mount/path/on/ubuntu" but it didn't work – Tak Jul 23 '18 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.