LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-11-2008, 09:55 PM   #1
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Rep: Reputation: 0
Smile csh: permission denied


When i use 'csh' to execute any c shell script, the command line console always prompt "/home/xxx: Permission denied" message.
but the shell script works ok when i use 'sh' to execute it.
So i think it has not relation with the permission of shell script.

lrwxrwxrwx 1 root root 4 Apr 9 22:23 /bin/sh -> bash
lrwxrwxrwx 1 root root 4 Apr 9 22:25 /bin/csh -> tcsh
-rwxr-xr-x 1 root root 616248 Oct 6 2006 /bin/bash
-rwxrwxrwx 1 root root 307488 Mar 15 2007 /bin/tcsh
 
Old 09-11-2008, 10:08 PM   #2
mjmwired
Member
 
Registered: Apr 2004
Distribution: CentOS6, CentOS5, F16, F15, Ubuntu, OpenSuse
Posts: 620

Rep: Reputation: 39
Set the execute permission on the script:
# chmod +x script_name

Then run:
# ./script_name
 
Old 09-11-2008, 10:41 PM   #3
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for your reply.

My problem is not relation with the permission of shell script which executed by csh. it is about the permission of csh command.

When i just type "csh" in command line console, the console prompt "permission denied" like below.

[jjguo@stsdd08-4 /]$ csh
/home/jjguo: Permission denied.

And it can work but it always prompt "Permission denied" message, i just don't know why this happens.
 
Old 09-11-2008, 10:56 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The group and other permissions for tcsh should not have the write permissions. Reinstall tcsh. Determine how it happened. I'm somewhat worried that the command was replaced with a cracker's version, in which case, tcsh is the least of your worries. Check if tcsh is a wrapper script for some reason.
 
Old 09-12-2008, 01:10 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by jjguo
When i use 'csh' to execute any c shell script, the command line console always prompt "/home/xxx: Permission denied" message.
but the shell script works ok when i use 'sh' to execute it.
So... is it really a c shell script or is it a Bourne shell script?

P.S. Read here: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
 
Old 09-12-2008, 01:55 PM   #6
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 729

Rep: Reputation: 75
Hi.

Please post the shortest example of a script that exhibits this behavior along with a copy / paste of the output, and the similar output as executed with sh. Otherwise we're working just where the light is good, not where the problem is.

I'm betting on something in .cshrc or .tcshrc ... cheers, makyo

Last edited by makyo; 09-12-2008 at 02:10 PM.
 
Old 09-15-2008, 08:50 PM   #7
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
you don't need to care about whatever shell script it executes, for example:

[jjguo@stsdd08-4 ~]$ csh
/home/jjguo: Permission denied.
[jjguo@stsdd08-4 ~]$ sh
sh-3.00$

Simultaneity, csh can execute shell script correctly, but just always prompt the message "Permission denied".

thanks
 
Old 09-15-2008, 09:00 PM   #8
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
I have commented all codes in .cshrc file, it still prompt "Permission denied"

thanks.
 
Old 09-15-2008, 09:12 PM   #9
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
i found that when i switch to another user, csh don't prompt that message.
Maybe it is related with my user.

the two user's information in file /etc/passwd
aime:x:94110:42424::/scratch/aime:/bin/tcsh
jjguo:70dQGjUwdngPM:505540:8500::/home/jjguo:/bin/csh

the first user 'aime' is ok
the second user 'jjguo' is wrong

[aime@stsdd08-4 ~]$ csh
[aime@stsdd08-4 ~]$

[jjguo@stsdd08-4 aime]$ csh
/home/jjguo: Permission denied.
[jjguo@stsdd08-4 aime]$

thanks everyone.
 
Old 09-16-2008, 01:12 AM   #10
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
What is the output of the following command:

Code:
ls -ld /home/jjguo /home//home/jjguo/.??*
 
Old 09-16-2008, 09:10 AM   #11
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
[jjguo@stsdd08-4 ~]$ ls -ld /home/jjguo /home /home/jjguo/.??*
drwxr-xr-x 11 root root 4096 Sep 4 09:48 /home
drwxr-xr-x 21 jjguo 645 4096 Sep 16 07:08 /home/jjguo
-rw------- 1 jjguo dba 56 Sep 16 03:55 /home/jjguo/.bash_history
-rw-r--r-- 1 jjguo dba 118 Sep 11 07:20 /home/jjguo/.bashrc
drwxr-xr-x 3 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.config
-rw-r--r-- 1 jjguo dba 152 Sep 15 19:00 /home/jjguo/.cshrc
drwxr-x--- 2 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.eggcups
drwx------ 4 jjguo dba 4096 Sep 11 01:48 /home/jjguo/.gconf
drwx------ 2 jjguo dba 4096 Sep 16 00:37 /home/jjguo/.gconfd
drwx------ 4 jjguo dba 4096 Sep 9 09:18 /home/jjguo/.gnome
drwx------ 7 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.gnome2
drwx------ 2 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.gnome2_private
drwxr-xr-x 2 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.gstreamer-0.8
-rw-r--r-- 1 jjguo dba 136 Sep 9 02:17 /home/jjguo/.gtkrc-1.2-gnome2
-rw------- 1 jjguo dba 497 Sep 11 01:47 /home/jjguo/.ICEauthority
drwxrwxr-x 3 jjguo dba 4096 Sep 16 00:38 /home/jjguo/.java
drwx------ 3 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.metacity
drwx------ 3 jjguo dba 4096 Sep 10 01:55 /home/jjguo/.mozilla
drwxr-xr-x 3 jjguo dba 4096 Sep 9 02:17 /home/jjguo/.nautilus
-rw------- 1 jjguo dba 0 Sep 9 02:17 /home/jjguo/.recently-used
-rw------- 1 jjguo dba 574 Sep 14 01:48 /home/jjguo/.rhn-applet.conf
drwx------ 2 jjguo dba 4096 Sep 11 22:34 /home/jjguo/.ssh
-rw------- 1 jjguo dba 10033 Sep 16 07:08 /home/jjguo/.viminfo
-rw-r--r-- 1 jjguo dba 0 Sep 10 03:55 /home/jjguo/.viminfo.tmp
drwxr-xr-x 2 jjguo dba 4096 Sep 16 07:08 /home/jjguo/.vnc
-rw------- 1 jjguo dba 517 Sep 16 00:23 /home/jjguo/.Xauthority
 
Old 09-16-2008, 03:05 PM   #12
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
/home/jjguo should be group dba (or whatever group your jjguo belongs do).

Code:
sudo chgrp dba /home/jjguo
Please show the entire contents of your .cshrc as follows:

Code:
cat ~jjguo /.cshrc
FYI: please place code and output into [ code ] [ /code ] blocks (no spaces inside brackets), so that columns line up correctly, and formatting remains.
 
Old 09-16-2008, 11:21 PM   #13
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mr. C. View Post
/home/jjguo should be group dba (or whatever group your jjguo belongs do).

Code:
sudo chgrp dba /home/jjguo
Please show the entire contents of your .cshrc as follows:

Code:
cat ~jjguo /.cshrc
FYI: please place code and output into [ code ] [ /code ] blocks (no spaces inside brackets), so that columns line up correctly, and formatting remains.
There is nothing in my /home/jjguo/.cshrc file like below:
Code:
[jjguo@stsdd08-4 ~]$ cat .cshrc

~
[jjguo@stsdd08-4 ~]$ csh
/home/jjguo: Permission denied.
[jjguo@stsdd08-4 ~]$
 
Old 09-16-2008, 11:35 PM   #14
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Quote:
Originally Posted by jjguo View Post
There is nothing in my /home/jjguo/.cshrc file like below:
Code:
[jjguo@stsdd08-4 ~]$ cat .cshrc

~
[jjguo@stsdd08-4 ~]$ csh
/home/jjguo: Permission denied.
[jjguo@stsdd08-4 ~]$
There's your answer. You are incorrect - there IS something in your .cshrc. It is that lonely, single tilde character you left from a vi session copy/paste. Remove the tilde and all will be fine.

In case you're interested, the ~ character is a shortcut equivalent of your home directory. You are trying to execute your home directory as a command, just as if you did:

Code:
$ /home/jjguo
 
Old 09-17-2008, 11:29 PM   #15
jjguo
LQ Newbie
 
Registered: Sep 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mr. C. View Post
There's your answer. You are incorrect - there IS something in your .cshrc. It is that lonely, single tilde character you left from a vi session copy/paste. Remove the tilde and all will be fine.

In case you're interested, the ~ character is a shortcut equivalent of your home directory. You are trying to execute your home directory as a command, just as if you did:

Code:
$ /home/jjguo
Hi Mr. C.,
You are right, the problem is fixed. Thank you very much. This problem results from my mistake.

Thank everyone who cares about this question.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM
permission denied . . . zthomasz Linux - Newbie 1 06-21-2003 03:54 AM
Permission Denied - Help!!! awolff01 Linux - Software 1 02-27-2003 02:23 PM
Permission Denied lackof Linux - Networking 1 08-14-2002 10:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration