Solved

linux shell script to execute commands automatically each time system is rebooted

Posted on 2008-06-19
4
2,376 Views
Last Modified: 2013-12-16
I set up rsa key pairs on my linux for ssh connection to remote server.
After this I had to run these commands:
nohup ssh-agent -s | grep -v echo > ~/.ssh-agent  
ssh-agent
ssh-add

each time I reboot the system.
What  commands do I need to so that above are executed automatically each time system is started?
Please clarify where so I enter the pass phrase ( assume pass phrase is 'monkey island' ).
Also let me know if it apply to any command or sequence of commands that I want to be executed on system startup?
I am using Fedora core 6.
0
Comment
Question by:zenguru
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
vrmuds1 earned 250 total points
ID: 21824193
You can put a script in /etc/rc3.d
Make sure you start it with a capital S
put your commands in there and they should run.  make sure you define full paths to the commands.

If you want it to run every time you log in, put the script in your .profile file in the root of your home directory.
0
 

Author Comment

by:zenguru
ID: 21826038
Please provide complete script that include the necessary commands and where in that script I put the pass phrase for RSA 'monkey island'?
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 250 total points
ID: 21826511
If you need to hard code the pass phrase, there's no point in having a pass phrase in the first place.

Much easier to have a blank pass phrase and not worry about running ssh-agent.
0
 

Author Comment

by:zenguru
ID: 21827239
I dont know what you are saying but I am waiting for solution for the problem as posted.
I dont understand what do you mean by hard coding? I am asking for a script that runs each time system
starts so that I dont have to enter passphrase each time I do ssh operation. so any one with physical access to PC with gain acces to remote server provided they know the password of the user they login as. A blank keyphrase would be a security risk as any outsider (no access to PC) could try a blank phrase.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now