Solved

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

Posted on 2008-06-19
4
2,375 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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)

Join & Write a Comment

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

15 Experts available now in Live!

Get 1:1 Help Now