12-16-2016
sudo is not a shell. Feed it the string cat /tmp/tmp.file >> filename and it will look for a file named cat /tmp/tmp.file >> filename and complain that no such file exists.
Don't run script with sudo, use sudo to run scripts.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want give rights for the maint user to execute the "ping" command. Currently root user can execute the "ping" command, but the maint user is not able to execute the command. (3 Replies)
Discussion started by: kabeer_n
3 Replies
2. Shell Programming and Scripting
I don't know why the following shell script doesn't work. Could you please help me out?
#!/usr/bin/ksh
test="cal > /tmp/tmp.txt 2>&1"
$test
I know it will work for the following format:
#!/usr/bin/ksh
cal > /tmp/tmp.txt 2>&1
However, I need to get the command from the user in... (1 Reply)
Discussion started by: redtiger
1 Replies
3. Shell Programming and Scripting
i have logged in as user.
I want to write a script to login into root and execute commands for eg. ifconfig or other command.
kindly help me out. (6 Replies)
Discussion started by: pradeepreddy
6 Replies
4. Shell Programming and Scripting
Hi All
I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh
URL="www.google.com"
VBURL="10.5.2.211"
echo "Setting route for $URL for GPRS"
URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1`
echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I like to allow an user to permit an root command " /usr/ucb/ps -auxwww", do you know how?
Kind regards
Mehrdad (6 Replies)
Discussion started by: mehrdad68
6 Replies
6. Shell Programming and Scripting
Hi,
We need to execute a root commmand to change the expiry period of a user but we are getting error as permission denied
Q How can we execute a root command by a normal user ? :mad:
any thing or suggestion will be good .... :b: (3 Replies)
Discussion started by: abhishek1979
3 Replies
7. Shell Programming and Scripting
Hi,
I am using solaris 10 and bash shell.Script execution follows below.Initially it will check whether a directory exists or not if does not exist it will create it.(This I have completed)
Second step:I have four users say user1,user2,user3,user4.Script should prompt for the user id and... (11 Replies)
Discussion started by: muraliinfy04
11 Replies
8. UNIX for Dummies Questions & Answers
Hi ,
I am trying to stop and start a process using the below code. I have sudo access on my machine
## PID = process id
echo "$PASSWD" | sudo -S kill -9 <PID>
echo "$PASSWD" | sudo -S /opt/abc/startserver
/opt/abc/startserver: error while loading shared libraries: librts.so: cannot open... (6 Replies)
Discussion started by: rakeshkumar
6 Replies
9. UNIX for Beginners Questions & Answers
Hi,
I am trying to run a command within my KSH script as another user due to permission issues, now both users are non root. I have tried the following command and was unsuccessful:
echo "<password>" | sudo -S -u <username> -k command
Can I use sudo to run a command as a non-root user? (5 Replies)
Discussion started by: MIA651
5 Replies
10. Shell Programming and Scripting
Hello i am having an issue with bash script and this is the code
now=$(cat hosts1.txt | awk '{print $2;}')
while read n ;do
ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers'
When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies