Sunsolaris shell script runs only as super user


 
Thread Tools Search this Thread
Operating Systems Solaris Sunsolaris shell script runs only as super user
# 1  
Old 05-09-2008
Sunsolaris shell script runs only as super user

Hi Friends,
I am new to Sun solaris unix.I am facing problem while runing my kornshell script just as an ordinary user.The script works fine while i am working as a super user.the script just uses awk to check the first charcter of a file and then copies the file to another folder. Do i need to change any enviornment variable. Please help

Jithin.G
# 2  
Old 05-09-2008
What error messages do you get?
Post your script.
Are you sure you (as normal user) have the rights to read this file ans write to the other folder? What do "ls -l your_file" and "ls -ld your_folder" say?
# 3  
Old 05-09-2008
my script is

line=$(awk '{if(substr($0,1,1)!="#" &&
substr($0,1,1)!=";" &&
substr($0,1,1)!=" " &&
substr($0,1,1)!="/" &&
substr($0,1,1)!="*" &&
substr($0,1,1)!="\\" &&
length($0)!=0)
{print $0}
}' filename

This works fine when i login as super user but it does not work with other user and show error.

I am still geting the error

....ksh[line]: awk: not found

ls -l file name gives
-rwxrwxrwx 1 jithin other 38388 date filename

ls -ld folder gives
drwxrwxrwx 2 jithin other 512 date foldername
# 4  
Old 05-09-2008
pretty obvious:
Code:
ksh[line]: awk: not found

Your $PATH environment variable as normal user does not consist of the directory where your awk resides. What give "which awk" and "echo $PATH" as superuser? What gives "echo $PATH" as normal user? Add the missing dir to normal user's $PATH.
# 5  
Old 05-09-2008
$PATH in super user has another component /usr/sbin
But which awk in both super user and user gives /usr/bin
I tried to change $PATH in *.profile file of user .it changes in file . But then again i checked the echo $PATH it shows the same earlier result.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Script runs in shell but not cron

We run some menu driven software that has the ability to batch menu paths and generate reports quickly. Normally you run a batch like: $ BATCH BATCHNAME The batch program then prompts you for the date you want the report run for. I got some help from some folks on IRC to do the following: BATCH... (2 Replies)
Discussion started by: herot
2 Replies

2. UNIX for Dummies Questions & Answers

Script only runs as a particular user

Hi guys So I've got this PERL script that for one reason or another I need to run as a user other than the user that created the script. When I su - to another user the script won't run and doesn't give me any output as to why. No permission denied or anything like that. I've chmod 777'd the... (5 Replies)
Discussion started by: Jaymoney
5 Replies

3. Shell Programming and Scripting

Shell Script runs good manually but not through Cron tab

Hello Every one, I have a shell script which is running fine manually, but its giving me hard time when running tru cron job. :wall:. Am using #!/usr/bin/ksh >echo $SHELL /usr/bin/ksh Cron Job is as below, it execues but dosent do what i want it to do. 47 15 * * *... (1 Reply)
Discussion started by: naren.chowdhary
1 Replies

4. Shell Programming and Scripting

Need to run a bash script that logs on as a non-root user and runs script as root

So I have a script that runs as a non-root user, lets say the username is 'xymon' . This script needs to log on to a remote system as a non-root user also and call up a bash script that runs another bash script as root. in short: user xymon on system A needs to run a file as root user and have... (2 Replies)
Discussion started by: damang111
2 Replies

5. Shell Programming and Scripting

Shell script that runs a random shell script

Hi, im trying to make a shell script that basically runs a random shell script form a list of shell scripts i specify. Im not very good at writing shell scripts, and am new to linux. Thanks in advance :) (15 Replies)
Discussion started by: kylecn
15 Replies

6. Shell Programming and Scripting

CRON shell script only runs correctly on command line

Hi, I'm new to these forums, and I'm hoping that someone can solve this problem... To make things short: I have DD-wrt set up on a router. I'm trying to run a script in CRON that fetches the daily password from my database using SSH. CRON is set like so(in web interface): * * * *... (4 Replies)
Discussion started by: louieaw
4 Replies

7. Shell Programming and Scripting

Shell script which runs sql script

Hi all, I need a shell script which runs a sql script but I couldn't find how to finish it. This is the code that I have: #! /usr/bin/ksh export SHELL=/bin/ksh export ORACLE_SID=database export ORACLE_HOME=/opt/oracle/product/9.2.0.8 sqlplus user <<EOF @/path/path/path/scriptname.sql... (3 Replies)
Discussion started by: Geller
3 Replies

8. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

Hi all, I am trying to eject the cdrom from a livecd after certain stage... Now assuming that it is possible to eject,please consider my issue!!! The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive... However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies

9. Shell Programming and Scripting

Script using awk works only as super user

hi friends, I am a new Sun Solaris 10 user. I have the following script line=$(awk '{if(substr($0,1,1)!="#" && substr($0,1,1)!=";" && substr($0,1,1)!=" " && substr($0,1,1)!="/" && substr($0,1,1)!="*" && substr($0,1,1)!="\\" && length($0)!=0) ... (10 Replies)
Discussion started by: gjithin
10 Replies

10. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies
Login or Register to Ask a Question