I am doing a homework assignment for a class, and part of it is designing our own shell and read and write in low level. After forking, it needs to execute a command that a user inputs. When the execute tries to do it, it says that there is permission denied. I think getting access to the /bin while exevc("/bin/", argv) is the problem. Is there a way for my created shell get access to the /bin? Chmodding /bin is not allowed, according to outputs from the terminal.
closed as not constructive by Rinzwind, The Lord of Time, ajmitch, qbi, Eric Carvalho Jan 28 at 0:14
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
Have you tried running your program as root? It's in general a bad idea to futz with the permissions outside of your home directory if you don't know exactly what you are doing. If there are files in places like /bin that only root can execute, it is probably for security reasons. That said, be careful running your scripts as root too, as bugs in code can lead to breaking your OS (i.e don't do your experimentation with |
|||
|
|
|
I would advise NOT doing this on a live filesystem. If anything, you should try this in a VM and ONLY in a VM. That said, everything gradi3nt said applies. |
|||
|
|
exec("/bin"). Only executable files can be executed,/binis a directory. Tryexec("/bin/ls"). – Andrea Corbellini Jan 27 at 19:42exec()I mean the family of functions that start with that prefix.] – Andrea Corbellini Jan 27 at 19:48