LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-04-2005, 05:47 PM   #1
tuananhbirm
Member
 
Registered: Apr 2004
Posts: 40

Rep: Reputation: 15
help with scrip


Hi, im using Mandrake 10 with tcsh shell. I want to use SSH to do some port forwarding to my school server, but for some port, i need to switch to root mode.
I just like to make a script file which automatically switch to root and do the SSH thing in there.
I tried:
su root ssh .....
su root && ssh ....
but not any good.

Anyone know how to do that ?

Cheers.
 
Old 02-04-2005, 06:04 PM   #2
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
It can't automatically switch to root because you'd need to enter the password, try using sudo it should work better
 
Old 02-04-2005, 06:06 PM   #3
tuananhbirm
Member
 
Registered: Apr 2004
Posts: 40

Original Poster
Rep: Reputation: 15
i meant after entering password to switch to root, it'll execute the SSH command
 
Old 02-04-2005, 06:18 PM   #4
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
Code:
#!/bin/bash

su -c "ssh 192.168.1.100"
 
Old 02-04-2005, 06:30 PM   #5
tuananhbirm
Member
 
Registered: Apr 2004
Posts: 40

Original Poster
Rep: Reputation: 15
Thank you very much, it works
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 01:43 AM
Can I use a scrip to mount a drive on network? Tiyogi Linux - Newbie 4 05-05-2004 03:02 AM
ppp scrip for auto login cvbuty Linux - Networking 0 01-27-2004 07:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration