Solved

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

Posted on 2008-06-19
4
2,377 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSVDE Novell Directory -a password option isn't working keeps prompting 2 31
Why isn't object file created? 6 57
mcrypt_create_iv() is deprecated 4 143
Coding C# in Linux 8 61
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
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é.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

786 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