Samba multiple file permission masks - vagrant

I'm running windows 7 and using samba with vagrant/virtualbox/ubuntu (all latest). Most of the files in my share are standard code with permission 0664, so in the config I've set create mask = 0664 and that's working great. However I've got a sprinkling of bash files with permission 0755. Most of the time they are in directories with other files that are 0664, so I can't just reconfigure entire directories in my config (nor do I want to keep track of all the directories). Is there some way I can apply a permission to files of a specific extension? Or even better have samba somehow maintain file permissions when saving?
As an aside, I'm using sublime (v3065) on windows to edit the files on my share, so perhaps if it's not doable in the smb config I could modify sublime's properties to do it?

As far as I know there is no way to set samba create masks specifically per file extension. I don't know if Sublime has a way, but I doubt it. There is also no way to set Umask to do this.
In this case, what I would do is create a simple bash script to find .sh / .bash files, and chmod them. Then cron schedule that script to run every (n) minutes. The cpu bandwidth of such a script will be negligible.
If you are not sure how to write the script, or schedule it, let me know and I will show you.
There could be a better answer out there, but at least for now this will solve the problem.
:-)

Related

I s it safe to set Everyone group access at file level in system folder on windows?

Is it obvious that giving access to Everyone with full permissions on folders in the C:\ProgramData is not safe and can lead to privilege escalation.
My question is how is the situation for text files? Is it still dangerous?
Is it obvious that giving access to Everyone with full permissions on folders in the C:\ProgramData is not safe and can lead to privilege escalation.
My question is how is the situation for text files? Is it still dangerous?
No, it is not "dangerous" to give multiple users write access to a .txt file but you will run into problems if multiple users try to edit the file at the same time.
This basically only applies to text files, anything else like HTML or pictures can be problematic if there is a bug in the application that opens these files and a normal user has edited the file to include some exploit and then waits for an administrator to open it.
The program data folder and other common folders are supposed to be read-only for normal users...

Trying to Set a Shortcut to a Directory

Im trying to run several different scripts on my Mac for data stored in different paths. So I put all said scripts into a folder. In order for a script to work, I have to be cd'd to a specific folder required for said script. I use the scripts to get different types of output (ex: Image volumes, MRI info, etc..).
I was wondering if there was a way to store all my scripts in one directory and assign a shortcut to it. That way, I can cd to my folder, and only type something like $ScriptsFolder/Script_1 to have it. Ive seen this done in the FSL software package, where typing $FSLDIR/data/standard would give you the items in that folder.
UPDATE:
Im using Script=/Users/ray/Documents/Script which works until I close down my terminal to start a new one. Any way to make the setup permanent?
EDITED
Found this helpful in the end.
http://www.techradar.com/how-to/computing/apple/terminal-101-creating-aliases-for-commands-1305638
I used it to create a shortcut to my scripts which are all placed in a folder for easy referencing.

Using Innosetup to install to multiple dirs

I'm writing an InnoSetup script to deploy software to a user's machine (default c:/programfiles) but I also want the user to be able to navigate to, say, a portable flash drive as well (like on a second page) and then have the installer load files to the HDD (programfiles) and then have it load files onto their selected flash drive - is this possible? How would I go about executing it?
thanks :)
I am not quite sure what you are trying to do but it sounds possible to me.
As you stated you could do this with a second page where you allow the user to select a drive or a directory where some files are.
You can then iterate over all files and install them into the selected program directory you chose in the setup before.
For more information it would be good if you could provide more information but so far this is the best answer i can give you for the provided information.
Maybe this helps you along when listing up all files in a directory:
Inno Setup: list all file names in an directory
And with this you can copy them:
Inno setup filecopy
And if you want a FolderBrowser use this:
Pascal Scripting: BrowseForFolder

File watcher in shell

I am trying to keep two directories synchronized with the same files in them.
Files are dropped into Directory A throughout the day. I would like to create a file watcher script that will copy files from Directory A to Directory B as soon as they are dropped.
My thought was to run the job every minute and simply copy everything that dropped in the last minute, but I am wondering if there is a better solution out there.
I'm running MKS toolkit under Windows. Different servers, same operating system.
Thanks for your help!
If you use Linux, you can hook into the kernel using the inotify API to get notified if something in a folder changes. There are command line versions like inotifywatch(1) as well.
To copy the files, I suggest to use rsync(1): it is clever, knows how to clean up after itself and it will create new files hidden while they are copied so users and programs are less likely to pick them up before they are complete.

How to make a script auto install under Ubuntu

I have pretty big assignment where I had to create some files for word frequency checks and a bash script connected with a crontab to make these function run under a specific set of folder every 5 minutes.
The last step here is to somehow compress these folders and scripts so anyone can easily install it on another computer, so some sort of auto installer for these scripts.
I'm not really sure what I should use, if a tarball can achieve this or if I need to use some sort of packet manager to be able to complete this step.
I would be really thankful if someone can explain the best way to complete this, and preferably some links to some documentation about this.
Thank you.
--
Just to clarify,
I need this to some how create the directories and subdirectories like it's looking now, and preferably have something that adds the function automaticly to the crontab record.
The proper way to do that is a .deb package. You would install the cron in /etc/cron.d/
You could also use a shar and add the commands you need to that. Or use tar, let the user extract it in a temp directory then tell them to run an installer. In that installer (which you would write) use either ordinary cp commands, or the install command.

Resources