Dumb question about .xinitrc
Hi
I have Arch Linux and everything works fine:) I have been googling around but i can't figure it out if .xinitrc should have executive rights. My .xinitrc works fine with executive rights or without but i am asking this "stupid" qustion just to be sure and to have a calm sleep :) thx for your answer |
not really a stupid question, but you sorta answered your own question without knowing it.
if it works without, then it doesn't need it, in fact i would avoid giving exec privs to anything that works without them (security ya know) |
Configuration files do not generally need to be executable. The programs that import the settings from them just need to be able to read the file.
|
Ok, thank you both for answers. For test i have created a new user and the file in new user's home hasn't got executive permission. So i conclude that doesn't need them :)
But he Ubuntu page have somewhat confused : Quote:
|
The security contains also the way a script gets executed I think :
In bash any "exit" inside a "source"ed script can make the parent exit , too . Sourced scripts need a "return" if needed to not kill the parent (xinit) . I think I read somewhere it would be "canonical" to make such configuration files executable and put a "#!/bin/sh" on top to make it possible to either execute the script or to source it . Configuration files are also read by C-command(s) as described here : http://www.suite101.com/content/c-tu...ommands-a20756 |
I've just had a quick look at .bashrc and that's not executable. The question is, how is the file going to be used? If it just contains information that some script is going to utilise, then it doesn't need to be executable; if it is a script, it does. In general, I think the suffix -rc shows that a file isn't a script. You can't judge by the contents; my .bashrc contains commands like "export EDITOR=nano".
|
Quote:
Because I always thought that even if you don't give it executable priveleges, and explicitly pass it to an interpreter, than it's still called a script. |
It is interesting, because i have copied .xinitrc from the /etc/skel and at the beggining it has #!/bin/sh so i tgought that has to have executive permission.
.xinitrc from skel: Quote:
|
Quote:
|
Quote:
Executable permissions are needed if the program is a true executable file or if the program is a script with a shebang line and is to be given directly to the OS as if it was an executable file, like this (using the exec system call): Code:
execl("path/to/script-with-shebang-line", "script-with-shebang-line", NULL); Code:
$ path/to/script-with-shebang-line Executable permissions are not needed if the file is passed as an argument to an interpreter executable, like this (using the exec system call): Code:
execl("path/to/interpreter", "interpreter", "path/to/script", NULL); Code:
$ path/to/interpreter path/to/script |
So, what about .xinitrc? Is executive permission needed?
|
Ehrm... xinitrc is your start-up file for X, as the name says x-init-rc...
But, where does that question come from? And...(more importantly) where do you want to get with that question? It is an init file, something else reads it. Arch uses (or better: the X) it to start up the DE (Gnome, XFCE,...), it is started at startx, in turn nudged by whatever is in inittab, mine is set to init3 - the inittab, however has a last line that starts (and sets it to respawn) the XDM for login. As this goes into "graphical" mode - the subsequent startx makes the info in xinitrc relevant, it gets read out and used to go into the required session, it says "exec gnome-session" In short, xinitrc is read (not executed - so only read rights are needed, for the processes that need this info) by the X11 server, that gets started up by a line in inittab where a graphical login is requested. Any X-troubles by the way??? :D Thor |
Hi Thor. It is just a question out of curiousity. I have copied my file from /etc/skel. As you can see above skeleton file has #!/bin/sh so that is why i automatically thought of the need for execution permission.
Beside this i am not experiencing any problem with X. |
Quote:
|
Actually when i do startx a do have some errors. The error is:
Quote:
|
All times are GMT -5. The time now is 05:41 AM. |