Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2390
  • Last Modified:

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

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
zenguru
Asked:
zenguru
  • 2
2 Solutions
 
vrmuds1Commented:
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
 
zenguruAuthor Commented:
Please provide complete script that include the necessary commands and where in that script I put the pass phrase for RSA 'monkey island'?
0
 
TintinCommented:
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
 
zenguruAuthor Commented:
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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now