LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   chmod ing - Help needed (https://www.linuxquestions.org/questions/linux-general-1/chmod-ing-help-needed-167733/)

randelld 04-08-2004 08:57 AM

chmod ing - Help needed
 
Hi.
I am a complete novice to linux so you'll have to bear with me.
I have a website hosted by some company and I have some cgi scripts needed to run a stats proggy.
However, my hosting co tell me that I need to login via ssh and change the permissions. So I log in with ws-ftpPro because it has a GUI and change the relevant permissions. Log out and run the script but it just prints the code to screen. I log back in with ftpExplorer and all the permissions are the uniform, which is not how i set them. I log bak in using wsftpPro again and all the permissions look correct????
They did advise me to use putTY but knowing nothing about linux I found that app difficult due to the command line interface. The server is Red Hat Linux. All the files are in cgi-bin, even though the hosting co say I could put them anywhere in my webspace, "tidyer".
Any assistance would be very gratefully received.

THANKS.

Blinker_Fluid 04-08-2004 09:35 AM

So what are the permissions?
Simple directions to use putty (with XP):
download the putty.exe double click on it and put in the server name or IP address.
log in to your account
cd <directory to where your cgi-bin files are>
example --> cd public_html/cgi-bin
ls -l <-- shows the contents of the directory you are in and permissions
after you are in the right directory you can use the following command to add execute to all the files
chmod a+x *
ls -l <-- to make sure permissions are correct
When you are done type 'exit' to log out.

Other helpful commands that might be useful:
pwd <-- shows current directoy
ls -lh <-- shows file permissions and size in human readable format
chmod 755 <filename> <-- changes file to read and execute for all users except owner (adds write also for owner)

Hope that helps.

kvedaa 04-08-2004 09:37 AM

Well, I agree that the best course of action will be to go to the server and check the permissions at the command line. I realize that if you are new to linux the command line can seem intimidating, but for something like this I do not think that it will be as bad as you might fear.

My first question, can you successfully log into your server with Putty? Second, do you know that directory path where the file in question is (you do not need to give me this path if you do not want to, I just need to know if we can have you go straight there, or if we are going to have to do some searching).

If yes on both counts we should be in good shape. Once we log in (hopefully as a user who has permission to modify the files in question). We will want to change directories to the folder they are in. Use the ‘cd’ command to do this. If the path is /home/ken/web. We can get there all at once or one step at a time, Example:

cd /home/ken/web

or

cd /home
cd ken
cd web

(Note: that in *nix, the directions of the slash are different than that of command line work in Windows)

once we are in the directory you are looking for we will want to look at a long (detailed) file listing:

ls –l

This will provide you with all the (non hidden) files their owners, groups, permissions, modification dates, etc. Here you will want to locate the file(s) in question and see if you have the permission that you want to have. If not then we will use the ‘chmod’ command. If you tell me what permissions the file(s) need, I can tell you how to accomplish this, but as a sample, you can use this command in a few different manners:

chmod 777 <filename>

will open the file up for everyone, to read write and execute,

If you simply want to add the right for all to be able to execute a file you can use:

chmod +x <filename>

This will add the ‘x’ (execute) option to all three categories.

Once you have changed the permission, you should run the ‘ls –l’ again to see that the permissions really are what you want them to be. While here you should also check to ensure that the file is owned by the user and group that you expect it to be (this is also a cause of problems from time to time).

If I have missed something, please let me know and I will try to clarify.

randelld 04-09-2004 07:09 AM

Thanks for the replies guys.
 
Basically I need to assign permissions 0555 to all cgi files and 0666 to options.dat.
Here is my listing, I think it's correct.
getjs.cgi = -r-xr-xr-x
options.dat = -rw-rw-rw-
psadmin.cgi = -r-xr-xr-x
psmember.cgi = -r-xr-xr-x
setup.cgi = -r-xr-xr-x
stats.cgi = -r-xr-xr-x
viewstats.cgi = -r-xr-xr-x


If I try to run setup.cgi from a browser it just prints the script to screen so I tried running it from the server via putty.
cd to correct folder ls -l shows all the correct files.
type setup.cgi
unknown command.

Does this make sense to you?

Thanks again

kvedaa 04-09-2004 08:00 AM

Well the permission you displayed match up to the description that you said they needed to be. So it appears that whatever is causing this problem it is likely not a permissions issue.

Now I know very little about cgi, but from what I understand they are scripts that run on demand to generate html. Hence I would understand why this would not do anything from the command line, because there simply is no structure in place do do anything with the output.

As I recall the actual program part of a cgi script can be Perl, bash, sh among others. With this in mind, it might be worth taking a look to see what language the cgi script is using and ensure that the dependencies for that language are in place.

If you log into to the box via putty and work your way down to directory in question and type:

head -20 setup.cgi

You should get the first 20 lines of this file displayed in your putty session, which would (hopefully) be more than enough to identify the underlying language for this script, and help determine what to look at next.

randelld 04-09-2004 10:54 AM

Thanks for your help
 
ooh dear.
Thanks very much for your help. I think I must have one of the most helpless hosting co's around "www.streamlinenet.co.uk" so trying to find out what script support the server has is going to be fun.
thanks again.


All times are GMT -5. The time now is 03:52 PM.