There are lot of requirements in the production environment where there is a need to have SSH without password prompt from one server to another under some id’s. But how to do that. Here is the solution and tips on how to approach this method without any bugs.
First of all lets take 2 servers
SERVER A and SERVER B
Here my requirement is to make some script which is in SERVER A copy some files from SERVER B and do some data updating activity in SERVER A.
Switch to the ID where you need the process to be running. [MAKE SURE THAT YOU HAVE HOME DIRECTORY SET FOR THE RESPECTIVE ID ON BOTH THE SERVERS]
Generate SSH keys in SERVER A.
ssh-keygen -t rsa
This will create PUBLIC KEY with an extension .PUB and another key which is the PRIVATE KEY inside the
Now Login to SERVER B and CHANGE DIRECTORY [cd command] to the home directory of the same id. Then copy the content of the PUBLIC KEY that was created in to a file named authorized_keys with command
cat <filename>.PUB >> authorized_keys
YOU ARE SET NOW
Logout of SERVER B and LOGIN WITH THE SAME ID ON SERVER A
ssh SERVER B
This will take you to SERVER B without any password prompt.
Make sure the home directory permission
/home/YOUR_ID This should be 755
The other files like PRIVATE AND PUBLIC KEYS and also the AUTHORIZED_KEYS should have only 600 permission. THIS IS A MUST OTHERWISE IT WONT WORK.
Incoming search terms:
- how to login from one server to another aix server (4)
- aix block login to another server (1)
- ssh in unix servers without password using cgi scripting (1)
- ssh between linux and aix (1)
- script for connecting one aix server to another aix server (1)
- passing data between servers shell script (1)
- linux aix ssh (1)
- how to transfer data from one process to another in unix aix (1)
- how to switch from one server to another server in unix using shell scripts (1)
- how to login unix without prompting the password (1)
- file transfer from one environment to other unix without password (1)
- connect to another linux server from script without password (1)
- apache ssh another server (1)
- aix pass parameters to php another server (1)
- ssh no password script aix (1)
You will also be interested in ,
- How can I concatenate two files in Unix?
- Find command in linux with examples
- Find the number of processor in linux using single command
- Shell Scripts Part 1
- /usr/bin/ssh-copy-id: ERROR: No identities found [Solved]
- LINDOWS SIMPLY A QUICK RECAP :-)
- Shell Scripts Part 2
- How can I use grep to find a word inside a folder?
- Rsync command-line switches example