LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-22-2019, 09:43 AM   #31
ce309
LQ Newbie
 
Registered: Mar 2019
Posts: 15

Original Poster
Rep: Reputation: Disabled

I copied executable files which were labeled as executable in the file manager when single-clicking it (example: usbview, lshw-gtk in /usr/bin) from computer to usb then I was able to execute them even when executable permission was disabled.

I tried executing other file extensions as per the list: https://askubuntu.com/a/174356
But, I wasn't able to execute shared libraries like nethogs (no extension), file extensions .so (runtime object), .a (static library), .elf (executable files not object code files) when executable permission was disabled.

While executing some .o files through the terminal but I got error "cannot execute binary file: Exec format error".

File extensions .exe requires wine executable, .tar requires tar and make shared library (run without ./ as prefix), .deb requires dpkg shared library (run without ./ as prefix). Extension .ko I haven't tried as it is related to drivers and kernel modules.

Basically, as rknichols said execute permission is required when directly executing it. If a file (script/source code, static library, shared library, .bin, .elf, or .so file) can be executed via ./[filename] it can also be executed through the GUI when executable permission is enabled.

Quote:
Originally Posted by michaelk View Post
.bin file indicates a binary file but not necessarily executable.
A .bin can be an executable file (Unix Executable File) or something like a binary disc image etc. Source: https://fileinfo.com/extension/bin

For differentiating between a binary file and binary executable file (or binaries), would you say that if a file is directly executable via command line or GUI then it is a binary executable file else if the binary file requires another program to run it then it is just a binary file? (Example: .jpg is a binary file which requires an image viewer to read/edit it)
 
Old 05-22-2019, 12:28 PM   #32
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,927

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
I still do not understand what is the goal of this thread.
About binary files: https://en.wikipedia.org/wiki/Binary_file
About text files: https://en.wikipedia.org/wiki/Text_file

About executable:
1. you can set or reset the execute flag on [almost] any file. If it was set the system may try to run it, if it was unset the system simply refuses to run/execute it (= even will not try to do anything).
2. a file can be runnable if the system is able to run it. It should have a special format which can be handled by the kernel. These files are usually binaries.
3. a file [or dir] itself is not runnable, but there is an associated executable which can handle the given file. In such cases execute means: run that associated app (belongs to point 2) [instead of the file] and pass the file as an argument to the app. Usually scripts, images, videos, documents (among others) work that way.
4. additionally there are shared objects (like .so files) which are not standalone executables, but real executables or other so files can run the code.

In unix/linux the extension is more or less irrelevant, the system does not care about it at all (but it was already mentioned).
 
Old 05-22-2019, 12:47 PM   #33
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by ce309 View Post
I copied executable files which were labeled as executable in the file manager when single-clicking it (example: usbview, lshw-gtk in /usr/bin) from computer to usb then I was able to execute them even when executable permission was disabled.
Did you read my post explaining about the file manager?
What you are asking is to prevent the file manager from executing certain things. Which file manager are you using, what behavior are you really looking for -- why are you asking ths?
 
Old 05-22-2019, 04:30 PM   #34
ce309
LQ Newbie
 
Registered: Mar 2019
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
I still do not understand what is the goal of this thread.
The topic shifted towards file executing/executables and permissions from the posts #7, #8 and #9.

From my point of view, I am trying to know whether executable permission in Linux is useful for adding an extra layer of security for USB devices apart from features such as disabling autorun, automount, autothumbnailing, USBKill etc.

And this is from the point of view as a Linux user (what the Linux user can control) not from attackers point of view who may use technologies like Bad USB, USB Rubber Ducky etc. As a Linux user, if I give a removable drive to someone to give me some data or just connect a USB device to my computer which I feel may not be safe then I am taking reasonable security measures to prevent viruses from the USB device.

Quote:
Originally Posted by 273 View Post
Did you read my post explaining about the file manager?
What you are asking is to prevent the file manager from executing certain things. Which file manager are you using, what behavior are you really looking for -- why are you asking ths?
I am just using the GUI file manager (Thunar File Manager) to right-click open via terminal emulator for .sh scripts and right-click execute for executables. I have not associated scripts with other programs and then used the file manager to open them. I have run all the files via the terminal emulator by the syntax ./[filename] for checking the executable permission. I have used the file manager as a way to double-check only for .sh scripts and executables. I understand that if I associate a script/file with another program and use the file manager to open it then I am not executing the script/file on the usb rather I am executing that associated program to process the script/file on the usb.

Quote:
Originally Posted by ce309 View Post
I copied executable files which were labeled as executable in the file manager when single-clicking it (example: usbview, lshw-gtk in /usr/bin) from computer to usb then I was able to execute them even when executable permission was disabled.
Correction, I am not able to execute "files labeled as executable in the file manager which do not have any extension" when executable permission is disabled. (Extremely sorry)

And it is not just about security, personally speaking the discussion on file extensions is helpful to me as it describes how the files are handled/executed by Linux. Thank you for the contributions

Last edited by ce309; 05-22-2019 at 04:36 PM.
 
  


Reply

Tags
data, usb, virus



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] root denied permission to nfs mounted directory but user can read and write qajaq Linux - Networking 2 03-08-2016 08:53 AM
find files with at least read and write for user but not write for group (on Mac OS X) davedpss Other *NIX 11 09-09-2013 04:19 PM
Execute with group permission but write with other permission? Karmaflute Linux - Newbie 15 05-01-2013 07:00 PM
[SOLVED] Enable a user for FTP but disable for SSH? edsall57 Linux - Security 3 05-16-2012 02:06 PM
Disable/enable USB storage device @ run time Mr.J Linux - Kernel 3 08-03-2008 08:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration