![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| execute a .jil file | OSD | Shell Programming and Scripting | 4 | 10-05-2007 01:20 AM |
| execute a .jil file | OSD | UNIX for Advanced & Expert Users | 1 | 10-03-2007 06:11 AM |
| Sudo file not saved | Asteroid | UNIX for Advanced & Expert Users | 0 | 07-30-2007 08:18 AM |
| how to configure the sudo file in solaris | krishna176 | SUN Solaris | 2 | 03-25-2007 12:40 AM |
| Need to execute 2 scripts, wait, execute 2 more wait, till end of file | halo98 | Shell Programming and Scripting | 1 | 08-01-2006 05:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Execute .sh file with sudo in it
Hi,
I logged into a UNIX system as user ABC. I do not have root previleges and also do not have root password. I am executing few commands as: ABC****>sudo su - XYZ XYZ****>rm file1.txt XYZ****>exit ABC****> Now I want to execute all these commands from a .sh file ( or in any other way). I put all these commands in a test.sh and executed as ABC****>./test.sh the problem here is that , only first command is executed and control is gone to XYZ****> When I entered exit as XYZ****>exit the remaining commands in the test.sh started the execution as ABC****>rm file1.txt No Permission. ABC****>exit How should I execute the "rm file1.txt" as a XYZ user? |
|
||||
|
Why don't you invoke find to get the names of every file you are going to want to delete, park the name in a script, sudo to XYZ, run the script.
Or sudo to XYZ ,cd to the directory with a problem, then Code:
chown -R ABC * |
![]() |
| Bookmarks |
| Tags |
| unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|