I would like to create a link to a file on a network drive so that I can easily access the file from my computer. I have samba and can access the file using Dolphin on Kubuntu. I can make a link to it in Places. I have several networked files I would like links for. So, I've created a folder to store these links and put a link to that folder in Places. If I drag the link in Places to my link folder the actual file ends up moved into the folder.

  • The networked drive is mounted on /media/user/windowsshare

  • Links are created in: /media/user/path

I tried a few different methods to create a link:

$ ln -s "smb:⁄⁄user@computer⁄path/filename.ext"

This created a link that when clicked gives this message:

Unable to run the command specified. The file or folder /media/user/path/smb:⁄⁄user@computer⁄path/filename.ext does not exist.

$ ln -s "/media/user/windowsshare⁄path/filename.ext"

This created a link that when clicked gives this message:

Unable to run the command specified. The file or folder /media/user/path/windowsshare⁄path/filename.ext does not exist.

The Ctrl-Shift drag and drop method in Dolphin
makes a desktop configuration file smb:⁄⁄user@computer⁄path/filename.ext.desktop which doesn't point to anything and when clicked gives this message:

Could not enter folder smb://user@coolermaster-pc/E/Work  Files/TECH/A_Fabrication/Production_Plan-II.xls.

A link (in the same directory) to a local file /media/user/path/filename.ext works.

  • 1
    you should mount before you create link. if the device isn't mounted; you'll get 'link broken' messages which will correct the moment you mount the device (inc. networked mounts). you don't need to mount in /media; you can 'mount' anywhere (esp. if you use /etc/fstab (file system table which is my choice). sorry I can't help with elegant (i like commands) – guiverc Nov 7 '17 at 11:12
  • @chrisguiver commands are elegant when we construct them well and they do what we ask cleanly. Some weeks ago I made this line in fstab. //coolermaster-pc/E /media/geoffrey/windowsshare cifs rw,credentials=/home/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777 0 0 Should this be doing the trick? What should my link look like if the networked drive is mounted correctly? smb://user@computer/path or something different? – Geoffrey Wheeler Nov 9 '17 at 5:50
  • @guiverc I used df and didn't see my network drive mounted even though there was that line in fstab that made it look like it should be. I edited .smbcredentials and corrected the password to the networked PC. Now the networked drive shows mounted with df. In Dolphin I can create a link to the directory that the file is in. When I create and use a link directly to the file I get: Could not enter folder smb://user@computer/path/filename.ext How can I make it see it as a file and use the related program to open it? – Geoffrey Wheeler Nov 9 '17 at 12:11
  • 1
    I've never created links via gui (dolphin or other file mgr) so I don't know (and aren't will to try as I have no samba devices up; i use nfs). i usually create the links with ln (I recalling have to use -s for soft-links) from term and just use ls to check it works, and within apps just refer to the local path (eg. /mnt/buf128/dir1/dir2 to access my buffalo [backup nas] device 128. I'm used to seeing ,auto or ,noauto in my mount statements in /etc/fstab but that could just because I primarily use nfs (backup scripts that mount offline buf devices use commands to mount not fstab) – guiverc Nov 9 '17 at 23:12

I have no idea how this happened, but you got "Fraction slash" characters (Unicode U+2044) in your filenames:

    ^^             ^

I noticed this cause the italic double-slash in your question looked weird: smb:⁄⁄

Only a "Solidus" (U+2f) is a valid path delimiter, so this command should work:

ln -s "/media/user/windowsshare/path/filename.ext"
  • Thanks! Can you strike out the the smb code as it doesn't work. The only reason why I can think that the slashes came out funny (created by the code) is because I use Thai on my computer. The character set must have been set up funny. – Geoffrey Wheeler Nov 10 '17 at 23:35
  • @GeoffreyWheeler Welcome! Thanks for the suggested edit, but it had some new content I wouldn't agree with. The Super User link about different special slashes is irrelevant, since only a regular slash is valid. The ln command still had the wrong slash character in it, so I fixed that. But I did incorporate some ideas from it, thanks. – wjandrea Nov 10 '17 at 23:47
  • n -s "/media/user/windowsshare/path/filename.ext" created a link with fraction slashes. I don't know how fraction slashes could get in it in the first place. The title of the Super User question is slightly misleading - the answer actually covers all 3 types of slashes. I found it well written and useful - I never knew there is more than one type of slash. It's also unfortunate but I am unable to use unicodes in my Kubuntu. I use Compose instead when I need a special character. I just used the keyboard / to correct the link. – Geoffrey Wheeler Nov 12 '17 at 11:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.