Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Sublime Text 2 from removing the "Read & Execute" flag upon save

Using Sublime Text 2, I sometimes have to edit shell files that are executed by bash in a cron. However, when I save these files, the execute flag is being removed from the file, causing the cron to fail when trying to execute the file. I have to chmod the file every time I change it. Previously, using Ultra-Edit, I never had this issue.

Has anyone else dealt with this issue who can recommend a fix or solution?

like image 381
Michael Irigoyen Avatar asked Aug 07 '12 20:08

Michael Irigoyen


2 Answers

Assuming you are editing files through Samba, Sublime Text seems to recreate the file every time it saves it, with the default umask, and not preserve the old permissions.

The workaround to get +x permissions is to set

create mask = 755

in your Samba's smb.conf file in the relevant share section.

The downside, every new file will have +x now.

like image 33
Jürgen Strobel Avatar answered Nov 14 '22 23:11

Jürgen Strobel


This problem can be fixed by disabling the map_archive feature of samba.

[global]
map archive = no

This should solve the problem.

Source

like image 59
Evan Purkhiser Avatar answered Nov 14 '22 21:11

Evan Purkhiser