how to connect to admin accout through script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to connect to admin accout through script
# 1  
Old 06-12-2006
how to connect to admin accout through script

hi everyone
i'm running script in c-shell and i want this script to connect to admin account in order to run other script in k-shell. after that i want the script to be severed from the admin account and to continue with the regular commands
example:
my script call cs-customers
echo"starting to search for customers files"
login:admin
passwd:
ksh cs-search
#disconnect from the admin account
if test -s b.log
........
fi
the problem is that the script stop because he need the passwd of the admin
how can i do this or fix such a script that he won't stop ?
of course the script in c-shell and the script in k-shell are running in different
directories
# 2  
Old 06-12-2006
Hi.
You could use ssh to yourself (with certificates to avoid interaction) or you could use the tool "sudo" (http://www.courtesan.com/sudo/intro.html)
Regards.
# 3  
Old 06-14-2006
thanks for the quick response
i didn't get the idea of sudo should i build these as different file ?
does someone have any other solution ?
please help
best regards
# 4  
Old 06-14-2006
Well, if you want to execute everythig in the same server, I would chose sudo.
In this case, youo should install the tool and configure it for your needs using "visudo"
You would add a line like this:

user ALL=NOPASSWD:/path/to/cs-customers

"user" is the user who executes the initial script, and "/path/to/cs-customers" is what you want this user to execute as root. The script then would be:

Code:
echo"starting to search for customers files"
sudo /path/to/cs-customers
if test -s b.log
........ 
fi

Finally, If the initial script is in one server and the second in another, you should consider using ssh with digital certificates for authentication so that you won't need to enter root's password. Though you could automate a telnet session. There are a couple of threads about this in this forum.

Regars
# 5  
Old 06-14-2006
hi everyone
i try to do something like this
i go to the admin account (root) and did
id
giving me
uid=0(root) gid=1(other)
now in the first script cs-customers i did something like this
echo"starting to search for customers files"
login:root
password:
#id
uid=0(root) gid=1(other)
ksh cs-search
#disconnect from the admin account
if test -s b.log
........
fi
question 1 .is it true to write like this
2. my goal is not to touch any of the .login or /etc/host file
i just want to connect to root because if the script and then disconnect from it . i want to connect to root without passwd only when i running the cs-customers . is it correct what i wrote???
thanks all for quick response
# 6  
Old 06-14-2006
Are both scripts in the same machine? If so, why do you want to do such a thing???
I'm afraid I do not understand you...
# 7  
Old 06-14-2006
hi
first according to your reaction i'm hope i didn't cause any harm
please currect me if i'm wrong i didn't change anything in any system files or something however let me explain again
i'm working in the same machine in this machine i have several users and
directories some of them are c-shell and some k-shell
i have problem because when i'm running script in c-shell cs-customers) it start to
perform object in cobol which going through several directories and
reading files . the problem is :
while i'm running the script above (cs-customers) he cannont read the files because i need to change their premissions.problem i need to connect to root
account (in the same machine) and change premissins of those files.
from my point of view i realy do'nt care if i need to run 2 different script bacause i still in the same problem ,if i have script i need to su him to root account for changing mod of files
any solutions
i think that might be here easy solution because i'm working abount one machine all the time
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

How to say goodbye to a fellow admin via Shell script.?

I have a good friend leaving my place of employment. He's an old greybeard. His first job was sorting punch cards. I'm serious. I'm looking for suggestions on a short shell script to write in his card to say good bye. Please be creative and obfusticating! have fun with it. ... (4 Replies)
Discussion started by: os2mac
4 Replies

2. What is on Your Mind?

Regarding Admin life either as DBA or UNIX Linux admin

I am planning to choose my career as Unix/Linux Admin or a DBA. But I have come to know from forums and few admins like the job will be 24/7. I have few questions on that. Can we get "DAY" shifts in any one of the admin Job ? Can't we have shift timings in any company ? Eventhough the... (7 Replies)
Discussion started by: Jacktts
7 Replies

3. Shell Programming and Scripting

Script to Send Email to a user when an admin kills process

Can anyone create or give me a script that I can use to email a user automatically when I kill one of their processes? Or Can you give me a script to allow me to email a user (entering email manually) when a process is killed? Like showing what the PID was and a reason the admin killed it? Is... (2 Replies)
Discussion started by: JoeGazz84
2 Replies

4. What is on Your Mind?

Windows Admin switching to *nix Admin

I'm currently a Windows admin and have wanted to jump ship to the *nix side for a while now. I've been studying both through an lpic level 1 manual as I have time (focusing on debian), and a solaris 10 cert book. The problem is I only have a handful of hours a week to study, and my current job... (3 Replies)
Discussion started by: bobwilson
3 Replies

5. AIX

script for finding all the users with GID 0 ( admin group )

Hi Friends, I am trying to write a script for finding all the users with the GID 0 i.e. Admin users. can you please help me on this. (1 Reply)
Discussion started by: anoopraok
1 Replies

6. Shell Programming and Scripting

Script stops running the remaining checks after becoming admin

Hi all, I encountered a problem where my script stops running the remaining checks after becoming an admin that is written within the script. For example: ========================================= #!/bin/sh check 1 # Runs successfully check 2 # Runs successfully /com/bin/admin #... (1 Reply)
Discussion started by: seanchew
1 Replies

7. Solaris

accout

I have a sunfire V240 but nobody seems to know the root password. I can get into ALOM but not console mode. Is there a hack or something that cn get me back into this system lo reload it? (5 Replies)
Discussion started by: dewsdwarfs
5 Replies

8. Cybersecurity

One accout for FTP other to TELNET

Hi All, If I want to have two user accounts from the same grop in UNIX Solaries. However, I want one of them to be used only for FTP while the other for TELNET. Can anybody tell me how to do that? Best Regards (13 Replies)
Discussion started by: omran
13 Replies
Login or Register to Ask a Question