1

Assume I have two folders and a .txt file in a directory such that

/folder1/file.txt
/folder2

Being currently in folder1 I create a symlink with ln -s file.txt ../folder2/. If a now cdinto folder2 and open the symbolic link in vim with vim file.txt the editor opens with an empty file prompting "test.txt" [Permission Denied]in the status bar. Additionally the file only open in "readonly" mode. Is there a way to create a working symlink. I am on Mac OS X.

Update: ls -lR on the original file results in -rw-r--r-- and for the symlink I obtain lrwxr-xr-x.

marc
  • 81
  • 1
  • 5
  • Please update your question with the output of `ls -lR folder{1,2}` so we can see the permissions involved. – trojanfoe Jul 21 '14 at 14:07
  • Symlinks don't bypass permissions. If you don't have permission to open `/folder2/file.txt`, you won't have permission to open `/folder1/file.txt`, either. Keep in mind that permissions (or even the existence of the source) aren't checked when the symlink is created; the source is just a string. – chepner Jul 21 '14 at 14:26
  • I do have the permissions to open and edit the original file. – marc Jul 21 '14 at 14:41

1 Answers1

2

I would suggest trying to enter the complete path to the target. e.g.

ln -s /folder1/file.txt ../folder2/ 

The path to the link can be relative.