FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I dont think that typing ./blah is a great solution. The whole idea is that executables should be executable from anywhere. I have had similar problems using FC2, with files that are in my path, even after running updatedb as root. In my case the files suddenly become executable after a couple of hours. Has anybody else seen this?
Originally posted by leontini
The whole idea is that executables should be executable from anywhere.
Well, it's not!
Executables(or whatever you call them) should only be used by a system administrator.
If you don't like this, you should simply use your root account as default(not recommended for sane people)
PS: Not doing this is one of the many reasons why Windows doesn't work...
jens is right...you shouldn't run installation software as user..only root...and it's a binary file, not executable...executables are for windows only...well unless you use wine, then you can use executables.
OK, firstly you must set the execute permission on the script if that is not already done.
The permissions, I don't know what you do and dont know, so you may know most of this, but it is easier just to present it as if you dont
with ls -la
-rwxr-xr-x 1 segfault segfault 721 Aug 5 09:19 myScript.sh
Generally speaking, the rwx's at the start (ignoring the first -) refer to three groups of permissions, owner (user), group, others. In the example above, the user (first three chars) show rwx, meaning that the user (owner) has read write and execute permissions. Next is group permissions r-x meaning that people in the same group have read and execute permissions (ie no write permissions) . Lastly is the permissions for others, r-x which in this example is the same permissions as the group users.
If you are interested in setting these permissions using octal notation, search the web for a good explanation. For simplicity you can set rudimentary permissions like read, write and execute using + and - commands to chmod.
+ = add permission
- = remove permission
a = all
u = user (or owner)
g = group
o = other
x = execute
w = write
r = read
eg:
chmod g-r myScript.sh
would remove read permissions from the group (being people in the same group)
giving:
-rwx--xr-x 1 segfault segfault 721 Aug 5 09:19 myScript.sh
So to make your script executable by you (the owner/user) you would use:
chmod u+r myScript.sh
This is a very simplistic explanation of the use of chmod, but google will find you a proper one.
There is a VERY good reason to require the ./ to execute a file in the current directory, and it goes a little sommin like this:
Imagine I do this..
Create a file called ls and place it in the /tmp directory of some machine (the /tmp location is not important, but is used in this example since most users have write access to /tmp)
containing scripting or binary code to do the following pseudo code:
if user executing has root permissions
then do something malicious and invoke the real ls
else
invoke real ls
Then if someone with root privleges types ls in /tmp ............
That is why it is considered a bad idea.
Simply adding . in your path will alliviate the need to place the ./ in front of the executable name, but will leave you open to attack like the one described above.
One other thing that I bumped into was that partitions can be set so they don't allow any code to be run. Again, it's a another security measure so malicious code and code from other os's get run. To see if a partition is marked 'exec' or 'noexec', check the /etc/fstab file. Each line represents one partition, and options are on the right. If it's necessary, add the exec option (as root).
sorry for my lack of explanation. By executable, I meant shell scripts, programs, etc, written by the user, not istallalion programs or the like. Surely you should be able to put all of these files (with execute permissions set) into some directory, put that directory in your path, to have access to them from anywhere the user has execute permission. In my case (and from what I can tell aranfitz's) the problem is not that the partition has noexec set, because the files somehow become executable later, and other binaries and executable shell scripts can be run anyway. I use tcsh shell, could this be an issue with this particular shell? Aranfitz, what shell are you using?
As I wrote earlier, the only way i can execute is by typing /bin/tcsh before the executable.
As for the other comments, they would have been useful, but I've already tried them. This really is something sinister. However, keep the obvious ones coming, you never know what silly little thing you've missed. It's becoming clear however that this is not particularly common. Has anyone else installed FC3 yet?
aranfitz, to determine your problem you are going to need to give us a lot more information. Tell us exactly what you are tyring to do, what you have attempted, what does work, what doesn't. Give a single complete consise and understandable example from start to finish..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.