shell-init: could not get current

Hello there,

I was wondering if any of you could help me. My error_log from my
website came out with *loads* of lines that said this:

shell-init: could not get current directory: getwd: cannot access parent directories

what does it mean? Does anyone know what I am doing wrong?

I will be eternally grateful,

James.
jzpopeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dhmCommented:
That's what bash says when you start it up and it can't determine its current working directory because the directory permissions prohibit it.  I'd guess you're using SSI or CGI, and that httpd's shell is set to "/bin/bash", and that one of the directories above where the daemon tries to start CGIs is protected.

Try cd'ing to the CGI directory and then su to the HTTP daemon owner (httpd?)  You'll probably get the same message.  Next, look at the permissions on each directory up the tree to the root.  If you add "read" permission to them, the warning message should go away.  Make sure your server is configured correctly, though, or you might accidentally make your CGI scripts available for download.  I like to put them in two completely separate directory trees:

.../web-server/directory/tree/docs/xxx.html
.../web-server/directory/tree/cgi/somescript.cgi

If your server document root is set to ".../web-server/directory/tree/docs", then users won't be able to retrieve files from the CGI directory.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jzpopeAuthor Commented:
How do I change the permissions for a directory so that they the CGI scripts are set to read and not downloadable. Basically they have to be executed by the visitor so they cannot be hidden from the visitor. Also many of my directories have CGI scripts aswell as normal HTML files.

Thanks.
0
dhmCommented:
If your scripts are in Perl or shell (i.e. not compiled C/C++ code) then you can't protect them if they're in the same directory as HTML files.  You should really separate them into document-only and program-only directories, but that's often impossible because there are just too many files to sort out.  In that case, all you can do is learn from the mistake.

If your "scripts" are written in C or C++ and then compiled, you can change the permissions to "a=x" and prevent people from downloading them.

There's no directory permission you can set that will allow a script in the directory to be executed but not downloaded. However, if you clear the "read" permissions on the directory (i.e. make it "a=x") then at least users won't be able to get a listing of the directory.  They can still download scripts if they know the exact name, though.
0
jzpopeAuthor Commented:
Sorry,

One last comment. There is no way I can get rid of the error message then if I don't move files. If there is could you tell me exactly the permissions I have to set. Thanks again.
0
dhmCommented:
I tried the different shells available on my Linux machine; all of them give some sort of error when they're started in a directory for which they don't have read/execute permissions.  I think that if you set the permissions on directory trees where you have CGI scripts to "755" or "go+rx", then the error message will stop.  Note that you have to set all the parent directories, too.  (I.e. if your scripts are in "/usr/httpd/docs/dir1", then you need to make sure all these directories are read/executable:

      /
      /usr
      /usr/httpd
      /usr/httpd/docs
      /usr/httpd/docs/dir1

You can check this yourself by cd'ing to the directory containing the scripts and doing "su httpd".  (If you're running the server as httpd.  If you're running as some other user, then "su" to that user instead.)  If you try that before changing permissions, you'll see the error message on your terminal.  After you change permissions (and if you do it right!) you should be able to "su" without any errors.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.