LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-08-2004, 08:57 AM   #1
randelld
LQ Newbie
 
Registered: Apr 2004
Location: Spain
Posts: 3

Rep: Reputation: 0
Unhappy 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.

Last edited by randelld; 07-11-2005 at 01:20 PM.
 
Old 04-08-2004, 09:35 AM   #2
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
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.
 
Old 04-08-2004, 09:37 AM   #3
kvedaa
Member
 
Registered: Mar 2004
Location: Virginia
Distribution: PacketProtector
Posts: 331

Rep: Reputation: 30
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.
 
Old 04-09-2004, 07:09 AM   #4
randelld
LQ Newbie
 
Registered: Apr 2004
Location: Spain
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 04-09-2004, 08:00 AM   #5
kvedaa
Member
 
Registered: Mar 2004
Location: Virginia
Distribution: PacketProtector
Posts: 331

Rep: Reputation: 30
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.
 
Old 04-09-2004, 10:54 AM   #6
randelld
LQ Newbie
 
Registered: Apr 2004
Location: Spain
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Driver writing help needed: oops-ing on r/w Alotau Programming 1 07-20-2005 09:49 AM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 08:53 PM
chmod-ing my windows partition herve2001 Slackware 5 09-27-2004 12:20 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
S*[t-r]+[ing]?g gr33ndata Programming 10 03-13-2004 05:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration