Shell exercise (Key-free login script)

Source: Internet
Author: User
Tags chmod

#!/bin/bash
remote_ip=$1if[!-N" $"] ; Then Echo "Please usage./without_password remote_host!"Exit1Else Echo "The remote_host you input is $remote _ip"fiSSH[Email protected] $remote _IP"mkdir. ssh; chmod. SSH"Ssh-keygen-t RSASCP~/.SSH/id_rsa.pub [email protected]10.0.0.223:/root/.SSH/Authorized_keysSSH[Email protected]$1 "chmod ~/.ssh/authorized_keys"SSH[Email protected]$1ifconfig

Exit remote

[[Email protected] ~]# exitlogoutconnection to10.0.0.223closed.eth0 Link encap:ethernet HWaddrxx: 0C: in:D D: the: F9 inet Addr:10.0.0.50Bcast:10.255.255.255Mask:255.0.0.0Inet6 addr:fe80::20c:29ff:fedd:80f9/ -scope:link up broadcast RUNNING multicast MTU: theMetric:1RX Packets:9826Errors0Dropped0Overruns:0Frame0TX Packets:6413Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen: +RX Bytes:985311(962.2KiB) TX Bytes:915545(894.0KiB) Lo Link encap:local Loopback inet addr:127.0.0.1Mask:255.0.0.0Inet6 Addr: ::1/ -scope:host up LOOPBACK RUNNING MTU:65536Metric:1RX Packets:155Errors0Dropped0Overruns:0Frame0TX Packets:155Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen:0RX Bytes:16942(16.5KiB) TX Bytes:16942(16.5KiB)

Shell exercise (Key-free login script)

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.