1、A:机器上执行:
[fengjm@db1 ~]$ mkdir .ssh
[fengjm@db1 ~]$ chmod 700 .ssh
[fengjm@db1 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/fengjm/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/fengjm/.ssh/id_rsa.
Your public key has been saved in /home/fengjm/.ssh/id_rsa.pub.
The key fingerprint is:
b4:35:0d:63:a9:63:a0:db:36:1f:ca:f4:15:91:8f:49 fengjm@db1
[fengjm@db1 ~]$ ls
abc mbox mytest
[fengjm@db1 ~]$ cd .ssh
[fengjm@db1 .ssh]$ ls
id_rsa id_rsa.pub
2、FTP 到B机器上:
[fengjm@db1 .ssh]$ ftp 172.16.90.21
Connected to 172.16.90.21.
220 rac2 FTP server (Version 5.60) ready.
334 Using authentication type GSSAPI; ADAT must follow
GSSAPI accepted as authentication type
GSSAPI error major: An invalid name was supplied
GSSAPI error minor: Cannot determine realm for numeric host address
GSSAPI error: parsing name
name parsed <ftp@172.16.90.21>
GSSAPI error major: An invalid name was supplied
GSSAPI error minor: Cannot determine realm for numeric host address
GSSAPI error: parsing name
name parsed <host@172.16.90.21>
GSSAPI authentication failed
334 Using authentication type KERBEROS_V4; ADAT must follow
KERBEROS_V4 accepted as authentication type
Kerberos V4 krb_mk_req failed: You have no tickets cached
Name (172.16.90.21:fengjm): oracle
331 Password required for oracle.
Password:
230 User oracle logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/home/oracle" is current directory.
ftp> bin
200 Type set to I.
ftp> put id_rsa.pub
local: id_rsa.pub remote: id_rsa.pub
227 Entering Passive Mode (172,16,90,21,128,10)
150 Opening BINARY mode data connection for id_rsa.pub.
226 Transfer complete.
220 bytes sent in 0.00077 seconds (2.8e+02 Kbytes/s)
ftp> quit
221 Goodbye.
3、登入B机器进入其主目录,创建authorized_keys文件,并设置好权限。
cd ~/.ssh
cat /tmp/id_rsa.pub >>authorized_keys
chmod 400 authorized_keys
rm -f /tmp/id_rsa.pub
4、在A机器上测试
[fengjm@db1 ~]$ scp my_ssh oracle@172.16.90.21:/home/oracle
my_ssh 100% 1883 1.8KB/s 00:00
[fengjm@db1 ~]$
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8102208/viewspace-464519/ ,如需转载,请注明出处,否则将追究法律责任。