SSH login without password
You set up a cron job and searching for -p parameter to pass ssh, for auto login. There is no such parameter. But there are many mechanisms to allow us authonize throgh. Like RSA autothentication.
The logic is give your public key to other host. Then it will identify you and let you pass in.
You want to backup server to rsync DB server to update lastest db dumps. I've created backupUser at DB server and File servers.
On backup server create RSA key.
ssh-keygen -t rsa
It will create both private key and public key, the former will be put to DB server
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nerkn/.ssh/id_rsa):
Accept the file path. Then it will ask passphase ( which is password you want to use). Since you dont want passphase pass it alone by entering enter.
Now you have public key, I cat contents and copied. Then login to DB server to paste it.
cat /home/nerkn/.ssh/id_rsa.pub
ssh backupUser@DBServer
nano -w .ssh/authorized_keys
Paste your public key.
If there is no .ssh folder, ssh back to the backup server. You wont bother permissions of .ssh folder. When you accept it as a known host.
Log off. And give a try.
ssh backupUser@DBServer
If you again need to enter password. You should tweak your DBServer to accept RSA auth. mechanism.
nano -w /etc/ssh/sshd_config
Only one of my servers, RSA auth is not by default.
Find and change
RSAAuthentication yes
Log off and try again.
if it doen't work anyway, you can investigate what is going on while authentication ask for the verbose mode.
ssh -v backupUser@DBServer
It's like magic. That there is no prompt for you to enter pass.
Similar
New technique to win olimpics
At the 1968 Olympics, Dick Fosbury took the athletics world by surprise with an unusual high-jump technique.
Printing mysql_error
This is a code snipped to print mysql error.
If there is no error mysql_error returns null, thus if evaluates false and there is no output.
multiple ON DUPLICATE KEY UPDATE
Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.
multiple ON DUPLICATE KEY UPDATE
Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.
php unlink recursive
The shortest recursive delete possible.
<?php
/**
* Delete a file or recursively delete a directory
*
* @param string $str Path to file or directory
*/


Comments
Post new comment