I need to set up the following script to run as root whenever I log in:
#!/bin/zsh
truncate -s 0 ~yourstruly/.juniper_networks/network_connect/ncsvc.log
I know how to run the script as root interactively (namely through sudo), but I can't figure out how to make the script run as root non-interactively whenever I log in.
How can I do this?
FWIW: the script is currently owned by root, has permi
A sample script can be as below:
#!/bin/bash
sudo su
ls /root
When using ./test.sh as the normal user, instead run ls as super user and exit, it switches to root; and when I logout, it executes ls /root as the normal user.
Can anybody tell me about the mechanism about it? Thanks.
I have a script run from a non-privaleged users' crontab that invokes some commands using sudo. Except it doesn't. The script runs fine but the sudo'ed commands silently fail.
The script runs perfectly from a shell as the user in question.
Sudo does not require a password. The user in question has (root) NOPASSWD: ALL access granted in /etc/sudoers.
Cron is running and executing the script.
Hello All,
I am writing an Expect Script to execute some commands over ssh then exit the script.
The script works just fine if I automate everything and assuming the correct password was entered.
So this Expect Script gets executed from a Bash script...
I am on Maverick. In my user's crontab I run a backup script, dbbackup.sh. But it won't run because the sudo password is requested. Why is that? The script is owned by my user account and is executable. This script used to run in lucid. Do I not have permission to run a shell script?
I know I can use sudo ./shellscript.sh then enter the root password and the script will run. My question is can I set the permissions on the script so it will run as root when I click on the desktop ICON.
Hi All,
I am trying use the below su command to execute a shell script using different user.
Caould some one please help me out as to how to pass the pass the password when prompted or is there any way to execute the shell script using other user.
I have had look at the other posts in forum but is not working correctly.
Please help..
Code:
#!/usr/bin/ksh
su - cobr_ext -c /home/cobr_sftp/va
Hi there,
I am new to scripting, please advise.
I have a script running on the PC server, the script is to log on some ip to get something.
script-name IP -l username
after running the command, I need to type the password for the script to run.
Now, I like to change the script to web cgi script, I can get the IP from the web page, hardcode the uername, but not sure how to give the cg
Possible Duplicate:
How do I use sudo in my script without needing a password?
I want to run a bash script as root with no password prompt.
I tried visudo with no luck(your_username ALL=(ALL) NOPASSWD: /path/to/your/script).
It seems to me the only way out there, is there any other?