Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Swiched user from CSH to KSH in passwd file but user cannot execute .ksh files.  how to fix this.  Solaris 8

Posted on 2006-07-20
Medium Priority
Last Modified: 2013-12-27
I have a user that needed to run in the ksh enviroment.  My Solaris is rusty, so I changed the passwd file to put him into the ksh enviroment at login.  the problem is, when he tries to execute a file from a sub directory of his home directory he gets the following error.

ksh: connect_bss.ksh: not found

now, I have tried executing it as ./connect_bss.ksh with no luck.  same error

I have performed the following command


the path changes to
$ echo $PATH

but still no luck, same error.  there is no .profile in his /home/omc directory either.

can anyone guide me through fixing this, I need this user to be able to execute ksh scripts from any subdirectory he created under /home/omc without issue.
Question by:chrismurr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
LVL 10

Assisted Solution

Nukfror earned 1000 total points
ID: 17148816
Assuming the file is in this user's home directory run this:

cd /<Home dir of user>
find . -name connect_bss.ksh -print

This will tell you if the file is in the user's home directory or not.

On a secondary note, you didn't have to change the user's default shell from CSH to KSH necessarily.  A good programming standard for any admin or user is to include the proper link loader syntax at the top of all scripts.  So for a ksh script the proper first line is:


For csh its:


This way the user's default shell can be anything.  When the link loader see's a text file that executable, it checks for this line as the first line in the script.  If the line exists, it will fork/exec that script to interpret the script to run it.
LVL 10

Expert Comment

ID: 17148829
Ahh, and allowing a user to execute a script from *any* directory is a very *bad* policy.  The users should put some sort of controls around where various files are placed.  A good example is to make maybe a bin directory to hold his executable scripts.

Author Comment

ID: 17148864
they only execute scripts from a sub directory of their home directory.  I has put them back to the csh as the default and tried again, the file can be found in the directory but when you try to exeute it, it fails with the error above.  I did check the script and it is properly programmed with the #!/bin/ksh at the top.

any other ideas?  
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 10

Expert Comment

ID: 17149524
So the script exists in say directory /home/thisuser/subdirectory. If you execute:

cd /home/thisuser/subdirectory

You get this error ?

ksh: connect_bss.ksh: not found

Has you tried:

cd /home/thisuser/subdirectory
ksh connect_bss.ksh

Is the script executable ?

ls -l connect_bss.ksh

If not, run this:

chmod +x connect_bss.ksh

and try this again:

LVL 48

Accepted Solution

Tintin earned 1000 total points
ID: 17149919
The only way you'd get the error

ksh: connect_bss.ksh: not found

is, if in fact the file is missing.

Show us the results of

cd /home/omc/FPrint/BSS
ls -l

od -c connect_bss.ksh
LVL 10

Expert Comment

ID: 17150628
Actually I don't think so.  If they are using the link loader to fork/exec the shell and if the user's default shell is CSH, then how could CSH know that the missing file's link loader interpreter is supposedly to be KSH - when the file doesn't exist.
LVL 10

Expert Comment

ID: 17150637
Actually I misspoke, CSH doesn't do anything with the link loader ... then how could the *link loader* know that the missing file's needed shell is supposed to be KSH when the file doesn't exist.
LVL 48

Expert Comment

ID: 17150660
You get the error if your current shell is ksh, eg:

$ echo $0
$ ls -l
total 0
$ ./connect_bss.ksh
ksh: ./connect_bss.ksh:  not found

Author Comment

ID: 17153285
here is the results trying to run the file along with the path information for this user.

statsdo:/home/omc/FPrint/BSS <47> (omc) % pwd
statsdo:/home/omc/FPrint/BSS <48> (omc) % connect_bss.ksh
connect_bss.ksh: Command not found
statsdo:/home/omc/FPrint/BSS <49> (omc) % ./connect_bss.ksh
./connect_bss.ksh: Command not found
statsdo:/home/omc/FPrint/BSS <50> (omc) % /home/omc/FPrint/BSS/connect_bss.ksh
/home/omc/FPrint/BSS/connect_bss.ksh: Command not found
statsdo:/home/omc/FPrint/BSS <51> (omc) % ls -l
total 34
-rwxrwxrwx   1 omc      omc         2072 Jul 17 16:27 bsc_cpu.ksh
-rwxrwxrwx   1 omc      omc         4963 Jul 17 16:39 connect_bss.ksh
-rwxrwxrwx   1 omc      omc         4963 Jul 17 16:55 connect_bss_day.ksh
-rw-r--r--   1 omc      omc           52 Jul 21 02:00 cron.log
-rw-r--r--   1 omc      omc          140 Jul 17 16:28 marker.dia
-rw-r--r--   1 omc      omc          140 Jul 17 16:28 marker.dia~
drwxrwxrwx   2 omc      omc          512 Jul  5 16:22 results
statsdo:/home/omc/FPrint/BSS <52> (omc) %

echo $PATH

I have even tried to copy the file to the /home/omc/bin directory (which is in the path) and still get the same error.

still doesnt make any sense, this shouldnt be that big of an issue. i can execute the file is 'sh connect_bss.ksh' but because it calls other scripts, it terminates unexpectantly.  

Author Comment

ID: 17153302
BTW, this cannot be executed as root either
LVL 10

Expert Comment

ID: 17153383
Can you do the following while you're in /home/omc/FPrint/BSS:

head connect_bss.ksh

Did you mean to say "sh connect_bss.ksh" or should the "sh ..." portion be "ksh ..." ?

Author Comment

ID: 17156550
no I meant "sh connect_bss.ksh"

 head connect_bss.ksh
###### Variable input from install.ksh or setup.ksh file ######
###### Get date and figure out date_directory to get the actual files ######
year=`date +'%Y'`
month=`date +'%m'`
conf_date=`date +'%Y''%m''%d'`
LVL 48

Expert Comment

ID: 17164235
Please do

ksh -x connect_bss.ksh

and post the results.

Author Comment

ID: 17175194
sorry I didnt get back sooner.  the problem wasnt with the shell at all.  the user ftp's the file from a linux Fedora server and when the transfer happens, every line in the script has a ^M at the end of it.  Effectively corrupting the script all together.  it wasnt a shell problem after all.

I will split the points for you two for all the effort.


Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question