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
# 8  
Old 06-14-2006
Quote:
Originally Posted by naamas03
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
I'm sorry If you felt I had a bad reaction. Don't misunderstand me, that's not the case Smilie

As I told you before, I would use either of:
- The sudo tool.
- Telnet automation (https://www.unix.com/showthread.php?t...ghlight=telnet).
- ssh with digital certificates.
Personally, I would choose the first one, as I mentioned before.
# 9  
Old 06-15-2006
hi grial
it's o.k i just freek out i thought that i did something wrong
look you need to help me here because i did not realy understand how to do the first thing "sudo" shell i change system file for this , bacause if that so
i'm realy don't want so much to do this is there any other way?
2. the link that you attached to me i do'nt know what is the ip how shel i know that? besides it's look like a script to connect to other machine while i'm working at the same machine all the time
is there any other way to write the passwd it the same script to variable and he will connect such as :
"starting to search..."
bsd="root123"(passwd of root)
su root
passwd =$bsd
.
.
.
is there any way to do this ?
thanks for quick response
# 10  
Old 06-15-2006
Well, if you don't want to use sudo, try this:

Code:
# The IP is loopback, so that you connect to yourself.
IP=127.0.0.1
UNAME=root
PWD=rootpassword
echo "Connecting to $IP as root..."
(
    sleep 2 
    echo "$UNAME"; sleep 2
    echo "$PWD"; sleep 2
    echo "ksh cs-search"   # Commands here.
    sleep 2
) | telnet "$IP"
echo "End of root session."
if test -s b.log
........ 
fi
........

I hope this is what you want.
# 11  
Old 06-15-2006
i'm sorry grial you have to be very patient with me bacause
i didn't understand how i know my ip ? is there any command that display all this ? and if you be so kind to explain me a little bit about the script what is exactly the talnet ?
when you wrote connecting to yourself you mean " because i'm working on the same machine" write?
thaks a lot for being patient and for quick response
# 12  
Old 06-15-2006
You do not need to know your IP in this case. But if you want to, execute:

ifconfig -a

I think you should have a look to some tutorials and manuals about unix (and networking)... Smilie
# 13  
Old 06-15-2006
hi grial thank you thank you ....... itws work Smilie
i just want to understand if i donwt need the ip how should i do that
i wrote
UNAME=root
PWD=cnfg777
(
sleep 2
echo "$UNAME"; sleep 2
echo "$PWD"; sleep 2
ksh cs-search
sleep 2)
(without telnet) i see that is not run the cs-search
question 2 :
after he finishing the cs-search he comeback to the script and enviroment that call to him ?
question 3 Smiliethis is the last question)
if i have other users in the system and all of them ofcourse working on the same machine it's not disturber them right ?
it's behaving regular as if i was doing this process not automaticly?
thaks for huge help and for great patient!!!
you're rock!!!
# 14  
Old 06-15-2006
It's a bit difficult for me to understand you... You need to improve your english... Smilie
If
Code:
UNAME=root
PWD=cnfg777
(
sleep 2
echo "$UNAME"; sleep 2
echo "$PWD"; sleep 2 
ksh cs-search
sleep 2)

works it means you are executing as root and it's nonsense to execute such a thing. So:
Code:
ksh cs-search

alone will also work...
The code I posted before will work if you are executing the first script as a "normal" user and want "cs-search" run as root.

One more thing: Do not post your real user and password!
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