Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
form which user should i run the ssh-keygen?
root or fileadmin
if i run from root it ask to save in /root/.ssh/id_rsa.....
fileadmin! Every user has its own .ssh directory with its own keys (if any). If you run the rsync command as fileadmin, you have to create the keys as fileadmin and work in its own HOME directory (and leave root alone). The same for the backup server: if you connect as user fileadmin, the file authorized_keys has to be created under fileadmin's ~/.ssh directory.
Do you run the rsync command while you are logged in as root or as fileadmin?
This is important because if you run it as root all the generated ssh keys (id_rsa, id_rsa.pub) have to be in /root/.ssh/ of the client from which you run rsync.
With the rsync you connect to the backup. Here you should have the id_rsa.pub in /root/.ssh/authorized_keys.
1. Find out what user you use. (if fileadmin everything that I noted before should be in /home/fileadmin/.ssh/)
2. Check wheter the client from which you connect to the backup server does have the id_rsa and id_rsa.pub in $USERHOME/.ssh/
3. On backup server check whether you have in the $USERHOME/.ssh/ the authorized_keys file which contains the id_rsa.pub.
Remember you need to run rsync while you are logged in as a user for whom you created the keys on both servers (backup,master).
@centos123: You are starting it in #1 as root, but in #11 you used a different user fileadmin? You would have to put the public part of the root’s ssh-key in root’s /root/.ssh/authorized_keys then, and limit the root login at least to public-key method in /etc/ssh/sshd_config:
The authenticity of host '172.16.13.1 (172.16.13.1)' can't be established.\\\\\backup ip address
RSA key fingerprint is d6:31:d4:76:1f:16:c9:34:1d:6b:50:0e:ed:72:6a:da.
Are you sure you want to continue connecting (yes/no)?
NB1: there is the command ssh-copy-id to copy the public part of a key to another machine.
NB2: hashed ~/.ssh/known_host files can be altered by ssh-keygen -R <machine> where <machine> is a hostname, FQDN and/or TCP/IP address. Sometimes you have to issue the command twice as two entries were created by the first login.
Back to the issue:
- you can login as fileadmin to the other machine without password?
- you want to perform the rsync under the fileadmin user (and limit to backup files he can see)? In which crontab did you put the command - the global one in /etc or filedamin’s private one?
i deleted public and private from fileadmin user and generated key as a root...and copied id_rsa.pub in as /root/.ssh/authorized_key
in passphrase key i entered key.and when i login through ssh it ask for to enter passphrase key.i enter it and logged...
then i again generated key replacing public key and without entering passphrase key this time.Now this time iam able to login without entering root password as well as passphrase key.
now iam able to login.
Here, you did not use -e ssh but -e /home/fileadmin!
Anyway, if the public/private key are recognized by default (without specifying the key name with the -i option of ssh) you can omit the -e ssh option, since rsync uses the ssh protocol as default. It was useful only to specify the -i option.
The problem is not in the -e ssh option, but in the lack of the -r option to recurse directories. The option -a (archive mode) is a shortcut for -rlptgoD, which includes -r. Your command line should be:
You can try different options of rsync without actually copy anything (just for testing purposes) using option -n (or --dry-run) in conjunction with -v.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.