For me, it always opens the swap file in the same directory as the file. In fact, it's configurable, and you can tell it to put them all into a hidden temporary directory or something else.
It does inherit the permissions from the original file - but the problem is not the swap file permissions, but the swap file location.
E.g. open /home/testuser/bin/test.sh, vim will create a swap file in /var/tmp/test.sh.swap - alas, /var/tmp is open for all users, while /home/testuser is open only for testuser. Bingo: attack vector.
- Gilboa
For me, it always opens the swap file in the same directory as the file. In fact, it's configurable, and you can tell it to put them all into a hidden temporary directory or something else.
Because we all compile VIM by hand and never use the distribution supplied packages.
(I'd add something funny comparing your IQ to my shoe size, but its 5.36 am and I'm far too tired and busy to spent any mental resources on mocking you.)
Flames aside, I should fix my previous message, at least in the Fedora package, vim seems to alternate between using /var/tmp and using the local directory when it comes to placing the .swap file, when backupdir isn't defined in vimrc. I assumed that it was a global behavior and not Fedora specific. (Guess I was wrong).
- Gilboa
/backupdir/dir[ectory]/ isn't defined.
hehe... Fedora is using world writeable directory (/var/tmp) as the the alternate swap and my IQ is low?
Here. Fixed it for you.
- Gilboa
Same here. (Was too early, had a short fuse).
Both me and my shoes apologies.![]()