Configure ssh + rsync in linux

Source: Internet
Author: User
Tags ssh secure file transfer
In linux, ssh + rsyncssh remote login sftp file sharing is similar to ftpsshsecurefiletransferclientscp file sharing, which is similar to cpwww.2cto. comssh configuration file/etc/ssh/sshd_config # change PermitRootLoginyes to no... in linux, configure ssh + rsync ssh remote logon sftp file sharing, similar to ftp ssh secure file transfer clientscp file sharing, similar to cp www.2cto.com ssh configuration file/etc/ssh/sshd_config # PermitRootLogin yes to no prohibit direct root login # Port 22 change ssh default Port number to open comment restart ssh service sshd restart ssh login ssh gwyy@192.168.111.130 and then enter the password-2 ssh2 protocol is recommended to use ssh2 security better ssh-2- p specifies a non-standard port ssh-2-p2222 gwyy@192.168.11.130 www.2cto.com sftp can also be directly connected to this host sftp gwyy@192.168.11.130 scp copy remote file encrypted transfer scp local file username @ remote host address: remote host directory scp/etc/inittab root@192.168.111.130:/gwyyscp-r Local Directory username @ remote host address: remote host Directory-r copy file from remote host copy file to local scp username @ remote host address: remote host file local directory scp-r username @ remote host address: common options of remote directory local directory-p preserve file attributes, such as Time attribute-r copy Directory-P specifies port number example: crontab + scp remote backup crontab-e 0 2 ** 0/ usr/bin/scp-r web@192.168.1.1: /web/backup/web perform incremental backup from Monday to Saturday to generate an ssh key so that two hosts do not need a password. the first host root generates a public key and copies it to the gwyy Directory of the second host. host root connects to the second host gwyy without the password ssh-keygen-t rsa to generate the public key scp/root /. ssh/id_rsa.pub gwyy@192.168.111.130/home/gwyy copy the public key to another host second host account login manual creation. ssh directory mkdir. ssh is hidden. use ls-a to view cat id_rsa.pub>. ssh/authorized_keys and rename the copied file. ssh directory chmod 700. ssh permission change. only common users have permission for chmod 600. the ssh/authorized_keys permission must be 600 read/write permission. rsync is used for convenient Incremental Backup. you can use the ssh encrypted channel to save the entire directory and maintain the file permission for the file system. soft connections are available. high transmission efficiency is enabled. edit/etc/xinetd. d/rsync set disable = on enable by default not enable restart xinetd process service xinetd restart example do a backup crontab-e 0 2 ** 1-6/usr/bin from Week 1 to Week 6 /rsync-arHz -- delete gwyy@192.168.111.130: /web/backup copies the web Directory of another host to the back Directory of the local host-a maintains the file attribute-r subdirectory recursive processing-H maintains the hard link of the file-z compresses the backup file during transmission processing -- progress displays the transmission process during transmission -- delete deletes files not in the destination backup-e ssh encrypted tunnel transmission
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.