bash
enables to run bash scripts with bash somescript
, python
python scripts with python3 somescript
. Alternatively, with the right shebang, I can run directly the previous scripts with ./somescript
.
For binary programs, I can run them as ./someprogram
if they have the executable permission set.
But is there a GNU/Linux command to run a binary executable, say run, like in: run someprogram
?
Typical use case is: someprogram is in a partition with noexec
set. Such run command would enable to run myprogram as if it were in the partition where run is installed as usr/bin
which is mounted with the exec
flag.
Remark: it is not a chmod
issue. someprogram has the exec
permission set.
file ./binary
) – A.B Nov 20 '23 at 16:22/lib/ld-linux.so.2 someprogram
, I get:error while loading shared libraries, wrong ELF class: ELFCLASS64
– lalebarde Nov 20 '23 at 16:49/lib64/ld-linux-x86-64.so.2 someprogram
in your case, but even that won't work if the file is on a FS with noexec. noexec is especially to prevent the machine code from the file from being executed by the processor. You'd need to copy the file to a FS without noexec first. – Stéphane Chazelas Nov 20 '23 at 17:04/lib64/ld-linux-x86-64.so.2 /tmp/sleep 1
/tmp/sleep: error while loading shared libraries: /tmp/sleep: failed to map segment from shared object
. This is documented in Linux'mmap(2)
for one of the multiple causes of EPERM. – A.B Nov 20 '23 at 22:03execve()
in user space, so it might be possible. I think I read it somewhere here, so there might be a Q&A covering it here. – Stéphane Chazelas Nov 21 '23 at 09:17