How can I make a file "permanent" in a Linux live version? - linux

I am working with a live Linux version. If I create a user and that user creates a file, how can I make that file visible for that user after I have restarted the system? (Normally it would be erased)

You can save the file in the device's hard drive, if you are using a CD/DVD.
In case you are using a flash drive, you can save the file in the root / folder.
Note: Be careful with name given in root folder, try to avoid things like boot or other names found in that folder. They are used to start the live system and boot manager usually recognize them based only in file names

Related

How to monitor a directory for file changes without using inotifywait?

I require a VM for developing and my host is where my IDE is. I have discovered that inotifywait does not work with shared folders, as I am sharing a local folder with my Linux guest using Virtual Box.
Basically, I have a simple bash script which needs to watch a directory and wait for any file changes. Inotifywait would be the best option but I cannot get it to work with my shared folder.
I was wondering if there is another option for my problem?
Depending on the sizes of the files and the nature of the changes you could:
Create a checksum (md5, CRC, SHA256) of the files and watch for changes
check the size of the files and watch for changes

Interrupt file-system operation

Assume that I have a directory that should contain only jpg files.
How can I prevent users from adding files that don't have jpg format to that directory?
My initial guess was to use inotify but it doesn't seem to give me the ability to interrupt/block the "operation" on the file / directory.
My second guess was to set the directory to read-only, when a user adds a file I'll check its extension then add the write permission to the directory before it gets an invalid access error.
Assume any file system that Linux supports
This file system will be used by Samba if this is a helpful info.

How to freeze a folder in linux?

I wanna to freeze a folder in red hat so nobody (even root) can not add file into the folder or change files that exist in the folder already, i tried to make folder read only but this does not work and root user can add files normally as before, please somebody help me to solving this problem.
Create a filesystem in a file (eg: an iso file) containing the files you want in the directory then use a loopback mount to mount it read only onto the directory.
Anybody who tries to modify the filesystem normally (including root) will get a "read-only filesystem" error.
No. By design, in Linux, root ignores existing permissions on all entities. However, what you can do is encrypt files so that they can't be read and can't be modified by those who don't know the key. You can't prevent new files from being added, but with both encryption and decryption keys private, you can easily verify if any file is valid.
This also means you can't have either key on your computer!

Renaming executable's image name is giving it write permission

Dear community members,
We have three of same hardware Windows 7 Professional computers. No one of them is connected to a domain or directory service etc.
We run same executable image on all three computers. In one of them, I had to rename it. Because, with my application's original filename, it has no write access to it's working directory.
I setup full access permisions to USER group in working directory manually but this did not solve.
I suspect some kind of deny mechanism in Windows based on executable's name.
I searched the registry for executable's name but I did not find something relevant or meaningfull.
This situation occured after lot of crashes and updates of my program on that computer (I am a developer). One day, it suddenly started not to open files. I did not touch registry or did not change something other on OS.
My executable's name is karbon_tart.exe
When it start, it calls CreateFile (open mode if exist or create mode if not exist) to open karbon_tart.log file and karbon_tart.ini file.
With the files are exist and without the file exists, I tried two times and none of them, the program can open the files.
But if I just rename the name to karbon_tart_a.exe, program can open files no matter if they are exist or not.
Thank you for your interest
Regards
Ömür Ölmez.
I figured out at the end.
It is because of an old copy of my application in Virtual Store.

Preserving permissions while copying from Windows to Linux

I gave execute permissions to a file and then compressed into a zip file in Linux OS. Then I moved this zip file to Windows and again copied it to another Linux server. This time I don't have the execute permission.
I know that we can directly copy the files and folders using scp command withing Linux but I have to let the user copy it from Windows to Linux also.
Please let me know how can I preserve the permissions while copying from Windows to Linux.
Thanks.
Since your executable file is inside a zip-archive it doesn't really matter what filesystem you're on or what operating system you're on. As long as the zip-archive is untouched.
However, as far as I know, zip-archives cannot keep track of file permissions. You can read more about it here:
Maintain file and folder permissions inside archives
It's up to whatever application is actually doing the copy.
But there are serious differences between the idea of file permissions on Linux/UNIX and Windows. UNIX file permissions have the idea of being "executable" which is not something that exists on Windows. Windows files are noted as runnable by their file extension not its permissions.
Furthermore, file permissions on UNIX have the concept of a group owner, and I don't think this exists on Windows so such a thing might not be possible in the strictest sense.
If you just want the writable/readable permissions as assigned to the owner to stick however, it will again depend on the application you are using to do the copy.
More recently, you can also use the Linux subsystem for Windows and zip the file using the linux shell command. I successfully did this recently when copying a executable for AWS from github to my Windows machine, and then up to Amazon.
Thanks for all your responses.
I found 2-solutions for my problem:
I am copying the complete zip file to the Linux server instead of copying a single file. This way it works fine.
Using cygwin helps me in copying the file onto a Linux server by preserving the execute permissions.

Resources